Skip to content

Commit 43cdfed

Browse files
obecnydyladan
andcommitted
Plugins refactoring - new instrumentation package for plugins (open-telemetry#1540)
* feat: add a new plugin base decoupled from the sdk * chore: web and node version that supports patching more files * chore: updating readme * chore: lint * chore: missing noop logger * chore: linting * chore: updating readme with info about many modules * chore: supporting calling enable and disable multiple times for node plugins * chore: simplifying readme example * chore: reviews * chore: moving interface Instrumentation to package instrumentation * chore: adding function for safe executing in plugins * chore: fixing typo Co-authored-by: Daniel Dyla <[email protected]>
1 parent d97f774 commit 43cdfed

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

api/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export * from './trace/Event';
3737
export * from './trace/instrumentation/Plugin';
3838
export * from './trace/link_context';
3939
export * from './trace/link';
40+
export * from './trace/NoopLogger';
4041
export * from './trace/NoopSpan';
4142
export * from './trace/NoopTracer';
4243
export * from './trace/NoopTracerProvider';

api/src/trace/NoopLogger.ts

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright The OpenTelemetry Authors
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
import { Logger } from '../common/Logger';
18+
19+
/** No-op implementation of Logger */
20+
export class NoopLogger implements Logger {
21+
// By default does nothing
22+
debug(message: string, ...args: unknown[]) {}
23+
24+
// By default does nothing
25+
error(message: string, ...args: unknown[]) {}
26+
27+
// By default does nothing
28+
warn(message: string, ...args: unknown[]) {}
29+
30+
// By default does nothing
31+
info(message: string, ...args: unknown[]) {}
32+
}

0 commit comments

Comments
 (0)