Skip to content

Commit

Permalink
chore: Update wip metrics references (#2638)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored Nov 27, 2021
1 parent 5e9c7e1 commit 14afcc1
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { MetricOptions, ValueType } from '@opentelemetry/api-metrics';
import { MetricOptions, ValueType } from '@opentelemetry/api-metrics-wip';
import { InstrumentType } from './Instruments';

export interface InstrumentDescriptor {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as api from '@opentelemetry/api';
import * as metrics from '@opentelemetry/api-metrics';
import * as metrics from '@opentelemetry/api-metrics-wip';
import { InstrumentDescriptor } from './InstrumentDescriptor';
import { WritableMetricStorage } from './state/WritableMetricStorage';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as api from '@opentelemetry/api'
import { Attributes } from '@opentelemetry/api-metrics'
import { Attributes } from '@opentelemetry/api-metrics-wip'

// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/metrics/api.md#measurement

Expand Down
20 changes: 16 additions & 4 deletions experimental/packages/opentelemetry-sdk-metrics-base/src/Meter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import * as metrics from '@opentelemetry/api-metrics';
import * as metrics from '@opentelemetry/api-metrics-wip';
import { InstrumentationLibrary } from '@opentelemetry/core';
import { createInstrumentDescriptor, InstrumentDescriptor } from './InstrumentDescriptor';
import { Counter, Histogram, InstrumentType, UpDownCounter } from './Instruments';
Expand Down Expand Up @@ -54,15 +54,27 @@ export class Meter implements metrics.Meter {
return new UpDownCounter(storage, descriptor);
}

createObservableGauge(_name: string, _options?: metrics.MetricOptions, _callback?: (observableResult: metrics.ObservableResult) => void): metrics.ObservableBase {
createObservableGauge(
_name: string,
_callback: (observableResult: metrics.ObservableResult) => void,
_options?: metrics.MetricOptions,
): metrics.ObservableGauge {
throw new Error('Method not implemented.');
}

createObservableCounter(_name: string, _options?: metrics.MetricOptions, _callback?: (observableResult: metrics.ObservableResult) => void): metrics.ObservableBase {
createObservableCounter(
_name: string,
_callback: (observableResult: metrics.ObservableResult) => void,
_options?: metrics.MetricOptions,
): metrics.ObservableBase {
throw new Error('Method not implemented.');
}

createObservableUpDownCounter(_name: string, _options?: metrics.MetricOptions, _callback?: (observableResult: metrics.ObservableResult) => void): metrics.ObservableBase {
createObservableUpDownCounter(
_name: string,
_callback: (observableResult: metrics.ObservableResult) => void,
_options?: metrics.MetricOptions,
): metrics.ObservableBase {
throw new Error('Method not implemented.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as api from '@opentelemetry/api';
import * as metrics from '@opentelemetry/api-metrics';
import * as metrics from '@opentelemetry/api-metrics-wip';
import { Resource } from '@opentelemetry/resources';
import { Meter } from './Meter';
import { MetricExporter } from './MetricExporter';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { Context } from '@opentelemetry/api';
import { Attributes } from '@opentelemetry/api-metrics';
import { Attributes } from '@opentelemetry/api-metrics-wip';
import { WritableMetricStorage } from './WritableMetricStorage';

export class MultiMetricStorage implements WritableMetricStorage {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { Context } from '@opentelemetry/api';
import { Attributes } from '@opentelemetry/api-metrics';
import { Attributes } from '@opentelemetry/api-metrics-wip';

export interface WritableMetricStorage {
record(value: number, attributes: Attributes, context: Context): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { Context } from '@opentelemetry/api';
import { Attributes } from '@opentelemetry/api-metrics';
import { Attributes } from '@opentelemetry/api-metrics-wip';

/**
* The {@link AttributesProcessor} is responsible for customizing which
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ export interface Predicate {
*/
export class PatternPredicate implements Predicate {
private _matchAll: boolean;
private _regexp?: RegExp;
private _regexp: RegExp;

constructor(pattern: string) {
if (pattern === '*') {
this._matchAll = true;
this._regexp = /.*/;
} else {
this._matchAll = false;
this._regexp = new RegExp(PatternPredicate.escapePattern(pattern));
Expand All @@ -44,7 +45,7 @@ export class PatternPredicate implements Predicate {
return true;
}

return this._regexp!.test(str);
return this._regexp.test(str);
}

static escapePattern(pattern: string): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import * as assert from 'assert';
import { ValueType } from '@opentelemetry/api-metrics';
import { ValueType } from '@opentelemetry/api-metrics-wip';
import { InstrumentationLibrary } from '@opentelemetry/core';
import { InstrumentType } from '../../src/Instruments';
import { ViewRegistry } from '../../src/view/ViewRegistry';
Expand Down

0 comments on commit 14afcc1

Please sign in to comment.