chore: moving plugin from api to core (#1715)
This commit is contained in:
		
							parent
							
								
									86cbd6798f
								
							
						
					
					
						commit
						91612c4d5e
					
				| 
						 | 
				
			
			@ -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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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> {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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. */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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> {
 | 
			
		||||
| 
						 | 
				
			
			@ -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';
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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';
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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,
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue