Skip to content

Commit

Permalink
chore: moving plugin from api to core (#1715)
Browse files Browse the repository at this point in the history
  • Loading branch information
obecny authored Dec 8, 2020
1 parent 86cbd67 commit 91612c4
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 32 deletions.
1 change: 0 additions & 1 deletion packages/opentelemetry-api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export * from './metrics/Observation';
export * from './metrics/ObserverResult';
export * from './trace/attributes';
export * from './trace/Event';
export * from './trace/instrumentation/Plugin';
export * from './trace/link_context';
export * from './trace/link';
export * from './trace/NoopLogger';
Expand Down
1 change: 1 addition & 0 deletions packages/opentelemetry-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export * from './correlation-context/correlation-context';
export * from './correlation-context/propagation/HttpCorrelationContext';
export * from './platform';
export * from './trace/NoRecordingSpan';
export * from './trace/Plugin';
export * from './trace/sampler/AlwaysOffSampler';
export * from './trace/sampler/AlwaysOnSampler';
export * from './trace/sampler/ParentBasedSampler';
Expand Down
10 changes: 2 additions & 8 deletions packages/opentelemetry-core/src/platform/BaseAbstractPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@
* limitations under the License.
*/

import {
Tracer,
Plugin,
Logger,
PluginConfig,
TracerProvider,
PluginInternalFiles,
} from '@opentelemetry/api';
import { Tracer, Logger, TracerProvider } from '@opentelemetry/api';
import { Plugin, PluginConfig, PluginInternalFiles } from '../trace/Plugin';

/** This class represent the base to patch plugin. */
export abstract class BaseAbstractPlugin<T> implements Plugin<T> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
* limitations under the License.
*/

import {
Logger,
Plugin,
PluginConfig,
TracerProvider,
} from '@opentelemetry/api';
import { Logger, TracerProvider } from '@opentelemetry/api';
import { Plugin, PluginConfig } from '../../trace/Plugin';
import { BaseAbstractPlugin } from '../BaseAbstractPlugin';

/** This class represent the base to patch plugin. */
Expand Down
5 changes: 2 additions & 3 deletions packages/opentelemetry-core/src/platform/node/BasePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,13 @@
* limitations under the License.
*/

import { Logger, TracerProvider } from '@opentelemetry/api';
import {
Plugin,
Logger,
PluginConfig,
PluginInternalFiles,
PluginInternalFilesVersion,
TracerProvider,
} from '@opentelemetry/api';
} from '../../trace/Plugin';
import * as semver from 'semver';
import * as path from 'path';
import { BaseAbstractPlugin } from '../BaseAbstractPlugin';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
* limitations under the License.
*/

import { Logger } from '../../common/Logger';
import { TracerProvider } from '../tracer_provider';
import { Logger, TracerProvider } from '@opentelemetry/api';

/** Interface Plugin to apply patch. */
export interface Plugin<T = any> {
Expand Down
8 changes: 6 additions & 2 deletions packages/opentelemetry-grpc-utils/test/grpcUtils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ import {
NoopTracerProvider,
SpanKind,
propagation,
PluginConfig,
} from '@opentelemetry/api';
import { NoopLogger, HttpTraceContext, BasePlugin } from '@opentelemetry/core';
import {
NoopLogger,
HttpTraceContext,
BasePlugin,
PluginConfig,
} from '@opentelemetry/core';
import { NodeTracerProvider } from '@opentelemetry/node';
import { AsyncHooksContextManager } from '@opentelemetry/context-async-hooks';
import { ContextManager } from '@opentelemetry/context-base';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,8 @@
* limitations under the License.
*/

import {
Logger,
Plugin,
PluginConfig,
TracerProvider,
} from '@opentelemetry/api';
import { Logger, TracerProvider } from '@opentelemetry/api';
import { Plugin, PluginConfig } from '@opentelemetry/core';
import * as hook from 'require-in-the-middle';
import * as utils from './utils';

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-fetch/src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const OBSERVER_WAIT_TIME_MS = 300;
/**
* FetchPlugin Config
*/
export interface FetchPluginConfig extends api.PluginConfig {
export interface FetchPluginConfig extends core.PluginConfig {
// the number of timing resources is limited, after the limit
// (chrome 250, safari 150) the information is not collected anymore
// the only way to prevent that is to regularly clean the resources
Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-grpc-js/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import type * as grpcJs from '@grpc/grpc-js';
import type { EventEmitter } from 'events';
import type { CALL_SPAN_ENDED } from './utils';
import { PluginConfig } from '@opentelemetry/api';
import { PluginConfig } from '@opentelemetry/core';

export type IgnoreMatcher = string | RegExp | ((str: string) => boolean);

Expand Down
2 changes: 1 addition & 1 deletion packages/opentelemetry-plugin-grpc/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import * as grpcModule from 'grpc';
import * as events from 'events';
import { PluginConfig } from '@opentelemetry/api';
import { PluginConfig } from '@opentelemetry/core';

export type grpc = typeof grpcModule;

Expand Down
3 changes: 2 additions & 1 deletion packages/opentelemetry-plugin-http/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { PluginConfig, Span } from '@opentelemetry/api';
import { Span } from '@opentelemetry/api';
import { PluginConfig } from '@opentelemetry/core';
import type * as http from 'http';
import {
ClientRequest,
Expand Down

0 comments on commit 91612c4

Please sign in to comment.