Rust Agent for Aino.io
Rust implementation of Aino.io logging agent.
What is Aino.io and what does this Agent have to do with it?
Aino.io is an analytics and monitoring tool for integrated enterprise applications and digital business processes. Aino.io can help organizations manage, develop, and run the digital parts of their day-to-day business. Read more from our web pages.
Aino.io works by analyzing transactions between enterprise applications and other pieces of software. This Agent helps to store data about the transactions to Aino.io platform using Aino.io Data API (version 2.0). See API documentation for detailed information about the API.
Technical requirements
- Rust 1.39
1. Usage
Add this to your Cargo.toml
:
[]
= "1.0"
Now, you can use ainoio-agent:
use ainoio_agent;
2. Configuring the agent
Agent is configured with an TOML configuration file. Below is an example.
let config = new.expect;
Configuration file example
[]
= "https://data.aino.io/rest/v2/transaction"
= "<your api key here>"
= 1000
The configuration files are placed in a config-directory. They are read in the following order:
- config/default.toml
- config/.toml
- the environmant is read from the RUN_MODE environment variable.
- config/local.toml
- This should be used to local testing, and should not be commited.
- All environment variables prefixed with AINO.
3. Send a request to Aino.io:
Example
Logging is done by creating a Transaction
object and passing it to the agent:
use ainoio_agent;
use SystemTime;
// Load the configuration
let config = new?;
// Start the Aino agent
// This must be called exactly once before any transactions are sent
start?;
let timestamp = now.duration_since.unwrap;
// Create transaction object
let mut transaction = new;
transaction.message = Some;
transaction.payload_type = Some;
let metadata = new;
transaction.add_metadata;
let id = new;
transaction.add_id;
// Add the transaction into the queue, it will be sent after `send_interval' has elapsed at the latests
add_transaction.expect;
License
Copyright © 2020 Aino.io. Licensed under the Apache 2.0 License.