1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- /*
- * Copyright The 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 { ProxyTracer } from './ProxyTracer';
- import { NoopTracerProvider } from './NoopTracerProvider';
- const NOOP_TRACER_PROVIDER = new NoopTracerProvider();
- /**
- * Tracer provider which provides {@link ProxyTracer}s.
- *
- * Before a delegate is set, tracers provided are NoOp.
- * When a delegate is set, traces are provided from the delegate.
- * When a delegate is set after tracers have already been provided,
- * all tracers already provided will use the provided delegate implementation.
- */
- export class ProxyTracerProvider {
- /**
- * Get a {@link ProxyTracer}
- */
- getTracer(name, version, options) {
- var _a;
- return ((_a = this.getDelegateTracer(name, version, options)) !== null && _a !== void 0 ? _a : new ProxyTracer(this, name, version, options));
- }
- getDelegate() {
- var _a;
- return (_a = this._delegate) !== null && _a !== void 0 ? _a : NOOP_TRACER_PROVIDER;
- }
- /**
- * Set the delegate tracer provider
- */
- setDelegate(delegate) {
- this._delegate = delegate;
- }
- getDelegateTracer(name, version, options) {
- var _a;
- return (_a = this._delegate) === null || _a === void 0 ? void 0 : _a.getTracer(name, version, options);
- }
- }
- //# sourceMappingURL=ProxyTracerProvider.js.map
|