Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Update wip metrics references #2638

Merged
merged 3 commits into from
Nov 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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