Compare commits
31 Commits
experiment
...
main
Author | SHA1 | Date |
---|---|---|
|
99dde7786f | |
|
287d46353d | |
|
8e1fc80d1a | |
|
1537d405fe | |
|
06330cebbb | |
|
41ba7f57cb | |
|
a0618ad0c7 | |
|
2c7037662c | |
|
93187f0224 | |
|
ca6ae61783 | |
|
407c98a09f | |
|
27d5171890 | |
|
7a32f86055 | |
|
5c4057bb8d | |
|
553db87117 | |
|
74d434eecd | |
|
a59d707c42 | |
|
491ed96aca | |
|
e18a6c8456 | |
|
8505a6147e | |
|
04a8150d37 | |
|
ec17ce48d0 | |
|
f2cfd1327a | |
|
62fbfd3d0d | |
|
995d708729 | |
|
86bab66f32 | |
|
5b3c6b4e83 | |
|
a4e9645829 | |
|
7e30af4c15 | |
|
3578f68c74 | |
|
56df3c0346 |
|
@ -4,14 +4,19 @@ 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: equinix-bare-metal
|
||||
timeout-minutes: 10
|
||||
env:
|
||||
NPM_CONFIG_UNSAFE_PERM: true
|
||||
|
|
|
@ -10,6 +10,8 @@ on:
|
|||
branches:
|
||||
- main
|
||||
- next
|
||||
permissions:
|
||||
contents: read
|
||||
jobs:
|
||||
changelog:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -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,8 +6,13 @@ on:
|
|||
branches: [ main ]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
permissions:
|
||||
security-events: write
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,8 +4,13 @@ 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
|
||||
|
|
|
@ -5,6 +5,9 @@ on:
|
|||
branches: [main]
|
||||
pull_request:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
e2e-tests:
|
||||
strategy:
|
||||
|
|
|
@ -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,6 +7,9 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -7,6 +7,9 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
peer-api-check:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -3,6 +3,9 @@ name: Publish packages to NPM
|
|||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
release-to-npm:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -6,6 +6,9 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
node-tests:
|
||||
strategy:
|
||||
|
|
|
@ -7,6 +7,9 @@ on:
|
|||
pull_request:
|
||||
merge_group:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
build-and-test:
|
||||
runs-on: ubuntu-latest
|
||||
|
|
|
@ -16,6 +16,8 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
|
|||
|
||||
### :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
|
||||
|
|
54
README.md
54
README.md
|
@ -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
|
||||
|
@ -146,7 +146,7 @@ This minimum support level is subject to change as the project evolves and as th
|
|||
## TypeScript Support
|
||||
|
||||
OpenTelemetry JavaScript is built with TypeScript `v5.0.4`. If you have a TypeScript project (app, library, instrumentation, etc.)
|
||||
that depends on it we recomed using same or higher version to compile the project.
|
||||
that depends on it, we recommend using same or higher version to compile the project.
|
||||
|
||||
OpenTelemetry JavaScript will follows DefinitelyType's [support policy for TypeScript](https://github.com/DefinitelyTyped/DefinitelyTyped#support-window) which sets a support window of 2 years. Support for TypeScript versions older than 2 years will be dropped in minor releases of OpenTelemetry JavaScript.
|
||||
|
||||
|
@ -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,6 +9,9 @@ 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)
|
||||
|
||||
### :books: (Refine Doc)
|
||||
|
|
|
@ -92,7 +92,7 @@
|
|||
"memfs": "3.5.3",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"unionfs": "4.5.4",
|
||||
|
|
|
@ -33,23 +33,23 @@ export class DiagComponentLogger implements DiagLogger {
|
|||
this._namespace = props.namespace || 'DiagComponentLogger';
|
||||
}
|
||||
|
||||
public debug(...args: any[]): void {
|
||||
public debug(...args: unknown[]): void {
|
||||
return logProxy('debug', this._namespace, args);
|
||||
}
|
||||
|
||||
public error(...args: any[]): void {
|
||||
public error(...args: unknown[]): void {
|
||||
return logProxy('error', this._namespace, args);
|
||||
}
|
||||
|
||||
public info(...args: any[]): void {
|
||||
public info(...args: unknown[]): void {
|
||||
return logProxy('info', this._namespace, args);
|
||||
}
|
||||
|
||||
public warn(...args: any[]): void {
|
||||
public warn(...args: unknown[]): void {
|
||||
return logProxy('warn', this._namespace, args);
|
||||
}
|
||||
|
||||
public verbose(...args: any[]): void {
|
||||
public verbose(...args: unknown[]): void {
|
||||
return logProxy('verbose', this._namespace, args);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ export class DiagComponentLogger implements DiagLogger {
|
|||
function logProxy(
|
||||
funcName: keyof DiagLogger,
|
||||
namespace: string,
|
||||
args: any
|
||||
args: unknown[]
|
||||
): void {
|
||||
const logger = getGlobal('diag');
|
||||
// shortcut if logger not set
|
||||
|
|
|
@ -29,6 +29,7 @@ import { Context } from '../context/types';
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface TextMapPropagator<Carrier = any> {
|
||||
/**
|
||||
* Injects values from a given `Context` into a carrier.
|
||||
|
@ -79,6 +80,7 @@ export interface TextMapPropagator<Carrier = any> {
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface TextMapSetter<Carrier = any> {
|
||||
/**
|
||||
* Callback used to set a key/value pair on an object.
|
||||
|
@ -99,6 +101,7 @@ export interface TextMapSetter<Carrier = any> {
|
|||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface TextMapGetter<Carrier = any> {
|
||||
/**
|
||||
* Get a list of all keys available on the carrier.
|
||||
|
|
|
@ -99,11 +99,15 @@ export class NoopTracer implements Tracer {
|
|||
}
|
||||
}
|
||||
|
||||
function isSpanContext(spanContext: any): spanContext is SpanContext {
|
||||
function isSpanContext(spanContext: unknown): spanContext is SpanContext {
|
||||
return (
|
||||
spanContext !== null &&
|
||||
typeof spanContext === 'object' &&
|
||||
'spanId' in spanContext &&
|
||||
typeof spanContext['spanId'] === 'string' &&
|
||||
'traceId' in spanContext &&
|
||||
typeof spanContext['traceId'] === 'string' &&
|
||||
'traceFlags' in spanContext &&
|
||||
typeof spanContext['traceFlags'] === 'number'
|
||||
);
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ async function main() {
|
|||
severityText: 'INFO',
|
||||
body: 'test-log-body',
|
||||
attributes: { foo: 'bar' },
|
||||
eventName: 'test-log-event',
|
||||
});
|
||||
|
||||
// flushes exporters and shuts down the SDK
|
||||
|
|
|
@ -94,4 +94,11 @@ function verifyLog(log) {
|
|||
);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (log.eventName !== 'test-log-event') {
|
||||
console.error(
|
||||
`Expected log event name 'test-log-event', but got '${log.eventName}'`
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ module.exports = {
|
|||
// Enable typescript-eslint for ts files.
|
||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
|
||||
parserOptions: {
|
||||
"project": "./tsconfig.json"
|
||||
"projectService": true
|
||||
},
|
||||
rules: {
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
|
@ -49,11 +49,7 @@ module.exports = {
|
|||
"@typescript-eslint/no-unused-vars": ["error", {"argsIgnorePattern": "^_", "args": "after-used"}],
|
||||
"@typescript-eslint/no-inferrable-types": ["error", { ignoreProperties: true }],
|
||||
"@typescript-eslint/no-empty-function": ["off"],
|
||||
"@typescript-eslint/ban-types": ["warn", {
|
||||
"types": {
|
||||
"Function": null,
|
||||
}
|
||||
}],
|
||||
"@typescript-eslint/no-unsafe-function-type": ["warn"],
|
||||
"@typescript-eslint/no-shadow": ["warn"],
|
||||
"no-restricted-syntax": ["error", "ExportAllDeclaration"],
|
||||
"prefer-rest-params": "off",
|
||||
|
@ -64,20 +60,16 @@ module.exports = {
|
|||
// Enable typescript-eslint for ts files.
|
||||
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended", "plugin:prettier/recommended"],
|
||||
parserOptions: {
|
||||
"project": "./tsconfig.json"
|
||||
"projectService": true
|
||||
},
|
||||
rules: {
|
||||
"no-empty": "off",
|
||||
"@typescript-eslint/ban-ts-ignore": "off",
|
||||
"@typescript-eslint/ban-types": ["warn", {
|
||||
"types": {
|
||||
"Function": null,
|
||||
}
|
||||
}],
|
||||
"@typescript-eslint/no-unsafe-function-type": ["warn"],
|
||||
"@typescript-eslint/no-empty-function": "off",
|
||||
"@typescript-eslint/no-explicit-any": "off",
|
||||
"@typescript-eslint/no-unused-vars": "off",
|
||||
"@typescript-eslint/no-var-requires": "off",
|
||||
"@typescript-eslint/no-require-imports": "off",
|
||||
"@typescript-eslint/no-shadow": ["off"],
|
||||
"@typescript-eslint/no-floating-promises": ["off"],
|
||||
"@typescript-eslint/no-non-null-assertion": ["off"],
|
||||
|
|
|
@ -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-----
|
||||
MIIDozCCAougAwIBAgIUNmVva8tI/hqzZAB7FZzPmNr/Q0owDQYJKoZIhvcNAQEL
|
||||
MIIDozCCAougAwIBAgIUSgl/41WVVQuOs+hRNN6Bj2FD498wDQYJKoZIhvcNAQEL
|
||||
BQAwYTELMAkGA1UEBhMCQ0wxCzAJBgNVBAgMAlJNMRowGAYDVQQHDBFPcGVuVGVs
|
||||
ZW1ldHJ5VGVzdDENMAsGA1UECgwEUm9vdDENMAsGA1UECwwEVGVzdDELMAkGA1UE
|
||||
AwwCY2EwHhcNMjQwNjA4MTkxODUyWhcNMzQwNjA2MTkxODUyWjBhMQswCQYDVQQG
|
||||
AwwCY2EwHhcNMjUwNjExMTgyMDIxWhcNMzUwNjA5MTgyMDIxWjBhMQswCQYDVQQG
|
||||
EwJDTDELMAkGA1UECAwCUk0xGjAYBgNVBAcMEU9wZW5UZWxlbWV0cnlUZXN0MQ0w
|
||||
CwYDVQQKDARSb290MQ0wCwYDVQQLDARUZXN0MQswCQYDVQQDDAJjYTCCASIwDQYJ
|
||||
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAM80Psz6Kc4/x1Qx4OmYuacrCDL4JNY+
|
||||
SWzEm1kb25/E1+TrxYC8XluJtXwi9JRC7ovR8UIbZNVgWwPHlSXrTQsVe2sISr4K
|
||||
oRg87vmcRYzsOval+ZViFelUo9t5sYeiX0xBuMP1ENfEL+gtu2QrkmgDhy/XdRpm
|
||||
qpcrtJxXaIXedy82y7Av5da7jJyJ+9oaTq0Am0qyZjpzTs3jKEh1roWoc3pd6T4d
|
||||
asNHLeKrsq3bTasEH/Lo9k4t+2n1j5C+L5gWhPcCv8yzhGsrSiqxn+P9m/USXY/w
|
||||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UvZazdPwgW3Qo7mu4+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",
|
||||
|
|
|
@ -16,12 +16,27 @@ For notes on migrating to 2.x / 0.200.x see [the upgrade guide](doc/upgrade-to-2
|
|||
|
||||
### :house: Internal
|
||||
|
||||
## 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
|
||||
|
||||
* feat(exporter-otlp-\*): update proto to `v1.7.0`
|
||||
* feat(exporter-metrics-otlp-proto): Support to protobuf in browser metrics. [#5710](https://github.com/open-telemetry/opentelemetry-js/pull/5710) @YangJonghun
|
||||
* feat(logs): add eventName to emit [#5707](https://github.com/open-telemetry/opentelemetry-js/pull/5707)
|
||||
|
||||
### :bug: Bug Fixes
|
||||
|
||||
|
|
|
@ -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 +0,0 @@
|
|||
build
|
|
@ -1,8 +0,0 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"mocha": true,
|
||||
"commonjs": true,
|
||||
"shared-node-browser": true
|
||||
},
|
||||
...require('../../../eslint.base.js')
|
||||
}
|
|
@ -1,201 +0,0 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
|
@ -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,22 +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 './types/EventLogger';
|
||||
import { Event } from './types/Event';
|
||||
|
||||
export class NoopEventLogger implements EventLogger {
|
||||
emit(_event: Event): void {}
|
||||
}
|
|
@ -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,23 +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 type { EventLogger } from './types/EventLogger';
|
||||
export type { EventLoggerProvider } from './types/EventLoggerProvider';
|
||||
export type { Event } from './types/Event';
|
||||
export type { EventLoggerOptions } from './types/EventLoggerOptions';
|
||||
|
||||
import { EventsAPI } from './api/events';
|
||||
export const events = EventsAPI.getInstance();
|
|
@ -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,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,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,26 +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 { Event } from './Event';
|
||||
|
||||
export interface EventLogger {
|
||||
/**
|
||||
* Emit an event. This method should only be used by instrumentations emitting events.
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
emit(event: Event): void;
|
||||
}
|
|
@ -1,30 +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 } from '@opentelemetry/api';
|
||||
|
||||
export interface EventLoggerOptions {
|
||||
/**
|
||||
* The schemaUrl of the tracer or instrumentation library
|
||||
* @default ''
|
||||
*/
|
||||
schemaUrl?: string;
|
||||
|
||||
/**
|
||||
* The instrumentation scope attributes to associate with emitted telemetry
|
||||
*/
|
||||
scopeAttributes?: Attributes;
|
||||
}
|
|
@ -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",
|
||||
|
|
|
@ -49,6 +49,11 @@ export enum SeverityNumber {
|
|||
}
|
||||
|
||||
export interface LogRecord {
|
||||
/**
|
||||
* The unique identifier for the log record.
|
||||
*/
|
||||
eventName?: string;
|
||||
|
||||
/**
|
||||
* The time when the log record occurred as UNIX Epoch time in nanoseconds.
|
||||
*/
|
||||
|
|
|
@ -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",
|
||||
|
@ -50,7 +50,7 @@
|
|||
"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",
|
||||
|
@ -59,7 +59,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
|
@ -69,10 +69,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"
|
||||
},
|
||||
|
@ -90,7 +90,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -100,10 +100,10 @@
|
|||
"@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",
|
||||
|
@ -80,7 +80,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -90,12 +90,12 @@
|
|||
"@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",
|
||||
|
@ -56,7 +56,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
|
@ -66,9 +66,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",
|
||||
|
@ -81,7 +81,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -92,8 +92,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",
|
||||
|
@ -79,7 +79,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -90,8 +90,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",
|
||||
|
@ -70,7 +70,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-grpc",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
@ -56,7 +56,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
|
@ -66,10 +66,10 @@
|
|||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.7.1",
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.202.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-grpc-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.203.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-metrics": "2.0.1"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-http",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
@ -81,7 +81,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -92,8 +92,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-metrics": "2.0.1"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-metrics-otlp-proto",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Collector Metrics Exporter allows user to send collected metrics to the OpenTelemetry Collector using protobuf over HTTP",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
@ -81,7 +81,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -92,9 +92,9 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.202.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.202.0",
|
||||
"@opentelemetry/otlp-transformer": "0.202.0",
|
||||
"@opentelemetry/exporter-metrics-otlp-http": "0.203.0",
|
||||
"@opentelemetry/otlp-exporter-base": "0.203.0",
|
||||
"@opentelemetry/otlp-transformer": "0.203.0",
|
||||
"@opentelemetry/resources": "2.0.1",
|
||||
"@opentelemetry/sdk-metrics": "2.0.1"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/exporter-prometheus",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry Exporter Prometheus provides a metrics endpoint for Prometheus",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
@ -52,7 +52,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/instrumentation-fetch",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry instrumentation for fetch http client in web browsers",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
@ -77,7 +77,7 @@
|
|||
"mocha": "11.1.0",
|
||||
"msw": "2.8.4",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -88,7 +88,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/sdk-trace-web": "2.0.1",
|
||||
"@opentelemetry/semantic-conventions": "^1.29.0"
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/instrumentation-grpc",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry instrumentation for `@grpc/grpc-js` rpc client and server for gRPC framework",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
@ -64,14 +64,14 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@opentelemetry/api": "^1.3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.29.0"
|
||||
},
|
||||
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/packages/opentelemetry-instrumentation-grpc",
|
||||
|
|
|
@ -113,7 +113,7 @@ function serverStreamAndBidiHandler<RequestType, ResponseType>(
|
|||
// TODO: Investigate this call/signature – it was inherited from very old
|
||||
// code and the `this: {}` is highly suspicious, and likely isn't doing
|
||||
// anything useful. There is probably a more precise cast we can do here.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
return (original as Function).call({}, call);
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ function clientStreamAndUnaryHandler<RequestType, ResponseType>(
|
|||
// TODO: Investigate this call/signature – it was inherited from very old
|
||||
// code and the `this: {}` is highly suspicious, and likely isn't doing
|
||||
// anything useful. There is probably a more precise cast we can do here.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
return (original as Function).call({}, call, patchedCallback);
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ export function handleUntracedServerFunction<RequestType, ResponseType>(
|
|||
// TODO: Investigate this call/signature – it was inherited from very old
|
||||
// code and the `this: {}` is highly suspicious, and likely isn't doing
|
||||
// anything useful. There is probably a more precise cast we can do here.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
return (originalFunc as Function).call({}, call, callback);
|
||||
case 'serverStream':
|
||||
case 'server_stream':
|
||||
|
@ -228,7 +228,7 @@ export function handleUntracedServerFunction<RequestType, ResponseType>(
|
|||
// TODO: Investigate this call/signature – it was inherited from very old
|
||||
// code and the `this: {}` is highly suspicious, and likely isn't doing
|
||||
// anything useful. There is probably a more precise cast we can do here.
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
return (originalFunc as Function).call({}, call);
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -150,14 +150,16 @@ export async function startServer(proto: any, port: number) {
|
|||
|
||||
call.sendMetadata(serverMetadata);
|
||||
|
||||
call.request.num <= MAX_ERROR_STATUS
|
||||
? callback(
|
||||
getError(
|
||||
'Unary Method with Metadata Error',
|
||||
call.request.num
|
||||
) as ServiceError
|
||||
)
|
||||
: callback(null, { num: call.request.num });
|
||||
if (call.request.num <= MAX_ERROR_STATUS) {
|
||||
callback(
|
||||
getError(
|
||||
'Unary Method with Metadata Error',
|
||||
call.request.num
|
||||
) as ServiceError
|
||||
);
|
||||
} else {
|
||||
callback(null, { num: call.request.num });
|
||||
}
|
||||
},
|
||||
|
||||
// This method returns the request
|
||||
|
@ -165,11 +167,13 @@ export async function startServer(proto: any, port: number) {
|
|||
call: ServerUnaryCall<any, any>,
|
||||
callback: requestCallback<any>
|
||||
) {
|
||||
call.request.num <= MAX_ERROR_STATUS
|
||||
? callback(
|
||||
getError('Unary Method Error', call.request.num) as ServiceError
|
||||
)
|
||||
: callback(null, { num: call.request.num });
|
||||
if (call.request.num <= MAX_ERROR_STATUS) {
|
||||
callback(
|
||||
getError('Unary Method Error', call.request.num) as ServiceError
|
||||
);
|
||||
} else {
|
||||
callback(null, { num: call.request.num });
|
||||
}
|
||||
},
|
||||
|
||||
// This method returns the request
|
||||
|
@ -177,11 +181,13 @@ export async function startServer(proto: any, port: number) {
|
|||
call: ServerUnaryCall<any, any>,
|
||||
callback: requestCallback<any>
|
||||
) {
|
||||
call.request.num <= MAX_ERROR_STATUS
|
||||
? callback(
|
||||
getError('Unary Method Error', call.request.num) as ServiceError
|
||||
)
|
||||
: callback(null, { num: call.request.num });
|
||||
if (call.request.num <= MAX_ERROR_STATUS) {
|
||||
callback(
|
||||
getError('Unary Method Error', call.request.num) as ServiceError
|
||||
);
|
||||
} else {
|
||||
callback(null, { num: call.request.num });
|
||||
}
|
||||
},
|
||||
|
||||
// This method sums the requests
|
||||
|
@ -200,9 +206,11 @@ export async function startServer(proto: any, port: number) {
|
|||
}
|
||||
});
|
||||
call.on('end', () => {
|
||||
hasError
|
||||
? callback(getError('Client Stream Method Error', code) as any)
|
||||
: callback(null, { num: sum });
|
||||
if (hasError) {
|
||||
callback(getError('Client Stream Method Error', code) as any);
|
||||
} else {
|
||||
callback(null, { num: sum });
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/instrumentation-http",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry instrumentation for `node:http` and `node:https` http client and server modules",
|
||||
"main": "build/src/index.js",
|
||||
"types": "build/src/index.d.ts",
|
||||
|
@ -64,7 +64,7 @@
|
|||
"mocha": "11.1.0",
|
||||
"nock": "13.5.6",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"superagent": "10.1.1",
|
||||
"typescript": "5.0.4"
|
||||
},
|
||||
|
@ -73,7 +73,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/semantic-conventions": "^1.29.0",
|
||||
"forwarded-parse": "2.1.2"
|
||||
},
|
||||
|
|
|
@ -208,6 +208,7 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
|
|||
'http',
|
||||
['*'],
|
||||
(moduleExports: Http): Http => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const isESM = (moduleExports as any)[Symbol.toStringTag] === 'Module';
|
||||
if (!this.getConfig().disableOutgoingRequestInstrumentation) {
|
||||
const patchedRequest = this._wrap(
|
||||
|
@ -223,7 +224,9 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
|
|||
if (isESM) {
|
||||
// To handle `import http from 'http'`, which returns the default
|
||||
// export, we need to set `module.default.*`.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(moduleExports as any).default.request = patchedRequest;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(moduleExports as any).default.get = patchedGet;
|
||||
}
|
||||
}
|
||||
|
@ -255,6 +258,7 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
|
|||
'https',
|
||||
['*'],
|
||||
(moduleExports: Https): Https => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const isESM = (moduleExports as any)[Symbol.toStringTag] === 'Module';
|
||||
if (!this.getConfig().disableOutgoingRequestInstrumentation) {
|
||||
const patchedRequest = this._wrap(
|
||||
|
@ -270,7 +274,9 @@ export class HttpInstrumentation extends InstrumentationBase<HttpInstrumentation
|
|||
if (isESM) {
|
||||
// To handle `import https from 'https'`, which returns the default
|
||||
// export, we need to set `module.default.*`.
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(moduleExports as any).default.request = patchedRequest;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(moduleExports as any).default.get = patchedGet;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,6 +82,7 @@ import * as url from 'url';
|
|||
import { AttributeNames } from './enums/AttributeNames';
|
||||
import { Err, IgnoreMatcher, ParsedRequestOptions } from './internal-types';
|
||||
import { SYNTHETIC_BOT_NAMES, SYNTHETIC_TEST_NAMES } from './internal-types';
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
import forwardedParse = require('forwarded-parse');
|
||||
|
||||
/**
|
||||
|
@ -376,7 +377,7 @@ export const getRequestInfo = (
|
|||
try {
|
||||
const parsedUrl = new URL(optionsParsed.path, origin);
|
||||
pathname = parsedUrl.pathname || '/';
|
||||
} catch (e) {
|
||||
} catch {
|
||||
pathname = '/';
|
||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VEK0hftRXx
|
||||
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,6 +1,6 @@
|
|||
{
|
||||
"name": "@opentelemetry/instrumentation-xml-http-request",
|
||||
"version": "0.202.0",
|
||||
"version": "0.203.0",
|
||||
"description": "OpenTelemetry instrumentation for XMLHttpRequest http client in web browsers",
|
||||
"main": "build/src/index.js",
|
||||
"module": "build/esm/index.js",
|
||||
|
@ -76,7 +76,7 @@
|
|||
"lerna": "6.6.2",
|
||||
"mocha": "11.1.0",
|
||||
"nyc": "17.1.0",
|
||||
"sinon": "15.1.2",
|
||||
"sinon": "18.0.1",
|
||||
"ts-loader": "9.5.2",
|
||||
"typescript": "5.0.4",
|
||||
"webpack": "5.99.9",
|
||||
|
@ -87,7 +87,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@opentelemetry/core": "2.0.1",
|
||||
"@opentelemetry/instrumentation": "0.202.0",
|
||||
"@opentelemetry/instrumentation": "0.203.0",
|
||||
"@opentelemetry/sdk-trace-web": "2.0.1",
|
||||
"@opentelemetry/semantic-conventions": "^1.29.0"
|
||||
},
|
||||
|
|
|
@ -251,6 +251,17 @@ describe('xhr', () => {
|
|||
{ async: false, semconvStabilityOptIn: 'http' },
|
||||
{ async: false, semconvStabilityOptIn: 'http/dup' },
|
||||
];
|
||||
|
||||
let timer: sinon.SinonFakeTimers;
|
||||
|
||||
beforeEach(function () {
|
||||
timer = sinon.useFakeTimers();
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
||||
asyncTests.forEach(test => {
|
||||
const testAsync = test.async;
|
||||
describe(`when async='${testAsync}', semconvStabilityOptIn=${test.semconvStabilityOptIn}`, () => {
|
||||
|
@ -291,8 +302,9 @@ describe('xhr', () => {
|
|||
let xmlHttpRequestInstrumentation: XMLHttpRequestInstrumentation;
|
||||
|
||||
clearData = () => {
|
||||
requests = [];
|
||||
sinon.restore();
|
||||
timer = sinon.useFakeTimers();
|
||||
requests = [];
|
||||
};
|
||||
|
||||
const prepareData = (
|
||||
|
@ -304,7 +316,6 @@ describe('xhr', () => {
|
|||
fakeXhr.onCreate = function (xhr: any) {
|
||||
requests.push(xhr);
|
||||
};
|
||||
sinon.useFakeTimers();
|
||||
|
||||
sinon.stub(performance, 'timeOrigin').value(0);
|
||||
sinon.stub(performance, 'now').callsFake(() => fakeNow);
|
||||
|
@ -364,7 +375,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(requests.length, 1, 'request not called');
|
||||
|
@ -378,7 +389,7 @@ describe('xhr', () => {
|
|||
);
|
||||
};
|
||||
|
||||
beforeEach(done => {
|
||||
beforeEach(function (done) {
|
||||
const propagateTraceHeaderCorsUrls = [window.location.origin];
|
||||
prepareData(done, url, {
|
||||
propagateTraceHeaderCorsUrls,
|
||||
|
@ -702,11 +713,11 @@ describe('xhr', () => {
|
|||
() => {
|
||||
let spyDebug: sinon.SinonSpy;
|
||||
beforeEach(done => {
|
||||
clearData();
|
||||
const diagLogger = new api.DiagConsoleLogger();
|
||||
spyDebug = sinon.spy();
|
||||
diagLogger.debug = spyDebug;
|
||||
api.diag.setLogger(diagLogger, api.DiagLogLevel.ALL);
|
||||
clearData();
|
||||
prepareData(
|
||||
done,
|
||||
'https://raw.githubusercontent.com/open-telemetry/opentelemetry-js/master/package.json'
|
||||
|
@ -791,7 +802,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -808,7 +819,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -974,8 +985,6 @@ describe('xhr', () => {
|
|||
requests.push(xhr);
|
||||
};
|
||||
|
||||
sinon.useFakeTimers();
|
||||
|
||||
sinon.stub(performance, 'timeOrigin').value(0);
|
||||
sinon.stub(performance, 'now').callsFake(() => fakeNow);
|
||||
|
||||
|
@ -1031,12 +1040,12 @@ describe('xhr', () => {
|
|||
new XMLHttpRequest(),
|
||||
url,
|
||||
() => {
|
||||
sinon.clock.tick(XHR_TIMEOUT);
|
||||
timer.tick(XHR_TIMEOUT);
|
||||
},
|
||||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
@ -1050,7 +1059,7 @@ describe('xhr', () => {
|
|||
void getData(new XMLHttpRequest(), url, () => {}, testAsync).then(
|
||||
() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
@ -1074,7 +1083,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(requests.length, 1, 'request not called');
|
||||
|
@ -1094,7 +1103,7 @@ describe('xhr', () => {
|
|||
void getData(new XMLHttpRequest(), url, () => {}, testAsync).then(
|
||||
() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
}
|
||||
);
|
||||
|
@ -1109,6 +1118,7 @@ describe('xhr', () => {
|
|||
beforeEach(done => {
|
||||
erroredRequest(done);
|
||||
});
|
||||
|
||||
it('span should have correct attributes and status', () => {
|
||||
const span: tracing.ReadableSpan = exportSpy.args[0][0][0];
|
||||
const attributes = span.attributes;
|
||||
|
@ -1684,8 +1694,9 @@ describe('xhr', () => {
|
|||
let xmlHttpRequestInstrumentation: XMLHttpRequestInstrumentation;
|
||||
|
||||
clearData = () => {
|
||||
requests = [];
|
||||
sinon.restore();
|
||||
timer = sinon.useFakeTimers();
|
||||
requests = [];
|
||||
};
|
||||
|
||||
const prepareData = (
|
||||
|
@ -1697,7 +1708,6 @@ describe('xhr', () => {
|
|||
fakeXhr.onCreate = function (xhr: any) {
|
||||
requests.push(xhr);
|
||||
};
|
||||
sinon.useFakeTimers();
|
||||
|
||||
sinon.stub(performance, 'timeOrigin').value(0);
|
||||
sinon.stub(performance, 'now').callsFake(() => fakeNow);
|
||||
|
@ -1757,7 +1767,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(requests.length, 1, 'request not called');
|
||||
|
@ -1772,6 +1782,7 @@ describe('xhr', () => {
|
|||
};
|
||||
|
||||
beforeEach(done => {
|
||||
clearData();
|
||||
const propagateTraceHeaderCorsUrls = [window.location.origin];
|
||||
prepareData(done, url, {
|
||||
propagateTraceHeaderCorsUrls,
|
||||
|
@ -2098,11 +2109,11 @@ describe('xhr', () => {
|
|||
() => {
|
||||
let spyDebug: sinon.SinonSpy;
|
||||
beforeEach(done => {
|
||||
clearData();
|
||||
const diagLogger = new api.DiagConsoleLogger();
|
||||
spyDebug = sinon.spy();
|
||||
diagLogger.debug = spyDebug;
|
||||
api.diag.setLogger(diagLogger, api.DiagLogLevel.ALL);
|
||||
clearData();
|
||||
prepareData(
|
||||
done,
|
||||
'https://raw.githubusercontent.com/open-telemetry/opentelemetry-js/master/package.json'
|
||||
|
@ -2188,7 +2199,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
});
|
||||
}
|
||||
);
|
||||
|
@ -2206,7 +2217,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -2338,8 +2349,6 @@ describe('xhr', () => {
|
|||
requests.push(xhr);
|
||||
};
|
||||
|
||||
sinon.useFakeTimers();
|
||||
|
||||
sinon.stub(performance, 'timeOrigin').value(0);
|
||||
sinon.stub(performance, 'now').callsFake(() => fakeNow);
|
||||
|
||||
|
@ -2397,12 +2406,12 @@ describe('xhr', () => {
|
|||
url,
|
||||
'{"embedded":"data"}',
|
||||
() => {
|
||||
sinon.clock.tick(XHR_TIMEOUT);
|
||||
timer.tick(XHR_TIMEOUT);
|
||||
},
|
||||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
@ -2421,7 +2430,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -2445,7 +2454,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
assert.strictEqual(requests.length, 1, 'request not called');
|
||||
|
@ -2470,7 +2479,7 @@ describe('xhr', () => {
|
|||
testAsync
|
||||
).then(() => {
|
||||
fakeNow = 0;
|
||||
sinon.clock.tick(1000);
|
||||
timer.tick(1000);
|
||||
done();
|
||||
});
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue