Skip to content

Commit

Permalink
chore: clear Prometheus todo and rename ReadableMetric -> MetricRecord (
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurkale22 authored Feb 20, 2020
1 parent 6616bb1 commit cdec557
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion doc/exporter-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The `MetricExporter` defines the interface that protocol-specific exporters must

The current `MetricExporter` interface (`0.2.0`) defines 2 methods:

- `export`: Exports a batch of telemetry data. In this method you’ll process and translate `ReadableMetric` Data into the data that your metric backend accepts.
- `export`: Exports a batch of telemetry data. In this method you’ll process and translate `MetricRecord` Data into the data that your metric backend accepts.

- `shutdown`: Shuts down the exporter. This is an opportunity for exporter to do any cleanup required. `Shutdown` should be called only once for each Exporter instance. After the call to `Shutdown` subsequent calls to Export are not allowed and should return `FailedNotRetryable` error.

Expand Down
18 changes: 9 additions & 9 deletions packages/opentelemetry-exporter-prometheus/src/prometheus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ export class PrometheusExporter implements MetricExporter {
}

/**
* Saves the current values of all exported {@link ReadableMetric}s so that they can be pulled
* by the Prometheus backend.
* Saves the current values of all exported {@link MetricRecord}s so that
* they can be pulled by the Prometheus backend.
*
* @todo reach into metrics to pull metric values on endpoint
* In its current state, the exporter saves the current values of all metrics when export
* is called and returns them when the export endpoint is called. In the future, this should
* be a no-op and the exporter should reach into the metrics when the export endpoint is
* called. As there is currently no interface to do this, this is our only option.
* In its current state, the exporter saves the current values of all metrics
* when export is called and returns them when the export endpoint is called.
* In the future, this should be a no-op and the exporter should reach into
* the metrics when the export endpoint is called. As there is currently no
* interface to do this, this is our only option.
*
* @param records Metrics to be sent to the prometheus backend
* @param cb result callback to be called on finish
Expand Down Expand Up @@ -127,7 +127,7 @@ export class PrometheusExporter implements MetricExporter {

if (metric instanceof Counter) {
// Prometheus counter saves internal state and increments by given value.
// ReadableMetric value is the current state, not the delta to be incremented by.
// MetricRecord value is the current state, not the delta to be incremented by.
// Currently, _registerMetric creates a new counter every time the value changes,
// so the increment here behaves as a set value (increment from 0)
metric.inc(this._getLabelValues(labelKeys, record.labels), value as Sum);
Expand Down Expand Up @@ -162,7 +162,7 @@ export class PrometheusExporter implements MetricExporter {

/**
* Prometheus library does aggregation, which means its inc method must be called with
* the value to be incremented by. It does not have a set method. As our ReadableMetric
* the value to be incremented by. It does not have a set method. As our MetricRecord
* contains the current value, not the value to be incremented by, we destroy and
* recreate counters when they are updated.
*
Expand Down

0 comments on commit cdec557

Please sign in to comment.