Merge remote-tracking branch 'origin/main' into res-prototype-v2
This commit is contained in:
commit
d17b2cdf24
|
|
@ -4,20 +4,37 @@ on:
|
|||
push:
|
||||
branches: [ main ]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
benchmark-tests:
|
||||
permissions:
|
||||
contents: write # required for pushing benchmark results to gh-pages
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
node_version:
|
||||
- "22"
|
||||
runs-on: self-hosted
|
||||
runs-on: oracle-bare-metal-64cpu-512gb-x86-64
|
||||
container:
|
||||
image: ubuntu:24.04
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
# Apt packages:
|
||||
# - git: Needed for 'npm run submodule'
|
||||
- name: Setup container environment
|
||||
run: |
|
||||
apt-get update && apt-get install --fix-missing -y git
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# Avoid "detected dubious ownership in repository" error when running
|
||||
# `npm run submodule`.
|
||||
- run: git config --global --add safe.directory $GITHUB_WORKSPACE
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -10,13 +10,15 @@ on:
|
|||
branches:
|
||||
- main
|
||||
- next
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
if: ${{ !contains(github.event.pull_request.labels.*.name, 'dependencies') && !contains(github.event.pull_request.labels.*.name, 'Skip Changelog')}}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- name: Check for CHANGELOG changes
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -3,8 +3,14 @@ on:
|
|||
schedule:
|
||||
- cron: '30 6 * * 1'
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
permissions:
|
||||
issues: write # required for closing stale issues
|
||||
pull-requests: write # required for closing stale PRs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/stale@v9
|
||||
|
|
|
|||
|
|
@ -6,13 +6,18 @@ on:
|
|||
branches: [ main ]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
permissions:
|
||||
security-events: write
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ on:
|
|||
- all # all release packages, including API, excluding semconv
|
||||
- semconv # only semantic convention package
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
create-or-update-release-pr:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -27,7 +30,7 @@ jobs:
|
|||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.OPENTELEMETRYBOT_GITHUB_TOKEN }}
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
repository: opentelemetrybot/opentelemetry-js
|
||||
ref: main
|
||||
|
|
|
|||
|
|
@ -4,12 +4,17 @@ on:
|
|||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
permissions:
|
||||
contents: write # required for deploying documentation to gh-pages
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ on:
|
|||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
e2e-tests:
|
||||
strategy:
|
||||
|
|
@ -16,10 +19,10 @@ jobs:
|
|||
- "20.6.0"
|
||||
- "20"
|
||||
- "22"
|
||||
- "23"
|
||||
- "24"
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -41,7 +44,7 @@ jobs:
|
|||
if: ${{
|
||||
matrix.node_version == '20' ||
|
||||
matrix.node_version == '22' ||
|
||||
matrix.node_version == '23'
|
||||
matrix.node_version == '24'
|
||||
}}
|
||||
|
||||
- name: Bootstrap
|
||||
|
|
@ -70,4 +73,4 @@ jobs:
|
|||
working-directory: e2e-tests
|
||||
- name: verify exported telemetry
|
||||
run: npm run verify
|
||||
working-directory: e2e-tests
|
||||
working-directory: e2e-tests
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ jobs:
|
|||
fossa:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- uses: fossas/fossa-action@93a52ecf7c3ac7eb40f5de77fd69b1a19524de94 # v1.5.0
|
||||
- uses: fossas/fossa-action@3ebcea1862c6ffbd5cf1b4d0bd6b3fe7bd6f2cac # v1.7.0
|
||||
with:
|
||||
api-key: ${{secrets.FOSSA_API_KEY}}
|
||||
team: OpenTelemetry
|
||||
|
|
|
|||
|
|
@ -1,12 +0,0 @@
|
|||
on:
|
||||
pull_request_target:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
label-release:
|
||||
if: ${{ startsWith(github.event.pull_request.title, 'release:') }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: echo this is a release PR
|
||||
- run: gh pr edit ${{ github.event.pull_request.number }} --add-label release
|
||||
|
|
@ -7,13 +7,16 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
|
|
|
|||
|
|
@ -19,11 +19,11 @@ jobs:
|
|||
# Needed for GitHub OIDC token if publish_results is true
|
||||
id-token: write
|
||||
steps:
|
||||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- uses: ossf/scorecard-action@f49aabe0b5af0936a0987cfb85d86b75731b0186 # v2.4.1
|
||||
- uses: ossf/scorecard-action@05b42c624433fc40578a4040d5cf5e36ddca8cde # v2.4.2
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
|
|
@ -42,6 +42,6 @@ jobs:
|
|||
# Upload the results to GitHub's code scanning dashboard (optional).
|
||||
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
|
||||
- name: "Upload to code-scanning"
|
||||
uses: github/codeql-action/upload-sarif@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
|
||||
uses: github/codeql-action/upload-sarif@3c3833e0f8c1c83d449a7478aa59c036a9165498 # v3.29.11
|
||||
with:
|
||||
sarif_file: results.sarif
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
peer-api-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -14,7 +17,7 @@ jobs:
|
|||
image: node:22
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- name: Install lerna
|
||||
run: npm install -g lerna@6.6.2
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ name: Publish packages to NPM
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release-to-npm:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
@ -11,7 +14,7 @@ jobs:
|
|||
id-token: write
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ jobs:
|
|||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -65,7 +65,7 @@ jobs:
|
|||
contents: write
|
||||
steps:
|
||||
- name: Download artifact from generate-sboms
|
||||
uses: actions/download-artifact@v4
|
||||
uses: actions/download-artifact@v5
|
||||
with:
|
||||
name: SBOM.zip
|
||||
- name: Upload release asset
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ on:
|
|||
pull_request_target:
|
||||
types: [closed]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
PR_NUM: ${{ github.event.pull_request.number }}
|
||||
SURVEY_URL: https://docs.google.com/forms/d/e/1FAIpQLSf2FfCsW-DimeWzdQgfl0KDzT2UEAqu69_f7F2BVPSxVae1cQ/viewform?entry.1540511742=open-telemetry/opentelemetry-js
|
||||
|
|
@ -17,7 +20,7 @@ jobs:
|
|||
pull-requests: write
|
||||
if: github.event.pull_request.merged == true
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v5
|
||||
- name: Check if user is a member of the org
|
||||
id: check-membership
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -6,6 +6,9 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
node-tests:
|
||||
strategy:
|
||||
|
|
@ -17,14 +20,13 @@ jobs:
|
|||
- "20.6.0"
|
||||
- "20"
|
||||
- "22"
|
||||
- "23"
|
||||
- "24"
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -46,7 +48,6 @@ jobs:
|
|||
if: ${{
|
||||
matrix.node_version == '20' ||
|
||||
matrix.node_version == '22' ||
|
||||
matrix.node_version == '23' ||
|
||||
matrix.node_version == '24'
|
||||
}}
|
||||
|
||||
|
|
@ -57,13 +58,13 @@ jobs:
|
|||
run: npm run compile
|
||||
|
||||
- run: npm test
|
||||
if: ${{ matrix.node_version != '23' && matrix.node_version != '24' }}
|
||||
# Node.js >= 23 type stripping conflicts with mocha usage of ts-node.
|
||||
if: ${{ matrix.node_version != '22' && matrix.node_version != '24' }}
|
||||
# Node.js type stripping conflicts with mocha usage of ts-node.
|
||||
# See https://github.com/open-telemetry/opentelemetry-js/issues/5415
|
||||
- run: npm test
|
||||
env:
|
||||
NODE_OPTIONS: '--no-experimental-strip-types'
|
||||
if: ${{ matrix.node_version == '23' || matrix.node_version == '24' }}
|
||||
if: ${{ matrix.node_version == '22' || matrix.node_version == '24' }}
|
||||
|
||||
- name: Report Coverage
|
||||
uses: codecov/codecov-action@v5
|
||||
|
|
@ -77,7 +78,7 @@ jobs:
|
|||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -98,13 +99,15 @@ jobs:
|
|||
|
||||
- name: Unit tests
|
||||
run: npm run test
|
||||
env:
|
||||
NODE_OPTIONS: '--no-experimental-strip-types'
|
||||
browser-tests:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
@ -133,7 +136,7 @@ jobs:
|
|||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
cache: 'npm'
|
||||
|
|
|
|||
|
|
@ -7,12 +7,15 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
|
|
|
|||
|
|
@ -5,17 +5,23 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
For API changes, see the [API CHANGELOG](api/CHANGELOG.md).
|
||||
For experimental package changes, see the [experimental CHANGELOG](experimental/CHANGELOG.md).
|
||||
For semantic convention package changes, see the [semconv CHANGELOG](packages/semantic-conventions/CHANGELOG.md).
|
||||
For semantic convention package changes, see the [semconv CHANGELOG](semantic-conventions/CHANGELOG.md).
|
||||
For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2.x.md).
|
||||
|
||||
## Unreleased
|
||||
|
||||
* feat(instrumentation-http): Added support for redacting specific url query string values and url credentials in instrumentations [#5743](https://github.com/open-telemetry/opentelemetry-js/pull/5743) @rads-1996
|
||||
|
||||
### :boom: Breaking Changes
|
||||
|
||||
### :rocket: Features
|
||||
|
||||
* feat(opentelemetry-resources): add schema url [#5070](https://github.com/open-telemetry/opentelemetry-js/pull/5753) @c-ehrlich
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* fix(sdk-metrics): Remove invalid default value for `startTime` param to ExponentialHistogramAccumulation. This only impacted the closurescript compiler. [#5763](https://github.com/open-telemetry/opentelemetry-js/pull/5763) @trentm
|
||||
|
||||
### :books: Documentation
|
||||
|
||||
### :house: Internal
|
||||
|
|
@ -30,6 +36,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
|
|||
* fix(resource): do not trigger `Accessing resource attributes before async attributes settled` warning when detecting resources [#5546](https://github.com/open-telemetry/opentelemetry-js/pull/5546) @dyladan
|
||||
* verbose logging of detected resource removed
|
||||
* fix(resource): use dynamic import over require to improve ESM compliance [#5298](https://github.com/open-telemetry/opentelemetry-js/pull/5298) @xiaoxiangmoe
|
||||
* fix(core): `getNumberFromEnv` should return number | undefined [#5874](https://github.com/open-telemetry/opentelemetry-js/pull/5874) @shubham-vunet
|
||||
|
||||
### :books: Documentation
|
||||
|
||||
|
|
|
|||
54
README.md
54
README.md
|
|
@ -58,7 +58,7 @@ npm install --save @opentelemetry/sdk-node
|
|||
npm install --save @opentelemetry/auto-instrumentations-node
|
||||
```
|
||||
|
||||
**Note:** `auto-instrumentations-node` is a meta package from [opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node) that provides a simple way to initialize multiple Node.js instrumentations.
|
||||
**Note:** `auto-instrumentations-node` is a meta package from [opentelemetry-js-contrib](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/packages/auto-instrumentations-node) that provides a simple way to initialize multiple Node.js instrumentations.
|
||||
|
||||
### Set up Tracing
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ Previous versions of node *may* work, but they are not tested by OpenTelemetry a
|
|||
Rather than define versions of specific browsers / runtimes, OpenTelemetry sets the minimum supported version based on the
|
||||
underlying language features used.
|
||||
|
||||
The current minumum language feature support is set as [ECMAScript 2020](https://262.ecma-international.org/11.0/) that are available
|
||||
The current minumum language feature support is set as [ECMAScript 2022](https://262.ecma-international.org/13.0/) that are available
|
||||
in all modern browsers / runtimes.
|
||||
|
||||
This means that if you are targeting or your end-users are using a browser / runtime that does not support ES2022, you will need
|
||||
|
|
@ -225,9 +225,7 @@ instructions to build and make changes to this project, see the
|
|||
|
||||
We have a weekly SIG meeting! See the [community page](https://github.com/open-telemetry/community#javascript-sdk) for meeting details and notes.
|
||||
|
||||
### Community members
|
||||
|
||||
#### Maintainers ([@open-telemetry/javascript-maintainers](https://github.com/orgs/open-telemetry/teams/javascript-maintainers))
|
||||
### Maintainers
|
||||
|
||||
- [Amir Blum](https://github.com/blumamir), Odigos
|
||||
- [Chengzhong Wu](https://github.com/legendecas), Bloomberg
|
||||
|
|
@ -236,9 +234,9 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t
|
|||
- [Marc Pichler](https://github.com/pichlermarc), Dynatrace
|
||||
- [Trent Mick](https://github.com/trentm), Elastic
|
||||
|
||||
*Find more about the maintainer role in the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).*
|
||||
For more information about the maintainer role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#maintainer).
|
||||
|
||||
#### Approvers ([@open-telemetry/javascript-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers))
|
||||
### Approvers
|
||||
|
||||
- [David Luna](https://github.com/david-luna), Elastic
|
||||
- [Hector Hernandez](https://github.com/hectorhdzg), Microsoft
|
||||
|
|
@ -249,17 +247,17 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t
|
|||
- [Purvi Kanal](https://github.com/pkanal), Honeycomb
|
||||
- [Svetlana Brennan](https://github.com/svetlanabrennan), New Relic
|
||||
|
||||
*Find more about the approver role in the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).*
|
||||
For more information about the approver role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#approver).
|
||||
|
||||
#### Triagers ([@open-telemetry/javascript-triagers](https://github.com/orgs/open-telemetry/teams/javascript-triagers))
|
||||
### Triagers
|
||||
|
||||
Members of this team have triager permissions for opentelemetry-js.git and opentelemetry-js-contrib.git.
|
||||
|
||||
- [Jackson Weber](https://github.com/JacksonWeber), Microsoft
|
||||
|
||||
*Find more about the triager role in the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).*
|
||||
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||
|
||||
#### Contrib Triagers ([@open-telemetry/javascript-contrib-triagers](https://github.com/orgs/open-telemetry/teams/javascript-contrib-triagers))
|
||||
### Contrib Triagers
|
||||
|
||||
Members of this team have triager permissions for opentelemetry-js-contrib.git.
|
||||
Typically, members of this are [component owners](https://github.com/open-telemetry/opentelemetry-js-contrib/blob/main/.github/component_owners.yml) of one or more packages in the contrib repo.
|
||||
|
|
@ -279,33 +277,33 @@ Typically, members of this are [component owners](https://github.com/open-teleme
|
|||
- [Motti](https://github.com/mottibec)
|
||||
- [Punya Biswal](https://github.com/punya), Google
|
||||
- [Siim Kallas](https://github.com/seemk), Splunk
|
||||
- [Trivikram Kamat](https://github.com/trivikr), AWS
|
||||
- [t2t2](https://github.com/t2t2), Splunk
|
||||
- [Trivikram Kamat](https://github.com/trivikr), AWS
|
||||
|
||||
*Find more about the triager role in the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).*
|
||||
For more information about the triager role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#triager).
|
||||
|
||||
#### Emeriti
|
||||
### Emeriti
|
||||
|
||||
- [Bartlomiej Obecny](https://github.com/obecny), LightStep, Maintainer
|
||||
- [Daniel Khan](https://github.com/dkhan), Dynatrace, Maintainer
|
||||
- [Mayur Kale](https://github.com/mayurkale22), Google, Maintainer
|
||||
- [Bartlomiej Obecny](https://github.com/obecny), Maintainer
|
||||
- [Brandon Gonzalez](https://github.com/bg451), Approver
|
||||
- [Daniel Khan](https://github.com/dkhan), Maintainer
|
||||
- [Gerhard Stöbich](https://github.com/Flarna), Approver
|
||||
- [Haddas Bronfman](https://github.com/haddasbronfman), Approver
|
||||
- [John Bley](https://github.com/johnbley), Approver
|
||||
- [Mark Wolff](https://github.com/markwolff), Approver
|
||||
- [Mayur Kale](https://github.com/mayurkale22), Maintainer
|
||||
- [Naseem K. Ullah](https://github.com/naseemkullah), Approver
|
||||
- [Olivier Albertini](https://github.com/OlivierAlbertini), Approver
|
||||
- [Rauno Viskus](https://github.com/rauno56), Maintainer
|
||||
- [Roch Devost](https://github.com/rochdev), Approver
|
||||
- [Valentin Marchaud](https://github.com/vmarchaud), Maintainer
|
||||
- [Brandon Gonzalez](https://github.com/bg451), LightStep, Approver
|
||||
- [Roch Devost](https://github.com/rochdev), DataDog, Approver
|
||||
- [John Bley](https://github.com/johnbley), Splunk, Approver
|
||||
- [Mark Wolff](https://github.com/markwolff), Microsoft, Approver
|
||||
- [Olivier Albertini](https://github.com/OlivierAlbertini), Ville de Montréal, Approver
|
||||
- [Gerhard Stöbich](https://github.com/Flarna), Dynatrace, Approver
|
||||
- [Haddas Bronfman](https://github.com/haddasbronfman), Cisco, Approver
|
||||
- [Naseem K. Ullah](https://github.com/naseemkullah), Transit, Approver
|
||||
|
||||
*Find more about the emeritus role in [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).*
|
||||
For more information about the emeritus role, see the [community repository](https://github.com/open-telemetry/community/blob/main/guides/contributor/membership.md#emeritus-maintainerapprovertriager).
|
||||
|
||||
#### Thanks to all the people who already contributed
|
||||
### Thanks to all of our contributors!
|
||||
|
||||
<a href="https://github.com/open-telemetry/opentelemetry-js/graphs/contributors">
|
||||
<img alt="Repo contributors" src="https://contributors-img.web.app/image?repo=open-telemetry/opentelemetry-js" />
|
||||
<img alt="Repo contributors" src="https://contrib.rocks/image?repo=open-telemetry/opentelemetry-js" />
|
||||
</a>
|
||||
|
||||
## Packages
|
||||
|
|
|
|||
|
|
@ -9,10 +9,13 @@ All notable changes to this project will be documented in this file.
|
|||
|
||||
### :rocket: (Enhancement)
|
||||
|
||||
* feat(api): improve isValidSpanId, isValidTraceId performance [#5714](https://github.com/open-telemetry/opentelemetry-js/pull/5714) @seemk
|
||||
* feat(diag): change types in `DiagComponentLogger` from `any` to `unknown`[#5478](https://github.com/open-telemetry/opentelemetry-js/pull/5478) @loganrosen
|
||||
|
||||
### :bug: (Bug Fix)
|
||||
|
||||
fix(api): prioritize `esnext` export condition as it is more specific [#5458](https://github.com/open-telemetry/opentelemetry-js/pull/5458)
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
||||
### :house: (Internal)
|
||||
|
|
|
|||
|
|
@ -14,14 +14,14 @@
|
|||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"module": "./build/esm/index.js",
|
||||
"esnext": "./build/esnext/index.js",
|
||||
"module": "./build/esm/index.js",
|
||||
"types": "./build/src/index.d.ts",
|
||||
"default": "./build/src/index.js"
|
||||
},
|
||||
"./experimental": {
|
||||
"module": "./build/esm/experimental/index.js",
|
||||
"esnext": "./build/esnext/experimental/index.js",
|
||||
"module": "./build/esm/experimental/index.js",
|
||||
"types": "./build/src/experimental/index.d.ts",
|
||||
"default": "./build/src/experimental/index.js"
|
||||
}
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
"repository": "open-telemetry/opentelemetry-js",
|
||||
"scripts": {
|
||||
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/api --include-dependencies",
|
||||
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"lint": "eslint . --ext .ts",
|
||||
|
|
@ -79,7 +79,6 @@
|
|||
"@types/webpack": "5.28.5",
|
||||
"@types/webpack-env": "1.16.3",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"dpdm": "3.13.1",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
|
|
@ -93,10 +92,10 @@
|
|||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"unionfs": "4.5.4",
|
||||
"webpack": "5.99.9"
|
||||
"webpack": "5.101.3"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/api",
|
||||
"sideEffects": false
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
|
||||
import { getGlobal } from '../internal/global-utils';
|
||||
import { ComponentLoggerOptions, DiagLogger, DiagLogFunction } from './types';
|
||||
import { ComponentLoggerOptions, DiagLogger } from './types';
|
||||
|
||||
/**
|
||||
* Component Logger which is meant to be used as part of any component which
|
||||
|
|
@ -65,6 +65,5 @@ function logProxy(
|
|||
return;
|
||||
}
|
||||
|
||||
args.unshift(namespace);
|
||||
return logger[funcName](...(args as Parameters<DiagLogFunction>));
|
||||
return logger[funcName](namespace, ...args);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
import { SugaredSpanOptions } from './SugaredOptions';
|
||||
import { context, Context, Span, SpanStatusCode, Tracer } from '../../';
|
||||
import {
|
||||
context as contextApi,
|
||||
Context,
|
||||
Span,
|
||||
SpanStatusCode,
|
||||
Tracer,
|
||||
} from '../../';
|
||||
|
||||
const defaultOnException = (e: Error, span: Span) => {
|
||||
span.recordException(e);
|
||||
|
|
@ -174,7 +180,7 @@ function massageParams<F extends (span: Span) => ReturnType<F>>(
|
|||
fn = arg3 as F;
|
||||
}
|
||||
opts = opts ?? {};
|
||||
ctx = ctx ?? context.active();
|
||||
ctx = ctx ?? contextApi.active();
|
||||
|
||||
return { opts, ctx, fn };
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
|
||||
// eslint-disable-next-line n/no-unsupported-features/es-builtins, no-undef
|
||||
export const _globalThis: typeof globalThis =
|
||||
typeof globalThis === 'object'
|
||||
? globalThis
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@
|
|||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins
|
||||
// eslint-disable-next-line n/no-unsupported-features/es-builtins
|
||||
export const _globalThis = typeof globalThis === 'object' ? globalThis : global;
|
||||
|
|
|
|||
|
|
@ -18,21 +18,43 @@ import { NonRecordingSpan } from './NonRecordingSpan';
|
|||
import { Span } from './span';
|
||||
import { SpanContext } from './span_context';
|
||||
|
||||
const VALID_TRACEID_REGEX = /^([0-9a-f]{32})$/i;
|
||||
const VALID_SPANID_REGEX = /^[0-9a-f]{16}$/i;
|
||||
// Valid characters (0-9, a-f, A-F) are marked as 1.
|
||||
const isHex = new Uint8Array([
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1,
|
||||
]);
|
||||
|
||||
function isValidHex(id: string, length: number): boolean {
|
||||
// As of 1.9.0 the id was allowed to be a non-string value,
|
||||
// even though it was not possible in the types.
|
||||
if (typeof id !== 'string' || id.length !== length) return false;
|
||||
|
||||
let r = 0;
|
||||
for (let i = 0; i < id.length; i += 4) {
|
||||
r +=
|
||||
(isHex[id.charCodeAt(i)] | 0) +
|
||||
(isHex[id.charCodeAt(i + 1)] | 0) +
|
||||
(isHex[id.charCodeAt(i + 2)] | 0) +
|
||||
(isHex[id.charCodeAt(i + 3)] | 0);
|
||||
}
|
||||
|
||||
return r === length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export function isValidTraceId(traceId: string): boolean {
|
||||
return VALID_TRACEID_REGEX.test(traceId) && traceId !== INVALID_TRACEID;
|
||||
return isValidHex(traceId, 32) && traceId !== INVALID_TRACEID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @since 1.0.0
|
||||
*/
|
||||
export function isValidSpanId(spanId: string): boolean {
|
||||
return VALID_SPANID_REGEX.test(spanId) && spanId !== INVALID_SPANID;
|
||||
return isValidHex(spanId, 16) && spanId !== INVALID_SPANID;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,6 +37,17 @@ describe('spancontext-utils', function () {
|
|||
assert.ok(!context.isSpanContextValid(spanContext));
|
||||
});
|
||||
|
||||
it('should return false when traceId is malformed', function () {
|
||||
// 0x4141 is not a hex character, but doing a bitwise AND with 0xFF
|
||||
// would yield a valid character 'A'.
|
||||
const spanContext = {
|
||||
traceId: 'd4cda95b652f4a1592b449d5929fda1\u4141',
|
||||
spanId: '6e0c63257de34c92',
|
||||
traceFlags: TraceFlags.NONE,
|
||||
};
|
||||
assert.ok(!context.isSpanContextValid(spanContext));
|
||||
});
|
||||
|
||||
it('should return false when spanId is invalid', function () {
|
||||
const spanContext = {
|
||||
traceId: 'd4cda95b652f4a1592b449d5929fda1b',
|
||||
|
|
|
|||
|
|
@ -85,6 +85,11 @@ describe('tree-shaking', function () {
|
|||
},
|
||||
});
|
||||
|
||||
if (compiler == null) {
|
||||
this.fail('Compiler was null');
|
||||
return;
|
||||
}
|
||||
|
||||
const fs = new Union();
|
||||
fs.use(mfs as any).use(realFs as unknown as IFS);
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ This section refers to `"dependencies"` and `"devDependencies"` entries in `pack
|
|||
**Example:** `^1.2.3` might inadvertently lead to version `1.2.6` which includes unintended breaking changes).
|
||||
|
||||
> [!NOTE]
|
||||
> As this approach might leave our project with outdated tooling, we adopt `renovate-bot`. This automated dependency update tool proactively opens pull requests upon the release of new patch/minor/major versions. The complete configuration for renovate-bot can be found in [renovate.json](../renovate.json) file.
|
||||
> As this approach might leave our project with outdated tooling, we adopt `renovate-bot`. This automated dependency update tool proactively opens pull requests upon the release of new patch/minor/major versions. The complete configuration for renovate-bot can be found in [renovate.json](../../renovate.json) file.
|
||||
|
||||
## @opentelemetry/* dependencies
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "@opentelemetry/e2e-test",
|
||||
"private": true,
|
||||
"description": "End-to-end tests for OpenTelemetry JS",
|
||||
"version": "0.1.0",
|
||||
"version": "0.2.0",
|
||||
"scripts": {
|
||||
"test:e2e": "npm run stop-collector; npm run run-collector && npm run export-telemetry && npm run verify || npm run stop-collector",
|
||||
"lint": "eslint . --ext .mjs",
|
||||
|
|
@ -15,13 +15,13 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/api-logs": "0.202.0",
|
||||
"@opentelemetry/exporter-logs-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/sdk-logs": "0.202.0",
|
||||
"@opentelemetry/api-logs": "0.203.0",
|
||||
"@opentelemetry/exporter-logs-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/sdk-logs": "0.203.0",
|
||||
"@opentelemetry/sdk-metrics": "2.0.1",
|
||||
"@opentelemetry/sdk-node": "0.202.0",
|
||||
"@opentelemetry/sdk-node": "0.203.0",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module.exports = {
|
|||
plugins: [
|
||||
"@typescript-eslint",
|
||||
"header",
|
||||
"node",
|
||||
"n",
|
||||
"prettier"
|
||||
],
|
||||
extends: ["eslint:recommended", "plugin:prettier/recommended"],
|
||||
|
|
@ -19,7 +19,7 @@ module.exports = {
|
|||
"prefer-rest-params": "off",
|
||||
"no-console": "error",
|
||||
"no-shadow": "off",
|
||||
"node/no-deprecated-api": ["warn"],
|
||||
"n/no-deprecated-api": ["warn"],
|
||||
"header/header": ["error", "block", [{
|
||||
pattern: / \* Copyright The OpenTelemetry Authors[\r\n]+ \*[\r\n]+ \* Licensed under the Apache License, Version 2\.0 \(the \"License\"\);[\r\n]+ \* you may not use this file except in compliance with the License\.[\r\n]+ \* You may obtain a copy of the License at[\r\n]+ \*[\r\n]+ \* https:\/\/www\.apache\.org\/licenses\/LICENSE-2\.0[\r\n]+ \*[\r\n]+ \* Unless required by applicable law or agreed to in writing, software[\r\n]+ \* distributed under the License is distributed on an \"AS IS\" BASIS,[\r\n]+ \* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied\.[\r\n]+ \* See the License for the specific language governing permissions and[\r\n]+ \* limitations under the License\./gm,
|
||||
template:
|
||||
|
|
|
|||
|
|
@ -24,11 +24,12 @@
|
|||
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/exporter-jaeger": "0.25.0",
|
||||
"@opentelemetry/resources": "0.25.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.22.0",
|
||||
"@opentelemetry/sdk-trace-base": "0.25.0"
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/context-async-hooks": "^2.0.1",
|
||||
"@opentelemetry/exporter-jaeger": "^2.0.1",
|
||||
"@opentelemetry/resources": "^2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "^2.0.1",
|
||||
"@opentelemetry/semantic-conventions": "^1.36.0"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/basic-tracer-node"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "esm-http-ts",
|
||||
"private": true,
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Example of HTTP integration with OpenTelemetry using ESM and TypeScript",
|
||||
"main": "build/index.js",
|
||||
"type": "module",
|
||||
|
|
@ -32,9 +32,9 @@
|
|||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation-http": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/instrumentation-http": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-node": "2.0.1",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "http-example",
|
||||
"private": true,
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Example of HTTP integration with OpenTelemetry",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
@ -32,8 +32,8 @@
|
|||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/exporter-jaeger": "2.0.1",
|
||||
"@opentelemetry/exporter-zipkin": "2.0.1",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation-http": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/instrumentation-http": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-node": "2.0.1",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "https-example",
|
||||
"private": true,
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Example of HTTPs integration with OpenTelemetry",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
|
@ -36,8 +36,8 @@
|
|||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/exporter-jaeger": "2.0.1",
|
||||
"@opentelemetry/exporter-zipkin": "2.0.1",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation-http": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/instrumentation-http": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-node": "2.0.1",
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIDozCCAougAwIBAgIUHNXizGTXdVq7RZXVstG5RnrsuTUwDQYJKoZIhvcNAQEL
|
||||
MIIDozCCAougAwIBAgIUSgl/41WVVQuOs+hRNN6Bj2FD498wDQYJKoZIhvcNAQEL
|
||||
BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs
|
||||
ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE
|
||||
AwwCY2EwHhcNMjUwNjExMDMzMDA4WhcNMzUwNjA5MDMzMDA4WjBhMQswCQYDVQQG
|
||||
AwwCY2EwHhcNMjUwNjExMTgyMDIxWhcNMzUwNjA5MTgyMDIxWjBhMQswCQYDVQQG
|
||||
EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w
|
||||
CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCASIwDQYJ
|
||||
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKvmpOQ/3/wqwe4Ltp+2QXd6KWAIoeku
|
||||
wvHO0VwtE40/22nXY5NMt+zPVBTjApe4d4Ht+QiDECHr6uhhCMooJCfTNtkbrTI2
|
||||
ESQWzLq6TuUAWxySurgVUXd6k0PzxMspgv7YAOrdVzkaLT7z+QlnRe7yWaJU80kW
|
||||
hGQA048xlI/BoXIxe1FG5YOE5mOY+VCLDFS83qphV1wcQZH4KtMdgla7tlx1QObJ
|
||||
NbQEgi3kUL130idpkGeWOVIJz9IujRS1cuxOOrGWrl9Y58uhIv4Fm0jrV69TexOB
|
||||
XtPYrGjX3AbPUvpJuK/5JUmg9B3/R/GElrR4e/4OObA2Oyt0NTmJKQMCAwEAAaNT
|
||||
MFEwHQYDVR0OBBYEFOyZ2iR0gyD2vnoaC4u3Uv7snlpcMB8GA1UdIwQYMBaAFOyZ
|
||||
2iR0gyD2vnoaC4u3Uv7snlpcMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL
|
||||
BQADggEBAAg8Y5xKxlC2YS/2u97RMhcN/9OjzRWChApB5QGsP3vzlwwq1romyhGr
|
||||
8o5Ud77dB5msReWPyNPqRsA4yiqPjeTJKvpsZGEdkMrAHrzhMb5dSlMb0h5EHnvO
|
||||
81Kq0IEBcZ2FsCpNzhk8VaJCpv/KCUjBAnoqfOkwRJ2lBgzGV61pJZvdmM+TXBOc
|
||||
nWWIWN5AndZp8KXHZl6AqoLi0hayKGkQlk+Olij2+3N7iZXf6ALBHhd94LvW5NqN
|
||||
8HVrc6pph2DgRo5e0ng04k3Gf5fwxPJ8L8KhU0LBOfFbEN3MALECycBEiFI5JE0Y
|
||||
rUY46oF/Vcsyw1okuVTm5UcBxlOj+ho=
|
||||
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAN3ZU0HEDBWzObHgZhc2xFmqpkj7JfOT
|
||||
QHbyIhKk7CeuolPOjI77QSSbWvNHADb3OuO/eZG6f8RyFfSpGhL9tfv4mYfhS1Kz
|
||||
9SRw7hTTjObdso8JJ8BPIxBpRuE2WdlxjOkOwK4R5tvb1rvUdlA+BMMRMwSqNODx
|
||||
FmGRwkeOy32hha2fvI6wzKJGNiRzRPuYw2f2L05u7Igzc2j6yL0xtQzGGEPWdLnf
|
||||
yN8WDOgpXVdJAy9B0PCgcUHnk8OFkW2aBRbSjbnn2swK75MMfVUmTU2hg8Rh1vnX
|
||||
ey3fiQNeWxhj7MQJVjfZnmBSI7V+VudFuBOacGO48sVSi/QjjmZsYl0CAwEAAaNT
|
||||
MFEwHQYDVR0OBBYEFEVN1IHT0YRWLH1Cs0Fc58Ta9b3UMB8GA1UdIwQYMBaAFEVN
|
||||
1IHT0YRWLH1Cs0Fc58Ta9b3UMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL
|
||||
BQADggEBANuBQvKMRsS8e1TaeY9g7KXUqkXMV5IHADioCddxDSxs6TGXCbFNsWG7
|
||||
QO6QhbduQLGLggArFyklYn8Mku2nX/jZhDh321kKcUcWyzmkqbRE2Msiyys4p+JK
|
||||
wQtfdAAqsRPNA52EFIsyO9xpDwUoUfKw31i/8h4GlRSlLkyuedYFVe6t/X7XvytL
|
||||
KHYYMWO1ECOi4X1p7RHhzY1fh/KDAA/eZPKuPcw+qtyBFdKBlQ8QKIbeUVCOWJMa
|
||||
qrU9mfC21WG+3kuP06D+G4q2BfghdoVEeyVQVHViX4qRZs7cO2LIcNqjSg7B1VeK
|
||||
DqCaBvauRn24gsVPxJ0v3+flKZdcA+4=
|
||||
-----END CERTIFICATE-----
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
-----BEGIN PRIVATE KEY-----
|
||||
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCr5qTkP9/8KsHu
|
||||
C7aftkF3eilgCKHpLsLxztFcLRONP9tp12OTTLfsz1QU4wKXuHeB7fkIgxAh6+ro
|
||||
YQjKKCQn0zbZG60yNhEkFsy6uk7lAFsckrq4FVF3epND88TLKYL+2ADq3Vc5Gi0+
|
||||
8/kJZ0Xu8lmiVPNJFoRkANOPMZSPwaFyMXtRRuWDhOZjmPlQiwxUvN6qYVdcHEGR
|
||||
+CrTHYJWu7ZcdUDmyTW0BIIt5FC9d9InaZBnljlSCc/SLo0UtXLsTjqxlq5fWOfL
|
||||
oSL+BZtI61evU3sTgV7T2Kxo19wGz1L6Sbiv+SVJoPQd/0fxhJa0eHv+DjmwNjsr
|
||||
dDU5iSkDAgMBAAECggEAE1op4hBW1PqzTms/KgfIovy7v7X5FFlRVQulgi0I8HPp
|
||||
7aZz7VdLtXs5yggseIwp2BTEXnLy0/7NOVADP075kwoyOIrnGqn/kAKJFdR3oUxC
|
||||
9ZqHLsYnn73K6nF9DComNy52G/rDIQiTY2zv8mEP/HCIKsBJi0bfrKpzJsG8KdrB
|
||||
VXc1ORst/clwfsMzqL3iLkcnv2ZYfLTQtQfyrTiYbogrkMKCWmQ4uJ+tC10Par5j
|
||||
mNq35f4ruXyQZb6Vnb9ZmpyhrS2oEdzr7NqZFdd97WA2s5Hmtyt+S0QEafPVjKRE
|
||||
3cjCnB/yGQF9Dv4gHRS3FMwFCqehjdImNWrwfKEfUQKBgQDd3plNXNxRuMVrYM/e
|
||||
4k/9qjOGXHktrnFs6BDmfLatcVfNO4s9+/WUb6WxyhiH849EbmSXkGVMXpKpxQd4
|
||||
74G45nH2HrLR8dghnMEuAeMri6DNJrrvi18JnK35mM0ve1/1Xqzk2KyfD5/aLz19
|
||||
eFmTH9WNPzuPriYa9SlHHeVbbQKBgQDGWD4Ui4u11OZDR39j/eUu3C1lH4wl9sPV
|
||||
XOvJrNMIAF0+zLwaM/MYzmJdXYv7l8/EgIVCGPnEFscYpbgjMVAQAVdvU/i0rki1
|
||||
voFffeJSs7WvY91gH1b0CRPPIIgoibTY/cA0nfV+oSPvg+qOnM79a9zz7TmjyA8D
|
||||
tJ8/u2bgLwKBgQDVTs3UsxKe/yXOtqUjhDGjj5857m4SnUQvkG2vKvf2iKIBjt2w
|
||||
Gi1hKHYFGGe9TUzQXdIYZZr+cW5QCj3E53+wZN3r4lfJwNoqdqrDsMzXcMaIdlQD
|
||||
OduFQj2BWobqv5LiNMPEwQw1YLAu9HwJxUtZR6HoyoJZAPVhtZKZ7QQ1gQKBgAKs
|
||||
5gl46GWHfaOir0E2B4VeSu52QnmwnmueWT/bKO2Os7NJJ7BiywCmqAUCYgT+wzqv
|
||||
URzXIWdXt0/JzHYNEDtnCTrjMxOc1jY9X5leJVNgQS8gdbf6ND4OcUn18mA5m0ri
|
||||
AVm0V79hhQ6SBPPvgYtBjTVtGb3v0OQH564AZR7ZAoGAKojS2OgQqQ4+x3+J9Z8B
|
||||
Pc6hvvYe0dTn5rp+t+fPTAXIus6AjZ7a8TtlQBebtYTI0HUambUhsvTfSAsKurNt
|
||||
9tasedlJZZAVrEgtOONoxgx1ARrBInnMY75Acmzz74tiDzlub36Oo8Xit+m52UEM
|
||||
LfGbaogkR6/j654iSC7t50k=
|
||||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDd2VNBxAwVszmx
|
||||
4GYXNsRZqqZI+yXzk0B28iISpOwnrqJTzoyO+0Ekm1rzRwA29zrjv3mRun/EchX0
|
||||
qRoS/bX7+JmH4UtSs/UkcO4U04zm3bKPCSfATyMQaUbhNlnZcYzpDsCuEebb29a7
|
||||
1HZQPgTDETMEqjTg8RZhkcJHjst9oYWtn7yOsMyiRjYkc0T7mMNn9i9ObuyIM3No
|
||||
+si9MbUMxhhD1nS538jfFgzoKV1XSQMvQdDwoHFB55PDhZFtmgUW0o2559rMCu+T
|
||||
DH1VJk1NoYPEYdb513st34kDXlsYY+zECVY32Z5gUiO1flbnRbgTmnBjuPLFUov0
|
||||
I45mbGJdAgMBAAECggEACEgZHg7h/ptir3u3g+1U9h3zOC079PRNx0Lxt611bWPN
|
||||
BoDi6WGCxImSIxvG68Zd6euXb7O9GknB/RCk+wmCliXpIVPtOmiiYZpfoOJm06V6
|
||||
CXHnjHvHzNCJR1X+k6nz/y1ATx829YUm5nsfcY5nIhsNwwJRmAYX9kt5K6+udAGW
|
||||
TQkAY3y9EymludSDlNdfiHgUxxF1xL0E1d9ZfcZy949NUa3/uZpyZy7vA747g+hy
|
||||
ILLTt0hCEJqmstDGrrdfjdPlb34S0J7mNj4Q9d2PyNiom2vY9JBlwQzMEIWjCdPu
|
||||
pE2tqP2vtzSlYzR9O1T0N4sUbW2Zj5C77NgXavmsZwKBgQD2Pd2Mxy7jgTJkLGvz
|
||||
cmjJLVz6gRCWXhb1mBtr/hi8+IKjk96vdHUvZazdPwgW3Qo7mu4+lyCvgadKvJM/
|
||||
1SI6BQXgf6ONqoSFIWc0R6IP/i7aQcgjFjOjxBd7Qi59J5Za+4hFC1VEK0hftRXx
|
||||
t/i+YrBBSXA2z6KQV5OJcOAMgwKBgQDmo/6E55DrfnHZqYYmi1ZXRQzpV3etJruW
|
||||
eEanz+X8AJArSOrOJ6DoGNiN0Ukdp0voeS1jJVbOeqS1Ehfiasl8/NMVne9NUeX4
|
||||
DvETRn2G4aKKHCnNy/RhYraDwR0T8C2hqep+tqgrcdkZPvFShn+C0jYaVLjon5c8
|
||||
lZoxvOBfnwKBgHoX3LVDwcT+N20h9XilHr25Z2OyAPZ9uqaVf+tA9yUjlyriU8Tt
|
||||
Wnlg0aB1813axYseW8jfCE7dW4ScEerRlAHuoaZZw0+n38Ne95wddIa3gqWnfkOf
|
||||
a4Vk4ju0afaWXV/JXhzV7LY7O8xwrmvGy2gi6L/GWQRkWXd2ZOn99KlfAoGAZunI
|
||||
OQ+G1729GW2OYYaNCTXTdA9GZGnDDHowtNKMgazSp63KsCB4qPflMSqwoF20/k+L
|
||||
1BCmMk4BTpZ7N9mEfJPnsF6fl/WyUsSAB6TNgDEQMOYuNRkLu6SrYhD6Y5opElja
|
||||
PJ5OXcxYHe67CaLgJMSdxZQGSi5j8nGiswzfZWsCgYADSCIfjG6c0MfwzAgAbVEa
|
||||
w1WV3LMCdOqqq68L68ldgOiu5hQp1vMEJBCFzxVZuaI63EeoNaPF6zZv64LUISuc
|
||||
7pY02T5KSpVL8ocT9aW9MjJS0MUfihWBYl+aQ5XZm8hXp6c1XFA+9USCEcp/UEB5
|
||||
DSPjc5Z7Gl6MZEhs34vy8A==
|
||||
-----END PRIVATE KEY-----
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "web-opentelemetry-example",
|
||||
"private": true,
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Example of using @opentelemetry/sdk-trace-web and @opentelemetry/sdk-metrics in browser",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
@ -47,13 +47,13 @@
|
|||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/context-zone": "2.0.1",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/exporter-zipkin": "2.0.1",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation-fetch": "0.202.0",
|
||||
"@opentelemetry/instrumentation-xml-http-request": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/instrumentation-fetch": "0.203.0",
|
||||
"@opentelemetry/instrumentation-xml-http-request": "0.203.0",
|
||||
"@opentelemetry/propagator-b3": "2.0.1",
|
||||
"@opentelemetry/sdk-metrics": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "example-otlp-exporter-node",
|
||||
"private": true,
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Example of using @opentelemetry/collector-exporter in Node.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
@ -31,12 +31,12 @@
|
|||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/exporter-metrics-otlp-grpc": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-grpc": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-grpc": "0.203.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.203.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-grpc": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-proto": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-metrics": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1",
|
||||
|
|
|
|||
|
|
@ -8,14 +8,58 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
|
|||
|
||||
### :boom: Breaking Changes
|
||||
|
||||
* feat(api-logs)!: Marked private methods as "conventionally private". [#5789](https://github.com/open-telemetry/opentelemetry-js/pull/5789)
|
||||
* feat(exporter-otlp-\*): support custom HTTP agents [#5719](https://github.com/open-telemetry/opentelemetry-js/pull/5719) @raphael-theriault-swi
|
||||
* `OtlpHttpConfiguration.agentOptions` has been removed and functionality has been rolled into `OtlpHttpConfiguration.agentFactory`
|
||||
* (old) `{ agentOptions: myOptions }`
|
||||
* (new) `{ agentFactory: httpAgentFactoryFromOptions(myOptions) }`
|
||||
|
||||
### :rocket: Features
|
||||
|
||||
* feat(opentelemetry-configuration): creation of basic ConfigProvider [#5809](https://github.com/open-telemetry/opentelemetry-js/pull/5809) @maryliag
|
||||
* feat(opentelemetry-configuration): creation of basic FileConfigProvider [#5863](https://github.com/open-telemetry/opentelemetry-js/pull/5863) @maryliag
|
||||
* feat(sdk-node): Add support for multiple metric readers via the new `metricReaders` option in NodeSDK configuration. Users can now register multiple metric readers (e.g., Console, Prometheus) directly through the NodeSDK constructor. The old `metricReader` (singular) option is now deprecated and will show a warning if used, but remains supported for backward compatibility. Comprehensive tests and documentation have been added. [#5760](https://github.com/open-telemetry/opentelemetry-js/issues/5760)
|
||||
* **Migration:**
|
||||
- Before:
|
||||
|
||||
```js
|
||||
const sdk = new NodeSDK({ metricReader: myMetricReader });
|
||||
```
|
||||
|
||||
- After:
|
||||
|
||||
```js
|
||||
const sdk = new NodeSDK({ metricReaders: [myMetricReader] });
|
||||
```
|
||||
|
||||
* Users should migrate to the new `metricReaders` array option for future compatibility. The old option will be removed in an upcoming experimental version.
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
* fix(otlp-exporter-base): prioritize `esnext` export condition as it is more specific [#5458](https://github.com/open-telemetry/opentelemetry-js/pull/5458)
|
||||
* fix(instrumentation-fetch): Use ESM version of semconv instead of CJS. Users expecting mixed ESM and CJS modules will now only get ESM modules. [#5878](https://github.com/open-telemetry/opentelemetry-js/pull/5878) @overbalance
|
||||
|
||||
### :books: Documentation
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* refactor(otlp-exporter-base): use getStringFromEnv instead of process.env [#5594](https://github.com/open-telemetry/opentelemetry-js/pull/5594) @weyert
|
||||
* chore(sdk-logs): refactored imports [#5801](https://github.com/open-telemetry/opentelemetry-js/pull/5801) @svetlanabrennan
|
||||
|
||||
## 0.203.0
|
||||
|
||||
### :boom: Breaking Changes
|
||||
|
||||
* feat(sdk-logs)!: Removed deprecated LoggerProvider#addLogRecordProcessor() [#5764](https://github.com/open-telemetry/opentelemetry-js/pull/5764) @svetlanabrennan
|
||||
* feat(sdk-logs)!: Changed `LogRecord` class to be an interface [#5749](https://github.com/open-telemetry/opentelemetry-js/pull/5749) @svetlanabrennan
|
||||
* user-facing: `LogRecord` class is now not exported anymore. A newly exported interface `SdkLogRecord` is used in its place.
|
||||
* feat!: Removed `api-events` and `sdk-events` [#5737](https://github.com/open-telemetry/opentelemetry-js/pull/5737) @svetlanabrennan
|
||||
|
||||
### :house: Internal
|
||||
|
||||
* chore: Regenerated certs [#5752](https://github.com/open-telemetry/opentelemetry-js/pull/5752) @svetlanabrennan
|
||||
* refactor(otlp-exporter-base): remove compatibility code that was intended for now unsupported runtime Node.js v14 @pichlermarc
|
||||
|
||||
## 0.202.0
|
||||
|
||||
### :rocket: Features
|
||||
|
|
@ -52,6 +96,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
|
|||
* fix(otlp-transformer): do not throw when deserializing empty JSON response [#5551](https://github.com/open-telemetry/opentelemetry-js/pull/5551) @pichlermarc
|
||||
* fix(instrumentation-http): report stable client metrics response code [#9586](https://github.com/open-telemetry/opentelemetry-js/pull/9586) @jtescher
|
||||
* fix(sdk-node): instantiate baggage processor when env var is set [#5634](https://github.com/open-telemetry/opentelemetry-js/pull/5634) @pichlermarc
|
||||
* fix(instrumentation-http): report `error.type` metrics attribute [#5647](https://github.com/open-telemetry/opentelemetry-js/pull/5647)
|
||||
|
||||
### :house: Internal
|
||||
|
||||
|
|
@ -109,7 +154,7 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
|
|||
|
||||
### :house: (Internal)
|
||||
|
||||
* chore(instrumentation-grpc): remove unused findIndex() function [#5372](https://github.com/open-telemetry/opentelemetry-js/pull/5372) @cjihrig
|
||||
* refactor(instrumentation-grpc): remove unused findIndex() function [#5372](https://github.com/open-telemetry/opentelemetry-js/pull/5372) @cjihrig
|
||||
* refactor(otlp-exporter-base): remove unnecessary isNaN() checks [#5374](https://github.com/open-telemetry/opentelemetry-js/pull/5374) @cjihrig
|
||||
* refactor(exporter-prometheus): remove unnecessary isNaN() check [#5377](https://github.com/open-telemetry/opentelemetry-js/pull/5377) @cjihrig
|
||||
* refactor(sdk-node): move code to auto-instantiate propagators into utils [#5355](https://github.com/open-telemetry/opentelemetry-js/pull/5355) @pichlermarc
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "backcompat-node14",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"private": true,
|
||||
"description": "Backwards compatibility app for node 14 types and the OpenTelemetry Node.js SDK",
|
||||
"main": "index.js",
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/sdk-node": "0.202.0",
|
||||
"@opentelemetry/sdk-node": "0.203.0",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "backcompat-node16",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"private": true,
|
||||
"description": "Backwards compatibility app for node 16 types and the OpenTelemetry Node.js SDK",
|
||||
"main": "index.js",
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/sdk-node": "0.202.0",
|
||||
"@opentelemetry/sdk-node": "0.203.0",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -1,21 +0,0 @@
|
|||
## Installation
|
||||
|
||||
```sh
|
||||
# from this directory
|
||||
npm install
|
||||
```
|
||||
|
||||
## Run the Application
|
||||
|
||||
```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-events>
|
||||
|
||||
## LICENSE
|
||||
|
||||
Apache License 2.0
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* 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 {
|
||||
LoggerProvider,
|
||||
ConsoleLogRecordExporter,
|
||||
SimpleLogRecordProcessor,
|
||||
} from '@opentelemetry/sdk-logs';
|
||||
import { events } from '@opentelemetry/api-events';
|
||||
import { EventLoggerProvider } from '@opentelemetry/sdk-events';
|
||||
|
||||
// Optional and only needed to see the internal diagnostic logging (during development)
|
||||
diag.setLogger(new DiagConsoleLogger(), DiagLogLevel.DEBUG);
|
||||
|
||||
// configure global LoggerProvider
|
||||
const loggerProvider = new LoggerProvider();
|
||||
loggerProvider.addLogRecordProcessor(
|
||||
new SimpleLogRecordProcessor(new ConsoleLogRecordExporter())
|
||||
);
|
||||
|
||||
// uncomment to use OTLP exporter
|
||||
// import { OTLPLogExporter } from '@opentelemetry/exporter-logs-otlp-http';
|
||||
// const logExporter = new OTLPLogExporter();
|
||||
// loggerProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(logExporter));
|
||||
|
||||
// configure global EventLoggerProvider
|
||||
const eventLoggerProvider = new EventLoggerProvider(loggerProvider);
|
||||
events.setGlobalEventLoggerProvider(eventLoggerProvider);
|
||||
|
||||
// emit a log record
|
||||
const eventLogger = events.getEventLogger('example');
|
||||
eventLogger.emit({
|
||||
name: 'my-domain.my-event',
|
||||
data: {
|
||||
a: 1,
|
||||
b: 'hello',
|
||||
c: {
|
||||
d: 123
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"name": "events-example",
|
||||
"version": "0.202.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "ts-node index.ts"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.7.0",
|
||||
"@opentelemetry/api-events": "0.202.0",
|
||||
"@opentelemetry/api-logs": "0.202.0",
|
||||
"@opentelemetry/exporter-logs-otlp-http": "0.202.0",
|
||||
"@opentelemetry/sdk-events": "0.202.0",
|
||||
"@opentelemetry/sdk-logs": "0.202.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.6.5",
|
||||
"ts-node": "^10.9.1"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,28 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "build",
|
||||
"rootDir": "."
|
||||
},
|
||||
"include": ["./index.ts"],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../api"
|
||||
},
|
||||
{
|
||||
"path": "../../../experimental/packages/api-events"
|
||||
},
|
||||
{
|
||||
"path": "../../../experimental/packages/api-logs"
|
||||
},
|
||||
{
|
||||
"path": "../../../experimental/packages/sdk-events"
|
||||
},
|
||||
{
|
||||
"path": "../../../experimental/packages/sdk-logs"
|
||||
},
|
||||
{
|
||||
"path": "../../../experimental/packages/exporter-logs-otlp-http"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -25,10 +25,13 @@ import {
|
|||
// 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())
|
||||
);
|
||||
const loggerProvider = new LoggerProvider({
|
||||
processors: [
|
||||
new SimpleLogRecordProcessor(
|
||||
new ConsoleLogRecordExporter()
|
||||
)
|
||||
],
|
||||
});
|
||||
|
||||
logs.setGlobalLoggerProvider(loggerProvider);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "logs-example",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "ts-node index.ts",
|
||||
|
|
@ -8,8 +8,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.7.0",
|
||||
"@opentelemetry/api-logs": "0.202.0",
|
||||
"@opentelemetry/sdk-logs": "0.202.0"
|
||||
"@opentelemetry/api-logs": "0.203.0",
|
||||
"@opentelemetry/sdk-logs": "0.203.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "18.6.5",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "opencensus-shim",
|
||||
"private": true,
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Example of using @opentelemetry/shim-opencensus in Node.js",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
|
@ -32,13 +32,13 @@
|
|||
"@opencensus/instrumentation-http": "0.1.0",
|
||||
"@opencensus/nodejs-base": "0.1.0",
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
"@opentelemetry/exporter-prometheus": "0.202.0",
|
||||
"@opentelemetry/exporter-trace-otlp-grpc": "0.202.0",
|
||||
"@opentelemetry/exporter-prometheus": "0.203.0",
|
||||
"@opentelemetry/exporter-trace-otlp-grpc": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-metrics": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-node": "2.0.1",
|
||||
"@opentelemetry/semantic-conventions": "^1.29.0",
|
||||
"@opentelemetry/shim-opencensus": "0.202.0"
|
||||
"@opentelemetry/shim-opencensus": "0.203.0"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/examples/opencensus-shim"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "prometheus-example",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"private": true,
|
||||
"description": "Example of using @opentelemetry/sdk-metrics and @opentelemetry/exporter-prometheus",
|
||||
"main": "index.js",
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/exporter-prometheus": "0.202.0",
|
||||
"@opentelemetry/exporter-prometheus": "0.203.0",
|
||||
"@opentelemetry/sdk-metrics": "2.0.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"mocha": true,
|
||||
"commonjs": true,
|
||||
"shared-node-browser": true
|
||||
},
|
||||
...require('../../../eslint.base.js')
|
||||
}
|
||||
|
|
@ -1,60 +0,0 @@
|
|||
# OpenTelemetry API for JavaScript
|
||||
|
||||
[![NPM Published Version][npm-img]][npm-url]
|
||||
[![Apache License][license-image]][license-image]
|
||||
|
||||
This package provides everything needed to interact with the unstable OpenTelemetry Events API, including all TypeScript interfaces, enums, and no-op implementations. It is intended for use both on the server and in the browser.
|
||||
|
||||
## Beta Software - Use at your own risk
|
||||
|
||||
The events API is considered alpha software and there is no guarantee of stability or long-term support. When the API is stabilized, it will be made available and supported long-term in the `@opentelemetry/api` package and this package will be deprecated.
|
||||
|
||||
## Quick Start
|
||||
|
||||
Purposefully left blank until SDK is available.
|
||||
|
||||
## Version Compatibility
|
||||
|
||||
Because the npm installer and node module resolution algorithm could potentially allow two or more copies of any given package to exist within the same `node_modules` structure, the OpenTelemetry API takes advantage of a variable on the `global` object to store the global API. When an API method in the API package is called, it checks if this `global` API exists and proxies calls to it if and only if it is a compatible API version. This means if a package has a dependency on an OpenTelemetry API version which is not compatible with the API used by the end user, the package will receive a no-op implementation of the API.
|
||||
|
||||
## Advanced Use
|
||||
|
||||
### API Methods
|
||||
|
||||
If you are writing an instrumentation library, or prefer to call the API methods directly rather than using the `register` method on the Tracer/Meter/Logger Provider, OpenTelemetry provides direct access to the underlying API methods through the `@opentelemetry/api-events` package. API entry points are defined as global singleton objects `trace`, `metrics`, `logs`, `events`, `propagation`, and `context` which contain methods used to initialize SDK implementations and acquire resources from the API.
|
||||
|
||||
- [Events API Documentation][events-api-docs]
|
||||
|
||||
```javascript
|
||||
const api = require("@opentelemetry/api-events");
|
||||
|
||||
/* A specific implementation of EventLoggerProvider comes from an SDK */
|
||||
const eventLoggerProvider = createEventLoggerProvider();
|
||||
|
||||
/* Initialize EventLoggerProvider */
|
||||
api.events.setGlobalEventLoggerProvider(eventLoggerProvider);
|
||||
/* returns eventLoggerProvider (no-op if a working provider has not been initialized) */
|
||||
api.events.getEventLoggerProvider();
|
||||
/* returns an event logger from the registered global event logger provider (no-op if a working provider has not been initialized) */
|
||||
const eventLogger = api.events.getEventLogger(name, version);
|
||||
|
||||
// logging an event in an instrumentation library
|
||||
eventLogger.emit({ name: 'event-name' });
|
||||
```
|
||||
|
||||
## Useful links
|
||||
|
||||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
||||
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
||||
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0 - See [LICENSE][license-url] for more information.
|
||||
|
||||
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
||||
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
|
||||
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
||||
[npm-url]: https://www.npmjs.com/package/@opentelemetry/api-logs
|
||||
[npm-img]: https://badge.fury.io/js/%40opentelemetry%2Fapi-logs.svg
|
||||
[events-api-docs]: https://open-telemetry.github.io/opentelemetry-js/modules/_opentelemetry_api_events.html
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
/*!
|
||||
* 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
|
||||
*
|
||||
* http://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.
|
||||
*/
|
||||
|
||||
const karmaWebpackConfig = require('../../../karma.webpack');
|
||||
const karmaBaseConfig = require('../../../karma.base');
|
||||
|
||||
module.exports = (config) => {
|
||||
config.set(Object.assign({}, karmaBaseConfig, {
|
||||
webpack: karmaWebpackConfig
|
||||
}))
|
||||
};
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
{
|
||||
"name": "@opentelemetry/api-events",
|
||||
"version": "0.202.0",
|
||||
"description": "Public events API for OpenTelemetry",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
"esnext": "build/esnext/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
"browser": {
|
||||
"./src/platform/index.ts": "./src/platform/browser/index.ts",
|
||||
"./build/esm/platform/index.js": "./build/esm/platform/browser/index.js",
|
||||
"./build/esnext/platform/index.js": "./build/esnext/platform/browser/index.js",
|
||||
"./build/src/platform/index.js": "./build/src/platform/browser/index.js"
|
||||
},
|
||||
"repository": "open-telemetry/opentelemetry-js",
|
||||
"scripts": {
|
||||
"build": "npm run compile",
|
||||
"clean": "tsc --build --clean tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"compile": "tsc --build tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"prepublishOnly": "npm run compile",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"prewatch": "node ../../../scripts/version-update.js",
|
||||
"test": "nyc mocha test/**/*.test.ts",
|
||||
"test:browser": "karma start --single-run",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
},
|
||||
"keywords": [
|
||||
"opentelemetry",
|
||||
"nodejs",
|
||||
"browser",
|
||||
"profiling",
|
||||
"events",
|
||||
"stats",
|
||||
"monitoring"
|
||||
],
|
||||
"author": "OpenTelemetry Authors",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": ">=8.0.0"
|
||||
},
|
||||
"files": [
|
||||
"build/esm/**/*.js",
|
||||
"build/esm/**/*.js.map",
|
||||
"build/esm/**/*.d.ts",
|
||||
"build/esnext/**/*.js",
|
||||
"build/esnext/**/*.js.map",
|
||||
"build/esnext/**/*.d.ts",
|
||||
"build/src/**/*.js",
|
||||
"build/src/**/*.js.map",
|
||||
"build/src/**/*.d.ts",
|
||||
"doc",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.3.0",
|
||||
"@opentelemetry/api-logs": "0.202.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/mocha": "10.0.10",
|
||||
"@types/node": "^8.10.66",
|
||||
"@types/webpack-env": "1.16.3",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
"karma-mocha": "2.0.1",
|
||||
"karma-spec-reporter": "0.0.36",
|
||||
"karma-webpack": "5.0.1",
|
||||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-events",
|
||||
"sideEffects": false
|
||||
}
|
||||
|
|
@ -1,32 +0,0 @@
|
|||
/*
|
||||
* 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 { EventLoggerProvider } from './types/EventLoggerProvider';
|
||||
import { EventLogger } from './types/EventLogger';
|
||||
import { EventLoggerOptions } from './types/EventLoggerOptions';
|
||||
import { NoopEventLogger } from './NoopEventLogger';
|
||||
|
||||
export class NoopEventLoggerProvider implements EventLoggerProvider {
|
||||
getEventLogger(
|
||||
_name: string,
|
||||
_version?: string | undefined,
|
||||
_options?: EventLoggerOptions | undefined
|
||||
): EventLogger {
|
||||
return new NoopEventLogger();
|
||||
}
|
||||
}
|
||||
|
||||
export const NOOP_EVENT_LOGGER_PROVIDER = new NoopEventLoggerProvider();
|
||||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* 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 {
|
||||
API_BACKWARDS_COMPATIBILITY_VERSION,
|
||||
GLOBAL_EVENTS_API_KEY,
|
||||
_global,
|
||||
makeGetter,
|
||||
} from '../internal/global-utils';
|
||||
import { EventLoggerProvider } from '../types/EventLoggerProvider';
|
||||
import { NOOP_EVENT_LOGGER_PROVIDER } from '../NoopEventLoggerProvider';
|
||||
import { EventLogger } from '../types/EventLogger';
|
||||
import { EventLoggerOptions } from '../types/EventLoggerOptions';
|
||||
|
||||
export class EventsAPI {
|
||||
private static _instance?: EventsAPI;
|
||||
|
||||
private constructor() {}
|
||||
|
||||
public static getInstance(): EventsAPI {
|
||||
if (!this._instance) {
|
||||
this._instance = new EventsAPI();
|
||||
}
|
||||
|
||||
return this._instance;
|
||||
}
|
||||
|
||||
public setGlobalEventLoggerProvider(
|
||||
provider: EventLoggerProvider
|
||||
): EventLoggerProvider {
|
||||
if (_global[GLOBAL_EVENTS_API_KEY]) {
|
||||
return this.getEventLoggerProvider();
|
||||
}
|
||||
|
||||
_global[GLOBAL_EVENTS_API_KEY] = makeGetter<EventLoggerProvider>(
|
||||
API_BACKWARDS_COMPATIBILITY_VERSION,
|
||||
provider,
|
||||
NOOP_EVENT_LOGGER_PROVIDER
|
||||
);
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the global event logger provider.
|
||||
*
|
||||
* @returns EventLoggerProvider
|
||||
*/
|
||||
public getEventLoggerProvider(): EventLoggerProvider {
|
||||
return (
|
||||
_global[GLOBAL_EVENTS_API_KEY]?.(API_BACKWARDS_COMPATIBILITY_VERSION) ??
|
||||
NOOP_EVENT_LOGGER_PROVIDER
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a event logger from the global event logger provider.
|
||||
*
|
||||
* @returns EventLogger
|
||||
*/
|
||||
public getEventLogger(
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: EventLoggerOptions
|
||||
): EventLogger {
|
||||
return this.getEventLoggerProvider().getEventLogger(name, version, options);
|
||||
}
|
||||
|
||||
/** Remove the global event logger provider */
|
||||
public disable(): void {
|
||||
delete _global[GLOBAL_EVENTS_API_KEY];
|
||||
}
|
||||
}
|
||||
|
|
@ -1,55 +0,0 @@
|
|||
/*
|
||||
* 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 { EventLoggerProvider } from '../types/EventLoggerProvider';
|
||||
import { _globalThis } from '../platform';
|
||||
|
||||
export const GLOBAL_EVENTS_API_KEY = Symbol.for(
|
||||
'io.opentelemetry.js.api.events'
|
||||
);
|
||||
|
||||
type Get<T> = (version: number) => T;
|
||||
type OtelGlobal = Partial<{
|
||||
[GLOBAL_EVENTS_API_KEY]: Get<EventLoggerProvider>;
|
||||
}>;
|
||||
|
||||
export const _global = _globalThis as OtelGlobal;
|
||||
|
||||
/**
|
||||
* Make a function which accepts a version integer and returns the instance of an API if the version
|
||||
* is compatible, or a fallback version (usually NOOP) if it is not.
|
||||
*
|
||||
* @param requiredVersion Backwards compatibility version which is required to return the instance
|
||||
* @param instance Instance which should be returned if the required version is compatible
|
||||
* @param fallback Fallback instance, usually NOOP, which will be returned if the required version is not compatible
|
||||
*/
|
||||
export function makeGetter<T>(
|
||||
requiredVersion: number,
|
||||
instance: T,
|
||||
fallback: T
|
||||
): Get<T> {
|
||||
return (version: number): T =>
|
||||
version === requiredVersion ? instance : fallback;
|
||||
}
|
||||
|
||||
/**
|
||||
* A number which should be incremented each time a backwards incompatible
|
||||
* change is made to the API. This number is used when an API package
|
||||
* attempts to access the global API to ensure it is getting a compatible
|
||||
* version. If the global API is not compatible with the API package
|
||||
* attempting to get it, a NOOP API implementation will be returned.
|
||||
*/
|
||||
export const API_BACKWARDS_COMPATIBILITY_VERSION = 1;
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
// Updates to this file should also be replicated to @opentelemetry/api and
|
||||
// @opentelemetry/core too.
|
||||
|
||||
/**
|
||||
* - globalThis (New standard)
|
||||
* - self (Will return the current window instance for supported browsers)
|
||||
* - window (fallback for older browser implementations)
|
||||
* - global (NodeJS implementation)
|
||||
* - <object> (When all else fails)
|
||||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
|
||||
export const _globalThis: typeof globalThis =
|
||||
typeof globalThis === 'object'
|
||||
? globalThis
|
||||
: typeof self === 'object'
|
||||
? self
|
||||
: typeof window === 'object'
|
||||
? window
|
||||
: typeof global === 'object'
|
||||
? (global as unknown as typeof globalThis)
|
||||
: ({} as typeof globalThis);
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export { _globalThis } from './globalThis';
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
export { _globalThis } from './node';
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins
|
||||
export const _globalThis = typeof globalThis === 'object' ? globalThis : global;
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
/*
|
||||
* 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 { Attributes, Context, TimeInput } from '@opentelemetry/api';
|
||||
import { AnyValue, SeverityNumber } from '@opentelemetry/api-logs';
|
||||
|
||||
export interface Event {
|
||||
/**
|
||||
* The time when the event occurred as UNIX Epoch time in nanoseconds.
|
||||
*/
|
||||
timestamp?: TimeInput;
|
||||
|
||||
/**
|
||||
* The name of the event.
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* Data that describes the event.
|
||||
* Intended to be used by instrumentation libraries.
|
||||
*/
|
||||
data?: AnyValue;
|
||||
|
||||
/**
|
||||
* Additional attributes that describe the event.
|
||||
*/
|
||||
attributes?: Attributes;
|
||||
|
||||
/**
|
||||
* Numerical value of the severity.
|
||||
*/
|
||||
severityNumber?: SeverityNumber;
|
||||
|
||||
/**
|
||||
* The Context associated with the Event.
|
||||
*/
|
||||
context?: Context;
|
||||
}
|
||||
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
* 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 { EventLogger } from './EventLogger';
|
||||
import { EventLoggerOptions } from './EventLoggerOptions';
|
||||
|
||||
/**
|
||||
* A registry for creating named {@link EventLogger}s.
|
||||
*/
|
||||
export interface EventLoggerProvider {
|
||||
/**
|
||||
* Returns an EventLogger, creating one if one with the given name, version, and
|
||||
* schemaUrl pair is not already created.
|
||||
*
|
||||
* @param name The name of the event logger or instrumentation library.
|
||||
* @param version The version of the event logger or instrumentation library.
|
||||
* @param options The options of the event logger or instrumentation library.
|
||||
* @returns EventLogger An event logger with the given name and version.
|
||||
*/
|
||||
getEventLogger(
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: EventLoggerOptions
|
||||
): EventLogger;
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* 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 * as assert from 'assert';
|
||||
import { EventLogger, events } from '../../src';
|
||||
import { NoopEventLogger } from '../../src/NoopEventLogger';
|
||||
import { NoopEventLoggerProvider } from '../../src/NoopEventLoggerProvider';
|
||||
|
||||
describe('API', () => {
|
||||
const dummyEventLogger = new NoopEventLogger();
|
||||
|
||||
it('should expose a event logger provider via getEventLoggerProvider', () => {
|
||||
const provider = events.getEventLoggerProvider();
|
||||
assert.ok(provider);
|
||||
assert.strictEqual(typeof provider, 'object');
|
||||
});
|
||||
|
||||
describe('GlobalEventLoggerProvider', () => {
|
||||
beforeEach(() => {
|
||||
events.disable();
|
||||
});
|
||||
|
||||
it('should use the global event logger provider', () => {
|
||||
events.setGlobalEventLoggerProvider(new TestEventLoggerProvider());
|
||||
const eventLogger = events
|
||||
.getEventLoggerProvider()
|
||||
.getEventLogger('name');
|
||||
assert.deepStrictEqual(eventLogger, dummyEventLogger);
|
||||
});
|
||||
|
||||
it('should not allow overriding global provider if already set', () => {
|
||||
const provider1 = new TestEventLoggerProvider();
|
||||
const provider2 = new TestEventLoggerProvider();
|
||||
events.setGlobalEventLoggerProvider(provider1);
|
||||
assert.equal(events.getEventLoggerProvider(), provider1);
|
||||
events.setGlobalEventLoggerProvider(provider2);
|
||||
assert.equal(events.getEventLoggerProvider(), provider1);
|
||||
});
|
||||
});
|
||||
|
||||
describe('getEventLogger', () => {
|
||||
beforeEach(() => {
|
||||
events.disable();
|
||||
});
|
||||
|
||||
it('should return a event logger instance from global provider', () => {
|
||||
events.setGlobalEventLoggerProvider(new TestEventLoggerProvider());
|
||||
const eventLogger = events.getEventLogger('myEventLogger');
|
||||
assert.deepStrictEqual(eventLogger, dummyEventLogger);
|
||||
});
|
||||
});
|
||||
|
||||
class TestEventLoggerProvider extends NoopEventLoggerProvider {
|
||||
override getEventLogger(): EventLogger {
|
||||
return dummyEventLogger;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
const testsContext = require.context('.', true, /test$/);
|
||||
testsContext.keys().forEach(testsContext);
|
||||
|
||||
const srcContext = require.context('.', true, /src$/);
|
||||
srcContext.keys().forEach(srcContext);
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
/*
|
||||
* 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 * as assert from 'assert';
|
||||
import {
|
||||
_global,
|
||||
GLOBAL_EVENTS_API_KEY,
|
||||
} from '../../src/internal/global-utils';
|
||||
import { NoopEventLoggerProvider } from '../../src/NoopEventLoggerProvider';
|
||||
|
||||
const api1 = require('../../src') as typeof import('../../src');
|
||||
|
||||
// clear cache and load a second instance of the api
|
||||
for (const key of Object.keys(require.cache)) {
|
||||
delete require.cache[key];
|
||||
}
|
||||
const api2 = require('../../src') as typeof import('../../src');
|
||||
|
||||
describe('Global Utils', () => {
|
||||
// prove they are separate instances
|
||||
assert.notStrictEqual(api1, api2);
|
||||
// that return separate noop instances to start
|
||||
assert.notStrictEqual(
|
||||
api1.events.getEventLoggerProvider(),
|
||||
api2.events.getEventLoggerProvider()
|
||||
);
|
||||
|
||||
beforeEach(() => {
|
||||
api1.events.disable();
|
||||
api2.events.disable();
|
||||
});
|
||||
|
||||
it('should change the global event logger provider', () => {
|
||||
const original = api1.events.getEventLoggerProvider();
|
||||
const newEventLoggerProvider = new NoopEventLoggerProvider();
|
||||
api1.events.setGlobalEventLoggerProvider(newEventLoggerProvider);
|
||||
assert.notStrictEqual(api1.events.getEventLoggerProvider(), original);
|
||||
assert.strictEqual(
|
||||
api1.events.getEventLoggerProvider(),
|
||||
newEventLoggerProvider
|
||||
);
|
||||
});
|
||||
|
||||
it('should load an instance from one which was set in the other', () => {
|
||||
api1.events.setGlobalEventLoggerProvider(new NoopEventLoggerProvider());
|
||||
assert.strictEqual(
|
||||
api1.events.getEventLoggerProvider(),
|
||||
api2.events.getEventLoggerProvider()
|
||||
);
|
||||
});
|
||||
|
||||
it('should disable both if one is disabled', () => {
|
||||
const original = api1.events.getEventLoggerProvider();
|
||||
|
||||
api1.events.setGlobalEventLoggerProvider(new NoopEventLoggerProvider());
|
||||
|
||||
assert.notStrictEqual(original, api1.events.getEventLoggerProvider());
|
||||
api2.events.disable();
|
||||
assert.strictEqual(original, api1.events.getEventLoggerProvider());
|
||||
});
|
||||
|
||||
it('should return the module NoOp implementation if the version is a mismatch', () => {
|
||||
const original = api1.events.getEventLoggerProvider();
|
||||
api1.events.setGlobalEventLoggerProvider(new NoopEventLoggerProvider());
|
||||
const afterSet = _global[GLOBAL_EVENTS_API_KEY]!(-1);
|
||||
|
||||
assert.strictEqual(original, afterSet);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* 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 * as assert from 'assert';
|
||||
import { NoopEventLogger } from '../../src/NoopEventLogger';
|
||||
import { NoopEventLoggerProvider } from '../../src/NoopEventLoggerProvider';
|
||||
|
||||
describe('NoopLoggerProvider', () => {
|
||||
it('should not crash', () => {
|
||||
const eventLoggerProvider = new NoopEventLoggerProvider();
|
||||
|
||||
assert.ok(
|
||||
eventLoggerProvider.getEventLogger('logger-name') instanceof
|
||||
NoopEventLogger
|
||||
);
|
||||
assert.ok(
|
||||
eventLoggerProvider.getEventLogger('logger-name', 'v1') instanceof
|
||||
NoopEventLogger
|
||||
);
|
||||
assert.ok(
|
||||
eventLoggerProvider.getEventLogger('logger-name', 'v1', {
|
||||
schemaUrl: 'https://opentelemetry.io/schemas/1.7.0',
|
||||
}) instanceof NoopEventLogger
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
/*
|
||||
* 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 * as assert from 'assert';
|
||||
import { NoopEventLogger } from '../../src/NoopEventLogger';
|
||||
import { NoopEventLoggerProvider } from '../../src/NoopEventLoggerProvider';
|
||||
|
||||
describe('NoopEventLogger', () => {
|
||||
it('constructor should not crash', () => {
|
||||
const logger = new NoopEventLoggerProvider().getEventLogger('test-noop');
|
||||
assert.ok(logger instanceof NoopEventLogger);
|
||||
});
|
||||
|
||||
it('calling emit should not crash', () => {
|
||||
const logger = new NoopEventLoggerProvider().getEventLogger('test-noop');
|
||||
logger.emit({
|
||||
name: 'event name',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.esm.json",
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"outDir": "build/esm",
|
||||
"rootDir": "src",
|
||||
"target": "es2017",
|
||||
"tsBuildInfoFile": "build/esm/tsconfig.esm.tsbuildinfo"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../api"
|
||||
},
|
||||
{
|
||||
"path": "../api-logs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.esnext.json",
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"outDir": "build/esnext",
|
||||
"rootDir": "src",
|
||||
"target": "es2017",
|
||||
"tsBuildInfoFile": "build/esnext/tsconfig.esnext.tsbuildinfo"
|
||||
},
|
||||
"include": [
|
||||
"src/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../api"
|
||||
},
|
||||
{
|
||||
"path": "../api-logs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
{
|
||||
"extends": "../../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"lib": [
|
||||
"es2017",
|
||||
"dom"
|
||||
],
|
||||
"outDir": "build",
|
||||
"rootDir": ".",
|
||||
"target": "es2017"
|
||||
},
|
||||
"files": [],
|
||||
"include": [
|
||||
"src/**/*.ts",
|
||||
"test/**/*.ts"
|
||||
],
|
||||
"references": [
|
||||
{
|
||||
"path": "../../../api"
|
||||
},
|
||||
{
|
||||
"path": "../api-logs"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/api-logs",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "Public logs API for OpenTelemetry",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/api-logs --include-dependencies",
|
||||
"prewatch": "node ../../../scripts/version-update.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
},
|
||||
|
|
@ -67,7 +67,6 @@
|
|||
"@types/node": "^8.10.66",
|
||||
"@types/webpack-env": "1.16.3",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
|
|
@ -77,9 +76,9 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9"
|
||||
"webpack": "5.101.3"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/api-logs",
|
||||
"sideEffects": false
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ export class ProxyLogger implements Logger {
|
|||
if (this._delegate) {
|
||||
return this._delegate;
|
||||
}
|
||||
const logger = this._provider.getDelegateLogger(
|
||||
const logger = this._provider._getDelegateLogger(
|
||||
this.name,
|
||||
this.version,
|
||||
this.options
|
||||
|
|
@ -61,7 +61,7 @@ export class ProxyLogger implements Logger {
|
|||
}
|
||||
|
||||
export interface LoggerDelegator {
|
||||
getDelegateLogger(
|
||||
_getDelegateLogger(
|
||||
name: string,
|
||||
version?: string,
|
||||
options?: LoggerOptions
|
||||
|
|
|
|||
|
|
@ -29,23 +29,32 @@ export class ProxyLoggerProvider implements LoggerProvider {
|
|||
options?: LoggerOptions | undefined
|
||||
): Logger {
|
||||
return (
|
||||
this.getDelegateLogger(name, version, options) ??
|
||||
this._getDelegateLogger(name, version, options) ??
|
||||
new ProxyLogger(this, name, version, options)
|
||||
);
|
||||
}
|
||||
|
||||
getDelegate(): LoggerProvider {
|
||||
/**
|
||||
* Get the delegate logger provider.
|
||||
* Used by tests only.
|
||||
* @internal
|
||||
*/
|
||||
_getDelegate(): LoggerProvider {
|
||||
return this._delegate ?? NOOP_LOGGER_PROVIDER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the delegate logger provider
|
||||
* @internal
|
||||
*/
|
||||
setDelegate(delegate: LoggerProvider) {
|
||||
_setDelegate(delegate: LoggerProvider) {
|
||||
this._delegate = delegate;
|
||||
}
|
||||
|
||||
getDelegateLogger(
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
_getDelegateLogger(
|
||||
name: string,
|
||||
version?: string | undefined,
|
||||
options?: LoggerOptions | undefined
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ export class LogsAPI {
|
|||
provider,
|
||||
NOOP_LOGGER_PROVIDER
|
||||
);
|
||||
this._proxyLoggerProvider.setDelegate(provider);
|
||||
this._proxyLoggerProvider._setDelegate(provider);
|
||||
|
||||
return provider;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins, no-undef
|
||||
// eslint-disable-next-line n/no-unsupported-features/es-builtins, no-undef
|
||||
export const _globalThis: typeof globalThis =
|
||||
typeof globalThis === 'object'
|
||||
? globalThis
|
||||
|
|
|
|||
|
|
@ -15,5 +15,5 @@
|
|||
*/
|
||||
|
||||
/** only globals that common to node and browsers are allowed */
|
||||
// eslint-disable-next-line node/no-unsupported-features/es-builtins
|
||||
// eslint-disable-next-line n/no-unsupported-features/es-builtins
|
||||
export const _globalThis = typeof globalThis === 'object' ? globalThis : global;
|
||||
|
|
|
|||
|
|
@ -25,8 +25,9 @@ describe('API', () => {
|
|||
it('should expose a logger provider via getLoggerProvider', () => {
|
||||
assert.ok(logs.getLoggerProvider() instanceof ProxyLoggerProvider);
|
||||
assert.ok(
|
||||
(logs.getLoggerProvider() as ProxyLoggerProvider).getDelegate() instanceof
|
||||
NoopLoggerProvider
|
||||
(
|
||||
logs.getLoggerProvider() as ProxyLoggerProvider
|
||||
)._getDelegate() instanceof NoopLoggerProvider
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ describe('ProxyLogger', () => {
|
|||
delegate = {
|
||||
getLogger: getLoggerStub,
|
||||
};
|
||||
provider.setDelegate(delegate);
|
||||
provider._setDelegate(delegate);
|
||||
});
|
||||
|
||||
it('should return loggers directly from the delegate', () => {
|
||||
|
|
@ -104,7 +104,7 @@ describe('ProxyLogger', () => {
|
|||
return delegateLogger;
|
||||
},
|
||||
};
|
||||
provider.setDelegate(delegateProvider);
|
||||
provider._setDelegate(delegateProvider);
|
||||
});
|
||||
|
||||
it('should emit from the delegate logger', () => {
|
||||
|
|
|
|||
|
|
@ -39,11 +39,9 @@ const collectorOptions = {
|
|||
};
|
||||
|
||||
const loggerExporter = new OTLPLogExporter(collectorOptions);
|
||||
const loggerProvider = new LoggerProvider();
|
||||
|
||||
loggerProvider.addLogRecordProcessor(
|
||||
new BatchLogRecordProcessor(loggerExporter)
|
||||
);
|
||||
const loggerProvider = new LoggerProvider({
|
||||
processors: [new BatchRecordProcessor(loggerExporter)]
|
||||
});
|
||||
|
||||
['SIGINT', 'SIGTERM'].forEach(signal => {
|
||||
process.on(signal, () => loggerProvider.shutdown().catch(console.error));
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-logs-otlp-grpc",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Exporter allows user to send collected log records to the OpenTelemetry Collector",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"test": "nyc mocha 'test/**/*.test.ts'",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --watch --build",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/exporter-logs-otlp-grpc --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -50,17 +50,16 @@
|
|||
"devDependencies": {
|
||||
"@grpc/proto-loader": "^0.7.10",
|
||||
"@opentelemetry/api": "1.9.0",
|
||||
"@opentelemetry/api-logs": "0.202.0",
|
||||
"@opentelemetry/api-logs": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@types/mocha": "10.0.10",
|
||||
"@types/node": "18.6.5",
|
||||
"@types/sinon": "17.0.4",
|
||||
"cross-var": "1.1.0",
|
||||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
@ -69,10 +68,10 @@
|
|||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.7.1",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-grpc-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/sdk-logs": "0.202.0"
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-grpc-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/sdk-logs": "0.203.0"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-grpc",
|
||||
"sideEffects": false
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ const collectorOptions = {
|
|||
concurrencyLimit: 1, // an optional limit on pending requests
|
||||
};
|
||||
const logExporter = new OTLPLogExporter(collectorOptions);
|
||||
const loggerProvider = new LoggerProvider();
|
||||
|
||||
loggerProvider.addLogRecordProcessor(new BatchLogRecordProcessor(logExporter));
|
||||
const loggerProvider = new LoggerProvider({
|
||||
processors: [new BatchRecordProcessor(logExporter)]
|
||||
});
|
||||
|
||||
const logger = loggerProvider.getLogger('default', '1.0.0');
|
||||
// Emit a log
|
||||
|
|
@ -66,9 +66,9 @@ const collectorOptions = {
|
|||
concurrencyLimit: 1, // an optional limit on pending requests
|
||||
};
|
||||
const logExporter = new OTLPLogExporter(collectorOptions);
|
||||
const loggerProvider = new LoggerProvider();
|
||||
|
||||
loggerProvider.addLogRecordProcessor(new BatchLogRecordProcessor(logExporter));
|
||||
const loggerProvider = new LoggerProvider({
|
||||
processors: [new BatchRecordProcessor(logExporter)]
|
||||
});
|
||||
|
||||
const logger = loggerProvider.getLogger('default', '1.0.0');
|
||||
// Emit a log
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-logs-otlp-http",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
"test:browser": "karma start --single-run",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/exporter-logs-otlp-http --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -80,7 +80,6 @@
|
|||
"@types/webpack-env": "1.16.3",
|
||||
"babel-loader": "10.0.0",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
|
|
@ -91,19 +90,19 @@
|
|||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
"webpack": "5.101.3",
|
||||
"webpack-cli": "6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api-logs": "0.202.0",
|
||||
"@opentelemetry/api-logs": "0.203.0",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/sdk-logs": "0.202.0"
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/sdk-logs": "0.203.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,9 +31,11 @@ const collectorOptions = {
|
|||
}, //an optional object containing custom headers to be sent with each request will only work with http
|
||||
};
|
||||
|
||||
const logProvider = new LoggerProvider({resource: resourceFromAttributes({'service.name': 'testApp'})});
|
||||
const logExporter = new OTLPLogExporter(collectorOptions);
|
||||
logProvider.addLogRecordProcessor(new SimpleLogRecordProcessor(exporter));
|
||||
const logProvider = new LoggerProvider({
|
||||
resource: resourceFromAttributes({'service.name': 'testApp'}),
|
||||
processors: [new SimpleLogRecordProcessor(logExporter)]
|
||||
});
|
||||
|
||||
const logger = logProvider.getLogger('test_log_instrumentation');
|
||||
|
||||
|
|
@ -50,10 +52,10 @@ To override the default timeout duration, use the following options:
|
|||
|
||||
- Set with environment variables:
|
||||
|
||||
| Environment variable | Description |
|
||||
------------------------------|----------------------|-------------|
|
||||
| OTEL_EXPORTER_OTLP_LOGS_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace batch. Default is 10000. |
|
||||
| OTEL_EXPORTER_OTLP_TIMEOUT | The maximum waiting time, in milliseconds, allowed to send each OTLP trace and metric batch. Default is 10000. |
|
||||
| Environment variable | Description |
|
||||
|-----------------------------------|-------------|
|
||||
| `OTEL_EXPORTER_OTLP_LOGS_TIMEOUT` | The maximum waiting time, in milliseconds, allowed to send each OTLP trace batch. Default is 10000. |
|
||||
| `OTEL_EXPORTER_OTLP_TIMEOUT` | The maximum waiting time, in milliseconds, allowed to send each OTLP trace and metric batch. Default is 10000. |
|
||||
|
||||
> `OTEL_EXPORTER_OTLP_LOGS_TIMEOUT` takes precedence and overrides `OTEL_EXPORTER_OTLP_TIMEOUT`.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-logs-otlp-proto",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "An OTLP exporter to send logs using protobuf over HTTP",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
"test:browser": "karma start --single-run",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/exporter-logs-otlp-proto --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -70,7 +70,6 @@
|
|||
"@types/node": "18.6.5",
|
||||
"@types/sinon": "17.0.4",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
|
|
@ -81,21 +80,21 @@
|
|||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
"webpack": "5.101.3",
|
||||
"webpack-cli": "6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api-logs": "0.202.0",
|
||||
"@opentelemetry/api-logs": "0.203.0",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-logs": "0.202.0",
|
||||
"@opentelemetry/sdk-logs": "0.203.0",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/exporter-logs-otlp-proto",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-trace-otlp-grpc",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
"test": "nyc mocha 'test/**/*.test.ts'",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --watch --build",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/exporter-trace-otlp-grpc --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -52,12 +52,11 @@
|
|||
"@types/mocha": "10.0.10",
|
||||
"@types/node": "18.6.5",
|
||||
"@types/sinon": "17.0.4",
|
||||
"cross-var": "1.1.0",
|
||||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
@ -66,9 +65,9 @@
|
|||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.7.1",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-grpc-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-grpc-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-trace-otlp-http",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Trace Exporter allows user to send collected traces to the OpenTelemetry Collector",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
"test:browser": "karma start --single-run",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/exporter-trace-otlp-http --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -71,7 +71,6 @@
|
|||
"@types/webpack-env": "1.16.3",
|
||||
"babel-loader": "10.0.0",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
|
|
@ -82,9 +81,9 @@
|
|||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
"webpack": "5.101.3",
|
||||
"webpack-cli": "6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
@ -92,8 +91,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-trace-otlp-proto",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Exporter allows user to send collected traces to the OpenTelemetry Collector using protobuf over HTTP",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
|
@ -24,7 +24,7 @@
|
|||
"test:browser": "karma start --single-run",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/exporter-trace-otlp-proto --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -69,7 +69,6 @@
|
|||
"@types/node": "18.6.5",
|
||||
"@types/sinon": "17.0.4",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
|
|
@ -80,9 +79,9 @@
|
|||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
"webpack": "5.101.3",
|
||||
"webpack-cli": "6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
@ -90,8 +89,8 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-trace-base": "2.0.1"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/opentelemetry-browser-detector",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Resource Detector for Browser",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
"tdd:browser": "karma start",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch tsconfig.json tsconfig.esm.json tsconfig.esnext.json",
|
||||
"precompile": "cross-var lerna run version --scope $npm_package_name --include-dependencies",
|
||||
"precompile": "lerna run version --scope @opentelemetry/opentelemetry-browser-detector --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
|
|
@ -60,7 +60,6 @@
|
|||
"@types/node": "18.6.5",
|
||||
"@types/sinon": "17.0.4",
|
||||
"babel-plugin-istanbul": "7.0.0",
|
||||
"cross-var": "1.1.0",
|
||||
"karma": "6.4.4",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-coverage": "2.2.1",
|
||||
|
|
@ -71,9 +70,9 @@
|
|||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
"webpack": "5.101.3",
|
||||
"webpack-cli": "6.0.1"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
@ -83,4 +82,4 @@
|
|||
"@opentelemetry/resources": "2.0.1"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/browser-detector"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"mocha": true,
|
||||
"node": true
|
||||
},
|
||||
...require('../../../eslint.base.js')
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
# OpenTelemetry SDK for Node.js
|
||||
|
||||
[![Apache License][license-image]][license-image]
|
||||
|
||||
**Note: This is an experimental package under active development. New releases may include breaking changes.**
|
||||
|
||||
This package provides the configuration for OpenTelemetry JavaScript SDK.
|
||||
|
||||
## Quick Start
|
||||
|
||||
**Note: Much of OpenTelemetry JS documentation is written assuming the compiled application is run as CommonJS.**
|
||||
For more details on ECMAScript Modules vs CommonJS, refer to [esm-support](https://github.com/open-telemetry/opentelemetry-js/blob/main/doc/esm-support.md).
|
||||
|
||||
To get started you need to install `@opentelemetry/configuration`.
|
||||
|
||||
### Installation
|
||||
|
||||
```sh
|
||||
# Install the package
|
||||
npm install @opentelemetry/configuration
|
||||
```
|
||||
|
||||
## Useful links
|
||||
|
||||
- For more information on OpenTelemetry, visit: <https://opentelemetry.io/>
|
||||
- For more about OpenTelemetry JavaScript: <https://github.com/open-telemetry/opentelemetry-js>
|
||||
- For help or feedback on this project, join us in [GitHub Discussions][discussions-url]
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0 - See [LICENSE][license-url] for more information.
|
||||
|
||||
[discussions-url]: https://github.com/open-telemetry/opentelemetry-js/discussions
|
||||
[license-url]: https://github.com/open-telemetry/opentelemetry-js/blob/main/LICENSE
|
||||
[license-image]: https://img.shields.io/badge/license-Apache_2.0-green.svg?style=flat
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "@opentelemetry/configuration",
|
||||
"private": true,
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Configuration",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
"repository": "open-telemetry/opentelemetry-js",
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm run compile",
|
||||
"compile": "tsc --build",
|
||||
"clean": "tsc --build --clean",
|
||||
"test": "nyc mocha test/**/*.test.ts",
|
||||
"lint": "eslint . --ext .ts",
|
||||
"lint:fix": "eslint . --ext .ts --fix",
|
||||
"version": "node ../../../scripts/version-update.js",
|
||||
"watch": "tsc --build --watch",
|
||||
"precompile": "lerna run version --scope @opentelemetry/configuration --include-dependencies",
|
||||
"prewatch": "npm run precompile",
|
||||
"peer-api-check": "node ../../../scripts/peer-api-check.js",
|
||||
"align-api-deps": "node ../../../scripts/align-api-deps.js"
|
||||
},
|
||||
"keywords": [
|
||||
"opentelemetry",
|
||||
"configuration"
|
||||
],
|
||||
"author": "OpenTelemetry Authors",
|
||||
"license": "Apache-2.0",
|
||||
"engines": {
|
||||
"node": "^18.19.0 || >=20.6.0"
|
||||
},
|
||||
"files": [
|
||||
"build/src/**/*.js",
|
||||
"build/src/**/*.js.map",
|
||||
"build/src/**/*.d.ts",
|
||||
"LICENSE",
|
||||
"README.md"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@opentelemetry/core": "^2.0.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@opentelemetry/api": "^1.9.0",
|
||||
"@types/mocha": "10.0.10",
|
||||
"@types/node": "18.6.5",
|
||||
"@types/sinon": "17.0.4",
|
||||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.4",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-configuration",
|
||||
"sideEffects": false
|
||||
}
|
||||
|
|
@ -14,9 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { EventLogger } from './types/EventLogger';
|
||||
import { Event } from './types/Event';
|
||||
import { ConfigProvider } from './IConfigProvider';
|
||||
import { EnvironmentConfigProvider } from './EnvironmentConfigProvider';
|
||||
import { FileConfigProvider, hasValidConfigFile } from './FileConfigProvider';
|
||||
|
||||
export class NoopEventLogger implements EventLogger {
|
||||
emit(_event: Event): void {}
|
||||
export function createConfigProvider(): ConfigProvider {
|
||||
if (hasValidConfigFile()) {
|
||||
return new FileConfigProvider();
|
||||
}
|
||||
return new EnvironmentConfigProvider();
|
||||
}
|
||||
|
|
@ -0,0 +1,62 @@
|
|||
/*
|
||||
* 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 { DiagLogLevel } from '@opentelemetry/api';
|
||||
import {
|
||||
ConfigurationModel,
|
||||
initializeDefaultConfiguration,
|
||||
} from './configModel';
|
||||
import {
|
||||
getBooleanFromEnv,
|
||||
getStringFromEnv,
|
||||
getStringListFromEnv,
|
||||
diagLogLevelFromString,
|
||||
} from '@opentelemetry/core';
|
||||
import { ConfigProvider } from './IConfigProvider';
|
||||
|
||||
/**
|
||||
* EnvironmentConfigProvider provides a configuration based on environment variables.
|
||||
*/
|
||||
export class EnvironmentConfigProvider implements ConfigProvider {
|
||||
private _config: ConfigurationModel;
|
||||
|
||||
constructor() {
|
||||
this._config = initializeDefaultConfiguration();
|
||||
this._config.disable = getBooleanFromEnv('OTEL_SDK_DISABLED');
|
||||
|
||||
const logLevel = getStringFromEnv('OTEL_LOG_LEVEL');
|
||||
if (logLevel) {
|
||||
this._config.log_level =
|
||||
diagLogLevelFromString(logLevel) ?? DiagLogLevel.INFO;
|
||||
}
|
||||
|
||||
const nodeResourceDetectors = getStringListFromEnv(
|
||||
'OTEL_NODE_RESOURCE_DETECTORS'
|
||||
);
|
||||
if (nodeResourceDetectors) {
|
||||
this._config.node_resource_detectors = nodeResourceDetectors;
|
||||
}
|
||||
|
||||
const resourceAttrList = getStringFromEnv('OTEL_RESOURCE_ATTRIBUTES');
|
||||
if (resourceAttrList) {
|
||||
this._config.resource.attributes_list = resourceAttrList;
|
||||
}
|
||||
}
|
||||
|
||||
getInstrumentationConfig(): ConfigurationModel {
|
||||
return this._config;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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 { getStringFromEnv } from '@opentelemetry/core';
|
||||
import {
|
||||
ConfigurationModel,
|
||||
initializeDefaultConfiguration,
|
||||
} from './configModel';
|
||||
import { ConfigProvider } from './IConfigProvider';
|
||||
import * as fs from 'fs';
|
||||
|
||||
export class FileConfigProvider implements ConfigProvider {
|
||||
private _config: ConfigurationModel;
|
||||
|
||||
constructor() {
|
||||
this._config = initializeDefaultConfiguration();
|
||||
}
|
||||
|
||||
getInstrumentationConfig(): ConfigurationModel {
|
||||
return this._config;
|
||||
}
|
||||
}
|
||||
|
||||
export function hasValidConfigFile(): boolean {
|
||||
const configFile = getStringFromEnv('OTEL_EXPERIMENTAL_CONFIG_FILE');
|
||||
if (configFile) {
|
||||
if (!configFile.endsWith('.yaml') || !fs.existsSync(configFile)) {
|
||||
throw new Error(
|
||||
`Config file ${configFile} set on OTEL_EXPERIMENTAL_CONFIG_FILE is not valid`
|
||||
);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -14,13 +14,13 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Event } from './Event';
|
||||
import { ConfigurationModel } from './configModel';
|
||||
|
||||
export interface EventLogger {
|
||||
export interface ConfigProvider {
|
||||
/**
|
||||
* Emit an event. This method should only be used by instrumentations emitting events.
|
||||
* Returns a ConfigurationModel, used for instrumentation configuration
|
||||
*
|
||||
* @param event
|
||||
* @returns ConfigurationModel a Configuration Model with all configuration attributes
|
||||
*/
|
||||
emit(event: Event): void;
|
||||
getInstrumentationConfig(): ConfigurationModel;
|
||||
}
|
||||
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* 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.
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
import { DiagLogLevel } from '@opentelemetry/api';
|
||||
export interface ConfigurationModel {
|
||||
/**
|
||||
* Configure if the SDK is disabled or not.
|
||||
* If omitted or null, false is used.
|
||||
*/
|
||||
disable: boolean;
|
||||
|
||||
/**
|
||||
* Configure the log level of the internal logger used by the SDK.
|
||||
* If omitted, info is used.
|
||||
*/
|
||||
log_level: number;
|
||||
|
||||
/**
|
||||
* Node resource detectors
|
||||
* If omitted, all is used.
|
||||
*/
|
||||
node_resource_detectors: string[];
|
||||
|
||||
/**
|
||||
* Configure resource for all signals.
|
||||
* If omitted, the default resource is used.
|
||||
*/
|
||||
resource: ConfigResources;
|
||||
}
|
||||
|
||||
export function initializeDefaultConfiguration(): ConfigurationModel {
|
||||
const config: ConfigurationModel = {
|
||||
disable: false,
|
||||
log_level: DiagLogLevel.INFO,
|
||||
node_resource_detectors: ['all'],
|
||||
resource: {},
|
||||
};
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
export interface ConfigAttributes {
|
||||
name: string;
|
||||
value: string | boolean | number | string[] | boolean[] | number[];
|
||||
type?:
|
||||
| 'string'
|
||||
| 'bool'
|
||||
| 'int'
|
||||
| 'double'
|
||||
| 'string_array'
|
||||
| 'bool_array'
|
||||
| 'int_array'
|
||||
| 'double_array';
|
||||
}
|
||||
|
||||
export interface ConfigResources {
|
||||
/**
|
||||
* Configure resource attributes. Entries have higher priority than entries from .resource.attributes_list.
|
||||
* Entries must contain .name and .value, and may optionally include .type. If an entry's .type omitted or null, string is used.
|
||||
* The .value's type must match the .type. Values for .type include: string, bool, int, double, string_array, bool_array, int_array, double_array.
|
||||
*/
|
||||
attributes?: ConfigAttributes[];
|
||||
|
||||
/**
|
||||
* Configure resource attributes. Entries have lower priority than entries from .resource.attributes.
|
||||
* The value is a list of comma separated key-value pairs matching the format of OTEL_RESOURCE_ATTRIBUTES.
|
||||
* If omitted or null, no resource attributes are added.
|
||||
*/
|
||||
attributes_list?: string;
|
||||
|
||||
/**
|
||||
* Configure resource schema URL.
|
||||
* If omitted or null, no schema URL is used.
|
||||
*/
|
||||
schema_url?: string;
|
||||
}
|
||||
|
|
@ -14,4 +14,6 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
export { _globalThis } from './globalThis';
|
||||
export { EnvironmentConfigProvider } from './EnvironmentConfigProvider';
|
||||
export type { ConfigProvider } from './IConfigProvider';
|
||||
export type { ConfigurationModel as Configuration } from './configModel';
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue