Skip to content

Commit

Permalink
refactor: merge opentelemetry-base to opentelemetry-core
Browse files Browse the repository at this point in the history
They act a very similar role in the SDK.
  • Loading branch information
legendecas committed Apr 29, 2020
1 parent e4e71b8 commit 659b65b
Show file tree
Hide file tree
Showing 27 changed files with 89 additions and 29 deletions.
21 changes: 21 additions & 0 deletions packages/opentelemetry-core/src/ExportResult.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*!
* Copyright 2019, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export enum ExportResult {
SUCCESS,
FAILED_NOT_RETRYABLE,
FAILED_RETRYABLE,
}
1 change: 1 addition & 0 deletions packages/opentelemetry-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export * from './common/ConsoleLogger';
export * from './common/NoopLogger';
export * from './common/time';
export * from './common/types';
export * from './ExportResult';
export * from './version';
export * from './context/context';
export * from './context/propagation/B3Propagator';
Expand Down
25 changes: 25 additions & 0 deletions packages/opentelemetry-core/src/platform/browser/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { VERSION } from '../../version';

/** Constants describing the SDK in use */
export const SDK_INFO = {
NAME: 'opentelemetry',
RUNTIME: 'browser',
LANGUAGE: 'webjs',
VERSION: VERSION,
};
1 change: 1 addition & 0 deletions packages/opentelemetry-core/src/platform/browser/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

export * from './constants';
export * from './id';
export * from './performance';
export * from './timer-util';
Expand Down
25 changes: 25 additions & 0 deletions packages/opentelemetry-core/src/platform/node/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Copyright 2020, OpenTelemetry Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { VERSION } from '../../version';

/** Constants describing the SDK in use */
export const SDK_INFO = {
NAME: 'opentelemetry',
RUNTIME: 'node',
LANGUAGE: 'nodejs',
VERSION: VERSION,
};
1 change: 1 addition & 0 deletions packages/opentelemetry-core/src/platform/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

export * from './constants';
export * from './id';
export * from './performance';
export * from './timer-util';
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-exporter-collector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"dependencies": {
"@grpc/proto-loader": "^0.5.3",
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/resources": "^0.7.0",
"@opentelemetry/tracing": "^0.7.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { ExportResult } from '@opentelemetry/base';
import { NoopLogger } from '@opentelemetry/core';
import { ExportResult, NoopLogger } from '@opentelemetry/core';
import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing';
import { Attributes, Logger } from '@opentelemetry/api';
import { onInit, onShutdown, sendSpans } from './platform/index';
Expand Down
5 changes: 2 additions & 3 deletions packages/opentelemetry-exporter-collector/src/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
TimedEvent,
TraceState,
} from '@opentelemetry/api';
import { SDK_INFO } from '@opentelemetry/base';
import * as core from '@opentelemetry/core';
import { Resource } from '@opentelemetry/resources';
import { ReadableSpan } from '@opentelemetry/tracing';
Expand Down Expand Up @@ -218,8 +217,8 @@ export function toCollectorExportTraceServiceRequest(
const instrumentationLibrarySpans: opentelemetryProto.trace.v1.InstrumentationLibrarySpans = {
spans: spansToBeSent,
instrumentationLibrary: {
name: name || `${SDK_INFO.NAME} - ${SDK_INFO.LANGUAGE}`,
version: SDK_INFO.VERSION,
name: name || `${core.SDK_INFO.NAME} - ${core.SDK_INFO.LANGUAGE}`,
version: core.SDK_INFO.VERSION,
},
};
const resourceSpan: opentelemetryProto.trace.v1.ResourceSpans = {
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-exporter-jaeger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/tracing": "^0.7.0",
"jaeger-client": "^3.15.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/opentelemetry-exporter-jaeger/src/jaeger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
*/

import * as api from '@opentelemetry/api';
import { ExportResult } from '@opentelemetry/base';
import { NoopLogger } from '@opentelemetry/core';
import { ExportResult, NoopLogger } from '@opentelemetry/core';
import { ReadableSpan, SpanExporter } from '@opentelemetry/tracing';
import { Socket } from 'dgram';
import { spanToThrift } from './transform';
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-exporter-prometheus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/metrics": "^0.7.0",
"prom-client": "^11.5.3"
Expand Down
3 changes: 1 addition & 2 deletions packages/opentelemetry-exporter-prometheus/src/prometheus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { ExportResult } from '@opentelemetry/base';
import { NoopLogger, hrTimeToMilliseconds } from '@opentelemetry/core';
import { ExportResult, NoopLogger, hrTimeToMilliseconds } from '@opentelemetry/core';
import {
CounterSumAggregator,
LastValue,
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-exporter-zipkin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/resources": "^0.7.0",
"@opentelemetry/tracing": "^0.7.0"
Expand Down
3 changes: 1 addition & 2 deletions packages/opentelemetry-exporter-zipkin/src/zipkin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ import * as types from '@opentelemetry/api';
import * as http from 'http';
import * as https from 'https';
import * as url from 'url';
import { NoopLogger } from '@opentelemetry/core';
import { ExportResult, NoopLogger } from '@opentelemetry/core';
import { SpanExporter, ReadableSpan } from '@opentelemetry/tracing';
import { ExportResult } from '@opentelemetry/base';
import * as zipkinTypes from './types';
import {
toZipkinSpan,
Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-metrics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/resources": "^0.7.0"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { MetricExporter, MetricRecord, Distribution, Histogram } from './types';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';

/**
* This is implementation of {@link MetricExporter} that prints metrics data to
Expand Down
3 changes: 1 addition & 2 deletions packages/opentelemetry-metrics/src/export/Controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@
* limitations under the License.
*/

import { unrefTimer } from '@opentelemetry/core';
import { ExportResult, unrefTimer } from '@opentelemetry/core';
import { Meter } from '../Meter';
import { MetricExporter } from './types';
import { ExportResult } from '@opentelemetry/base';

const DEFAULT_EXPORT_INTERVAL = 60_000;

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-metrics/src/export/NoopExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { MetricExporter, MetricRecord } from './types';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';

export class NoopExporter implements MetricExporter {
// By default does nothing
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-metrics/src/export/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

import { ValueType, HrTime, Labels } from '@opentelemetry/api';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';

/** The kind of metric. */
export enum MetricKind {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/web": "^0.7.0",
"shimmer": "^1.2.1"
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-resources/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"gcp-metadata": "^3.5.0"
}
}
2 changes: 1 addition & 1 deletion packages/opentelemetry-resources/src/Resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { SDK_INFO } from '@opentelemetry/base';
import { SDK_INFO } from '@opentelemetry/core';
import { TELEMETRY_SDK_RESOURCE } from './constants';
import { ResourceLabels } from './types';

Expand Down
1 change: 0 additions & 1 deletion packages/opentelemetry-tracing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
},
"dependencies": {
"@opentelemetry/api": "^0.7.0",
"@opentelemetry/base": "^0.7.0",
"@opentelemetry/context-base": "^0.7.0",
"@opentelemetry/core": "^0.7.0",
"@opentelemetry/resources": "^0.7.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

import { SpanExporter } from './SpanExporter';
import { ReadableSpan } from './ReadableSpan';
import { ExportResult } from '@opentelemetry/base';
import { hrTimeToMicroseconds } from '@opentelemetry/core';
import { ExportResult, hrTimeToMicroseconds } from '@opentelemetry/core';

/**
* This is implementation of {@link SpanExporter} that prints spans to the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import { SpanExporter } from './SpanExporter';
import { ReadableSpan } from './ReadableSpan';
import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';

/**
* This class can be used for testing purposes. It stores the exported spans
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-tracing/src/export/SpanExporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { ExportResult } from '@opentelemetry/base';
import { ExportResult } from '@opentelemetry/core';
import { ReadableSpan } from './ReadableSpan';

/**
Expand Down

0 comments on commit 659b65b

Please sign in to comment.