Notice: This is not the openTSD.net web page repository. If you are looking for this then try HERE
openTSDB.net is a low weight, low impact implementation of a application to OpenTSDB bridge.
Although the openTSDB API is powerfull this library concentrates on one thing.
Getting data into the openTSDB
This is the only concern of this library. If you want a more complete interaction model then please contact me.
PM> Install-Package openTSDB.net
Term | Definition |
---|---|
Named instance | A instance of the manager that can be accessed using a globally unique name and the same instance shared by many |
Anonymous instance | A instance of the manager that can not be accessed using a name and therefore can not be retrieved multiple time from the factory |
Manager | The openTsdb factory is the entry point of the library, but the manager is the core implementation and object that the client is interacting with |
Hit the ground running
OpenTsdb.net uses a factory pattern to provide "unknown" and named instances of the manager.
var tsdbManager = OpenTsdbFactory.Instance(TsdbOptions.New("http://localhost:4242"), "myInstance");
Where myInstance is the instance identifier.
If the instance was already initialized by someone else then the same instance will be returned.
var tsdbManager = OpenTsdbFactory.Instance(TsdbOptions.New("http://localhost:4242"));
The point of this all is to get data into the openTSDB database.
This can be done...
If we want to publish only one data point then this can easily be achieved by
tsdbManager.PushAsync<int>("login", 1);
There is also a longer way that provides more control over the data transmitted.
var dataPoint = new DataPoint<int>
{
Value = 23,
Metric = "user_age",
Timestamp = DateTime.Now.ToEpoch(),
Tags = new TagsCollection()
};
var result = tsdbManager.PushAsync<int>(dataPoint);