Cortex Client
About
It is a ruby library to push timeseries metrics to cortex.
Prerequisites
ruby - 2.5.0
Usage
Step1: Configure the client
CortexClient.configure do |config|
config.host = 'https://lens.golabs.io'
config.metrics_push_api_path = 'v1/prom/metrics'
config.token = "sample_token"
end
Step2: Push a timeseries based metric
To push synchronously
metric = CortexClient::Metric.new('test_usage')
response = metric.
add_label(name: "team_name", value: "kernel_ux").
add_label(name: "email", value: "[email protected]").add_sample(value: 1).push
The metric instance has the error appended if there's any and if there's no error, then the instance
has a prom_message in it.