Crates.io | ainoio-agent |
lib.rs | ainoio-agent |
version | 3.1.0 |
source | src |
created_at | 2020-03-24 11:30:50.904683 |
updated_at | 2020-03-27 09:57:21.12778 |
description | Aino.io agent |
homepage | https://aino.io |
repository | https://github.com/Aino-io/aino-agent-rust |
max_upload_size | |
id | 222279 |
size | 37,261 |
Rust implementation of Aino.io logging agent.
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.
Add this to your Cargo.toml
:
[dependencies]
ainoio-agent = "1.0"
Now, you can use ainoio-agent:
use ainoio_agent;
Agent is configured with an TOML configuration file. Below is an example.
let config = ainoio_agent::AinoConfig::new().expect("Failed to load aino configuration");
[connection]
url = "https://data.aino.io/rest/v2/transaction"
api_key = "<your api key here>"
send_interval = 1000
The configuration files are placed in a config-directory. They are read in the following order:
Logging is done by creating a Transaction
object and passing it to the agent:
use ainoio_agent;
use std::time::SystemTime;
// Load the configuration
let config = ainoio_agent::AinoConfig::new()?;
// Start the Aino agent
// This must be called exactly once before any transactions are sent
ainoio_agent::start(config)?;
let timestamp = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();
// Create transaction object
let mut transaction = ainoio_agent::Transaction::new("SAP".to_string(),
"Card Management".to_string(), "Payment".to_string(), ainoio_agent::Status::Success,
timestamp.as_millis(), "1249F41E55A1123FB".to_string());
transaction.message = Some("Data transfer successful.".to_string());
transaction.payload_type = Some("Product Update".to_string());
let metadata = ainoio_agent::TransactionMetadata::new("Card API".to_string(), "https://somecardsystem.com".to_string());
transaction.add_metadata(metadata);
let id = ainoio_agent::TransactionId::new("OrderId".to_string(), vec!["123456".to_string(), "xxasd".to_string()]);
transaction.add_id(id);
// Add the transaction into the queue, it will be sent after `send_interval' has elapsed at the latests
ainoio_agent::add_transaction(transaction).expect("Failed to add transaction to the send queue.");
Copyright © 2020 Aino.io. Licensed under the Apache 2.0 License.