-
Notifications
You must be signed in to change notification settings - Fork 851
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * fix compile errors * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): sdk-logs init * feat(sdk-logs): add browser test config * feat: add test-utils compatible assert.rejects * feat(sdk-logs): fix writing errors in README * feat(sdk-logs): update version to 0.36.1 * feat(sdk-logs): add examples * feat(sdk-logs): fix LogRecord default timestamp to Date.now() * feat(sdk-logs): logRecord support rewrite time/body/severityNumber/newSeverityText * feat(sdk-logs): add logs processor environments * feat(sdk-logs): modify export style * feat(sdk-logs): update version to 0.36.1 * feat(sdk-logs): remove exporter factory * feat(sdk-logs): update CHANGELOG * feat(sdk-logs): change the processing of schemeUrl * feat(sdk-logs): split LoggerProviderConfig and LoggerConfig * feat(sdk-logs): getLogger with default name when name is invalid * feat(sdk-logs): improve the shutdown logic of LoggerProvider * feat(sdk-logs): improve the shutdown logic of LoggerProvider * feat(sdk-logs): make log record read-only after it has been emitted * feat(sdk-logs): logger option support includeTraceContext & LogRecordProcessor onEmit suport context * feat(sdk-logs): update version * feat(sdk-logs): update version * feat(sdk-logs): update logs example with typescript * feat(sdk-logs): update peerDependencies * feat(sdk-logs): peer-api-check support @opentelemetry/api-logs * feat(sdk-logs): update peerDependencies --------- Co-authored-by: Martin Kuba <[email protected]> Co-authored-by: Daniel Dyla <[email protected]>
- Loading branch information
1 parent
26dfc70
commit a31b38a
Showing
61 changed files
with
3,972 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
## Installation | ||
|
||
```sh | ||
# from this directory | ||
npm install | ||
``` | ||
|
||
## Run the Application | ||
|
||
LogRecord | ||
|
||
```sh | ||
npm start | ||
``` | ||
|
||
## Useful links | ||
|
||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/> | ||
- For more information on OpenTelemetry logs, visit: <https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/sdk-logs> | ||
|
||
## LICENSE | ||
|
||
Apache License 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* 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 { DiagConsoleLogger, DiagLogLevel, diag } from '@opentelemetry/api'; | ||
import { logs, SeverityNumber } from '@opentelemetry/api-logs'; | ||
import { | ||
LoggerProvider, | ||
ConsoleLogRecordExporter, | ||
SimpleLogRecordProcessor, | ||
} from '@opentelemetry/sdk-logs'; | ||
|
||
// Optional and only needed to see the internal diagnostic logging (during development) | ||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG); | ||
|
||
const loggerProvider = new LoggerProvider(); | ||
loggerProvider.addLogRecordProcessor( | ||
new SimpleLogRecordProcessor(new ConsoleLogRecordExporter()) | ||
); | ||
|
||
logs.setGlobalLoggerProvider(loggerProvider); | ||
|
||
const logger = logs.getLogger('example', '1.0.0'); | ||
|
||
// emit a log record | ||
logger.emit({ | ||
severityNumber: SeverityNumber.INFO, | ||
severityText: 'INFO', | ||
body: 'this is a log record body', | ||
attributes: { 'log.type': 'custom' }, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "logs-example", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"start": "ts-node index.ts" | ||
}, | ||
"dependencies": { | ||
"@opentelemetry/api": "^1.4.1", | ||
"@opentelemetry/api-logs": "^0.37.0", | ||
"@opentelemetry/sdk-logs": "^0.37.0" | ||
}, | ||
"devDependencies": { | ||
"ts-node": "^10.9.1", | ||
"@types/node": "18.6.5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"extends": "../../../tsconfig.base.json", | ||
"compilerOptions": { | ||
"outDir": "build", | ||
"rootDir": "." | ||
}, | ||
"include": ["./index.ts"], | ||
"references": [ | ||
{ | ||
"path": "../../../api" | ||
}, | ||
{ | ||
"path": "../../../experimental/packages/api-logs" | ||
}, | ||
{ | ||
"path": "../../../experimental/packages/sdk-logs" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
env: { | ||
mocha: true, | ||
node: true, | ||
}, | ||
...require('../../../eslint.config.js'), | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/bin | ||
/coverage | ||
/doc | ||
/test |
Oops, something went wrong.