-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logs SDK #3549
Merged
Merged
Logs SDK #3549
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
0a00912
feat(sdk-logs): sdk-logs init
fuaiyi 0a8910d
feat(sdk-logs): sdk-logs init
fuaiyi f25e7cf
feat(sdk-logs): sdk-logs init
fuaiyi b50422e
feat(sdk-logs): sdk-logs init
fuaiyi 5fb3f64
feat(sdk-logs): sdk-logs init
fuaiyi 76e66c1
feat(sdk-logs): sdk-logs init
fuaiyi 2214a51
feat(sdk-logs): sdk-logs init
fuaiyi b5a51b4
fix compile errors
martinkuba f1f34a8
Merge remote-tracking branch 'upstream/main' into logs-sdk
fuaiyi 8f8d25e
feat(sdk-logs): sdk-logs init
fuaiyi 999f971
feat(sdk-logs): sdk-logs init
fuaiyi 097d15d
feat(sdk-logs): sdk-logs init
fuaiyi 1e1263b
feat(sdk-logs): sdk-logs init
fuaiyi 66090b0
feat(sdk-logs): sdk-logs init
fuaiyi f045cf6
feat(sdk-logs): sdk-logs init
fuaiyi 8196379
feat(sdk-logs): sdk-logs init
fuaiyi af2ae70
feat(sdk-logs): sdk-logs init
fuaiyi 4a54b6f
Merge remote-tracking branch 'upstream/main' into logs-sdk
fuaiyi 681d937
feat(sdk-logs): sdk-logs init
fuaiyi b06e7f3
feat(sdk-logs): sdk-logs init
fuaiyi 6448b43
feat(sdk-logs): sdk-logs init
fuaiyi 03ff511
feat(sdk-logs): add browser test config
fuaiyi a29f149
feat: add test-utils compatible assert.rejects
fuaiyi 7803d66
feat(sdk-logs): fix writing errors in README
fuaiyi 1a9a89e
Merge remote-tracking branch 'upstream/main' into logs-sdk
fuaiyi bb051ee
feat(sdk-logs): update version to 0.36.1
fuaiyi 8bcb18d
feat(sdk-logs): add examples
fuaiyi 413025f
feat(sdk-logs): fix LogRecord default timestamp to Date.now()
fuaiyi 314ff95
feat(sdk-logs): logRecord support rewrite time/body/severityNumber/ne…
fuaiyi 8d476d2
feat(sdk-logs): add logs processor environments
fuaiyi e579b13
feat(sdk-logs): modify export style
fuaiyi ab3b861
feat(sdk-logs): update version to 0.36.1
fuaiyi 2501941
feat(sdk-logs): remove exporter factory
fuaiyi c0c1320
feat(sdk-logs): update CHANGELOG
fuaiyi 14b1a55
feat(sdk-logs): change the processing of schemeUrl
fuaiyi e8ced53
feat(sdk-logs): split LoggerProviderConfig and LoggerConfig
fuaiyi 8363356
feat(sdk-logs): getLogger with default name when name is invalid
fuaiyi b7e399e
feat(sdk-logs): improve the shutdown logic of LoggerProvider
fuaiyi b43efff
feat(sdk-logs): improve the shutdown logic of LoggerProvider
fuaiyi 74fc360
Merge remote-tracking branch 'upstream/main' into logs-sdk
fuaiyi f423693
feat(sdk-logs): make log record read-only after it has been emitted
fuaiyi 4cca19f
feat(sdk-logs): logger option support includeTraceContext & LogRecord…
fuaiyi 4cb0337
feat(sdk-logs): update version
fuaiyi dcc1c6a
feat(sdk-logs): update version
fuaiyi 0c3e7b3
feat(sdk-logs): update logs example with typescript
fuaiyi 6d0cc64
feat(sdk-logs): update peerDependencies
fuaiyi e01b734
feat(sdk-logs): peer-api-check support @opentelemetry/api-logs
fuaiyi d8d8a95
feat(sdk-logs): update peerDependencies
fuaiyi fc2e666
Merge branch 'main' into logs-sdk
dyladan 0c1c95a
Merge branch 'main' into logs-sdk
dyladan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the example is made to be typescript, it can be added to the lerna project and built with other examples to ensure it stays up to date.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Previously, I referred to other example codes that were implemented in JavaScript. I agree with your opinion, and I have modified them to be implemented in TypeScript. 0c3e7b3