Class PrometheusClient
Client for interacting with the Prometheus API.
Namespace: Neon.Kube
Assembly: Neon.Kube.dll
Syntax
public class PrometheusClient
Constructors
PrometheusClient(string, string, string)
Constructor.
Declaration
public PrometheusClient(string uri, string username = null, string password = null)
Parameters
Type | Name | Description |
---|---|---|
string | uri | Specifies the Prometheus server URI |
string | username | Optionally specifies the user name. |
string | password | Optionally Specifies the password. |
Properties
JsonClient
Returns backing JsonClient.
Declaration
public JsonClient JsonClient { get; }
Property Value
Type | Description |
---|---|
JsonClient |
Methods
QueryAsync(string, CancellationToken)
Executes a Prometheus query.
Declaration
public Task<PrometheusResponse<PrometheusVectorResult>> QueryAsync(string query, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | query | Specifies the Prometheus query. |
CancellationToken | cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<PrometheusResponse<PrometheusVectorResult>> |
QueryRangeAsync(string, DateTime, DateTime, TimeSpan, CancellationToken)
Executes a date range Prometheus query.
Declaration
public Task<PrometheusResponse<PrometheusMatrixResult>> QueryRangeAsync(string query, DateTime start, DateTime end, TimeSpan stepSize = default, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
string | query | Specifies the Prometheus query. |
DateTime | start | Specifies the starting time for the query. |
DateTime | end | Specifies the ending time for the query. |
TimeSpan | stepSize | Optionally specifies the query step size. This defaults to 15 seconds). |
CancellationToken | cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task<PrometheusResponse<PrometheusMatrixResult>> |