Skip to content

Commit

Permalink
refactor: migrate api-metrics in all packages to @opentelemetry/api
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Nov 2, 2022
1 parent 6d33bfb commit 983d966
Show file tree
Hide file tree
Showing 79 changed files with 193 additions and 215 deletions.
3 changes: 1 addition & 2 deletions examples/opentelemetry-web/examples/metrics/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const { DiagConsoleLogger, DiagLogLevel, diag } = require('@opentelemetry/api');
const { metrics } = require('@opentelemetry/api-metrics');
const { DiagConsoleLogger, DiagLogLevel, diag, metrics } = require('@opentelemetry/api');
const { OTLPMetricExporter } = require('@opentelemetry/exporter-metrics-otlp-http');
const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics');

Expand Down
3 changes: 1 addition & 2 deletions examples/opentelemetry-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@
"webpack-merge": "^5.8.0"
},
"dependencies": {
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/context-zone": "1.7.0",
"@opentelemetry/core": "1.7.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.33.0",
Expand Down
3 changes: 1 addition & 2 deletions examples/otlp-exporter-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^1.1.0",
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/core": "1.7.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.33.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.33.0",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/api-logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ Apache 2.0 - See [LICENSE][license-url] for more information.
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api-metrics
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi-metrics.svg
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api-logs
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi-logs.svg
[logs-api-docs]: https://open-telemetry.github.io/opentelemetry-js/modules/_opentelemetry_api_logs.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
"devDependencies": {
"@babel/core": "7.16.0",
"@grpc/proto-loader": "^0.7.3",
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { Counter, Histogram, ObservableGauge, ObservableResult, ValueType } from '@opentelemetry/api-metrics';
import { Counter, Histogram, ObservableGauge, ObservableResult, ValueType } from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import * as assert from 'assert';
import * as grpc from '@grpc/grpc-js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/core": "1.7.0",
"@opentelemetry/otlp-exporter-base": "0.33.0",
"@opentelemetry/otlp-transformer": "0.33.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { diag, DiagLogger, DiagLogLevel } from '@opentelemetry/api';
import { Counter, Histogram, } from '@opentelemetry/api-metrics';
import { diag, DiagLogger, DiagLogLevel, Counter, Histogram } from '@opentelemetry/api';
import { ExportResultCode, hrTimeToNanoseconds } from '@opentelemetry/core';
import { AggregationTemporality, ResourceMetrics, } from '@opentelemetry/sdk-metrics';
import * as assert from 'assert';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
ObservableCounter,
ObservableGauge,
ObservableUpDownCounter,
} from '@opentelemetry/api-metrics';
} from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import * as assert from 'assert';
import { InstrumentationScope, VERSION } from '@opentelemetry/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
},
"devDependencies": {
"@babel/core": "7.16.0",
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@types/mocha": "10.0.0",
"@types/node": "18.6.5",
"@types/sinon": "10.0.13",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
Histogram,
ValueType,
ObservableGauge,
} from '@opentelemetry/api-metrics';
} from '@opentelemetry/api';
import { Resource } from '@opentelemetry/resources';
import * as assert from 'assert';
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@opentelemetry/api": "^1.0.0"
},
"dependencies": {
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/core": "1.7.0",
"@opentelemetry/sdk-metrics": "0.33.0",
"@opentelemetry/resources": "1.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@
* limitations under the License.
*/

import { diag } from '@opentelemetry/api';
import {
diag,
MetricAttributes,
MetricAttributeValue,
} from '@opentelemetry/api';
import {
ResourceMetrics,
InstrumentType,
Expand All @@ -24,10 +28,6 @@ import {
DataPoint,
Histogram,
} from '@opentelemetry/sdk-metrics';
import type {
MetricAttributes,
MetricAttributeValue
} from '@opentelemetry/api-metrics';
import { hrTimeToMilliseconds } from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';

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

import {
Counter,
Meter,
ObservableResult
} from '@opentelemetry/api-metrics';
} from '@opentelemetry/api';
import { MeterProvider } from '@opentelemetry/sdk-metrics';
import * as assert from 'assert';
import * as sinon from 'sinon';
Expand All @@ -28,7 +29,6 @@ import {
mockHrTime
} from './util';
import { SinonStubbedInstance } from 'sinon';
import { Counter } from '@opentelemetry/api-metrics';

const serializedEmptyResourceLines = [
'# HELP target_info Target metadata',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as assert from 'assert';
import {
MetricAttributes,
UpDownCounter
} from '@opentelemetry/api-metrics';
} from '@opentelemetry/api';
import {
Aggregation,
AggregationTemporality,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
},
{
"path": "../../../packages/opentelemetry-core"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@
"typescript": "4.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
"@opentelemetry/api": "^1.2.0"
},
"dependencies": {
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/instrumentation": "0.33.0",
"@opentelemetry/semantic-conventions": "1.7.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import { VERSION } from './version';
import { GrpcNativeInstrumentation } from './grpc';
import { GrpcJsInstrumentation } from './grpc-js';
import * as api from '@opentelemetry/api';
import { MeterProvider } from '@opentelemetry/api-metrics';

/** The metadata key under which span context is stored as a binary value. */
export const GRPC_TRACE_KEY = 'grpc-trace-bin';
Expand Down Expand Up @@ -81,7 +80,7 @@ export class GrpcInstrumentation {
* Sets MeterProvider to this plugin
* @param meterProvider
*/
public setMeterProvider(meterProvider: MeterProvider) {
public setMeterProvider(meterProvider: api.MeterProvider) {
this._grpcJsInstrumentation.setMeterProvider(meterProvider);
this._grpcNativeInstrumentation.setMeterProvider(meterProvider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
},
{
"path": "../../../packages/opentelemetry-context-async-hooks"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
"typescript": "4.4.4"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
"@opentelemetry/api": "^1.2.0"
},
"dependencies": {
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"@opentelemetry/core": "1.7.0",
"@opentelemetry/instrumentation": "0.33.0",
"@opentelemetry/sdk-metrics": "0.33.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ import {
SpanStatus,
SpanStatusCode,
trace,
Histogram,
MeterProvider,
MetricAttributes,
ValueType,
} from '@opentelemetry/api';
import { Histogram, MeterProvider, MetricAttributes, ValueType } from '@opentelemetry/api-metrics';
import { hrTime, hrTimeDuration, hrTimeToMilliseconds, suppressTracing } from '@opentelemetry/core';
import type * as http from 'http';
import type * as https from 'https';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
import {
MetricAttributes,
SpanAttributes,
SpanStatusCode,
Span,
Expand All @@ -35,7 +36,6 @@ import { getRPCMetadata, RPCType } from '@opentelemetry/core';
import * as url from 'url';
import { AttributeNames } from './enums/AttributeNames';
import { Err, IgnoreMatcher, ParsedRequestOptions } from './types';
import { MetricAttributes } from '@opentelemetry/api-metrics';

/**
* Get an absolute url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
},
{
"path": "../../../packages/opentelemetry-context-async-hooks"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api-metrics": "0.33.0",
"@opentelemetry/api": "^1.2.0",
"require-in-the-middle": "^5.0.3",
"semver": "^7.3.2",
"shimmer": "^1.2.1"
},
"peerDependencies": {
"@opentelemetry/api": "^1.0.0"
"@opentelemetry/api": "^1.2.0"
},
"devDependencies": {
"@babel/core": "7.16.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { trace } from '@opentelemetry/api';
import { metrics } from '@opentelemetry/api-metrics';
import { trace, metrics } from '@opentelemetry/api';
import {
disableInstrumentations,
enableInstrumentations,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { TracerProvider } from '@opentelemetry/api';
import { MeterProvider } from '@opentelemetry/api-metrics';
import { TracerProvider, MeterProvider } from '@opentelemetry/api';
import { Instrumentation } from './types';
import { AutoLoaderResult, InstrumentationOption } from './types_internal';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
import {
diag,
DiagLogger,
metrics,
Meter,
MeterProvider,
trace,
Tracer,
TracerProvider,
} from '@opentelemetry/api';
import { Meter, MeterProvider, metrics } from '@opentelemetry/api-metrics';
import * as shimmer from 'shimmer';
import { InstrumentationModuleDefinition } from './platform/node';
import * as types from './types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { TracerProvider } from '@opentelemetry/api';
import { MeterProvider } from '@opentelemetry/api-metrics';
import { TracerProvider, MeterProvider } from '@opentelemetry/api';

/** Interface Instrumentation to apply patch. */
export interface Instrumentation {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { TracerProvider } from '@opentelemetry/api';
import { MeterProvider } from '@opentelemetry/api-metrics';
import { TracerProvider, MeterProvider } from '@opentelemetry/api';
import { InstrumentationBase } from './platform';
import { Instrumentation } from './types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
* limitations under the License.
*/

import { Tracer, TracerProvider } from '@opentelemetry/api';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { InstrumentationBase, registerInstrumentations } from '../../src';
import {
Tracer,
TracerProvider,
Meter,
MeterOptions,
MeterProvider,
} from '@opentelemetry/api-metrics';
} from '@opentelemetry/api';
import * as assert from 'assert';
import * as sinon from 'sinon';
import { InstrumentationBase, registerInstrumentations } from '../../src';

class DummyTracerProvider implements TracerProvider {
getTracer(name: string, version?: string): Tracer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@
"references": [
{
"path": "../../../api"
},
{
"path": "../../../api-metrics"
}
]
}
Loading

0 comments on commit 983d966

Please sign in to comment.