Skip to main content

Interface: ITelemetryConnector

Interface describing a telemetry connector.

Extends​

  • IComponent

Methods​

createMetric()​

createMetric(metric): Promise<void>

Create one or more metrics. A single metric fails if it already exists; an array declares the set that should exist, creating the ones that are missing and leaving the rest untouched, so implementations which persist the definitions can resolve the whole set in one operation.

Parameters​

metric​

ITelemetryMetric | ITelemetryMetric[]

The metric details, or the details of several metrics.

Returns​

Promise<void>

A promise that resolves when the metrics have been created.


getMetric()?​

optional getMetric(id): Promise<{ metric: ITelemetryMetric; value?: ITelemetryMetricValue; }>

Get the metric details and it's most recent value.

Parameters​

id​

string

The metric id.

Returns​

Promise<{ metric: ITelemetryMetric; value?: ITelemetryMetricValue; }>

The metric details and it's most recent value.


getMetricValue()?​

optional getMetricValue(id, valueId): Promise<ITelemetryMetricValue>

Get a specific metric value by its id.

Parameters​

id​

string

The id of the metric.

valueId​

string

The id of the metric value.

Returns​

Promise<ITelemetryMetricValue>

The metric value.


updateMetric()​

updateMetric(metric): Promise<void>

Update metric.

Parameters​

metric​

Omit<ITelemetryMetric, "type">

The metric details.

Returns​

Promise<void>

A promise that resolves when the metric has been updated.


addMetricValue()​

addMetricValue(id, value, customData?): Promise<string>

Update metric value.

Parameters​

id​

string

The id of the metric.

value​

number | MetricCounterOperation

The value for the update operation.

customData?​

The custom data for the update operation.

Returns​

Promise<string>

The created metric value id.


addMetricValues()​

addMetricValues(values): Promise<string[]>

Add multiple metric values, so implementations which persist them can do so in one operation instead of one per value.

Parameters​

values​

ITelemetryMetricValueEntry[]

The metric values to add.

Returns​

Promise<string[]>

The created metric value ids, in the order the values were supplied.


removeMetric()​

removeMetric(id): Promise<void>

Remove metric.

Parameters​

id​

string

The id of the metric.

Returns​

Promise<void>

A promise that resolves when the metric and all its values have been removed.


query()?​

optional query(type?, cursor?, limit?): Promise<{ entities: ITelemetryMetric[]; cursor?: string; }>

Query the metrics.

Parameters​

type?​

MetricType

The type of the metric.

cursor?​

string

The cursor to request the next chunk of entities.

limit?​

number

Limit the number of entities to return.

Returns​

Promise<{ entities: ITelemetryMetric[]; cursor?: string; }>

All the entities for the storage matching the conditions, and a cursor which can be used to request more entities.

Throws​

NotImplementedError if the implementation does not support retrieval.


queryValues()?​

optional queryValues(id, timeStart?, timeEnd?, cursor?, limit?): Promise<{ metric: ITelemetryMetric; entities: ITelemetryMetricValue[]; cursor?: string; }>

Query the metric values.

Parameters​

id​

string

The id of the metric.

timeStart?​

number

The inclusive time as the start of the metric entries.

timeEnd?​

number

The inclusive time as the end of the metric entries.

cursor?​

string

The cursor to request the next chunk of entities.

limit?​

number

Limit the number of entities to return.

Returns​

Promise<{ metric: ITelemetryMetric; entities: ITelemetryMetricValue[]; cursor?: string; }>

All the entities for the storage matching the conditions, and a cursor which can be used to request more entities.

Throws​

NotImplementedError if the implementation does not support retrieval.