Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into service-worker-support
Browse files Browse the repository at this point in the history
  • Loading branch information
sugi committed Mar 6, 2023
2 parents 7f66982 + ebc8575 commit 5a714bf
Show file tree
Hide file tree
Showing 223 changed files with 4,620 additions and 1,083 deletions.
6 changes: 6 additions & 0 deletions .github/repository-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ No changes
### `main`

* Uncheck "Restrict who can push to matching branches"
* Check "Require merge queue"
* Build concurrency: 5
* Minimum pull requests to merge: 1 or after 5 minutes
* Maximum pull requests to merge: 5
* Check "Only merge non-failing pull requests"
* Status check timeout: 60 minutes

### `dependabot/**/**`

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
merge_group:

jobs:
build:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/peer-api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
merge_group:

jobs:
peer-api-check:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
branches:
- main
pull_request:
merge_group:

jobs:
node-tests:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/w3c-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches:
- main
pull_request:
merge_group:

jobs:
build-and-test:
Expand Down
1 change: 1 addition & 0 deletions .nycrc
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"produceSourceMap": false,
"extension": [
".ts"
],
Expand Down
29 changes: 26 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,35 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

## Unreleased

* feat: collect host id for non-cloud environments [#3575](https://github.com/open-telemetry/opentelemetry-js/pull/3575) @mwear

### :boom: Breaking Change

### :rocket: (Enhancement)

* feat(sdk-metrics): add exponential histogram mapping functions [#3504](https://github.com/open-telemetry/opentelemetry-js/pull/3504) @mwear
* feat(resource): create sync resource with some attributes that resolve asynchronously [#3460](https://github.com/open-telemetry/opentelemetry-js/pull/3460) @samimusallam
* feat (api-logs): separate Events API into its own package [3550](https://github.com/open-telemetry/opentelemetry-js/pull/3550) @martinkuba
* feat(sdk-metrics): apply binary search in histogram recording [#3539](https://github.com/open-telemetry/opentelemetry-js/pull/3539) @legendecas
* perf(propagator-jaeger): improve deserializeSpanContext performance [#3541](https://github.com/open-telemetry/opentelemetry-js/pull/3541) @doochik
* feat: support TraceState in SamplingResult [#3530](https://github.com/open-telemetry/opentelemetry-js/pull/3530) @raphael-theriault-swi
* feat(sdk-trace-base): add diagnostic logging when spans are dropped [#3610](https://github.com/open-telemetry/opentelemetry-js/pull/3610) @neoeinstein

### :bug: (Bug Fix)

* fix(core): added falsy check to make otel core work with browser where webpack config had process as false or null [#3613](https://github.com/open-telemetry/opentelemetry-js/issues/3613) @ravindra-dyte
* fix(instrumentation-http): include query params in http.target [#3646](https://github.com/open-telemetry/opentelemetry-js/pull/3646) @kobi-co

### :books: (Refine Doc)

* chore: update http example [#3651](https://github.com/open-telemetry/opentelemetry-js/pull/3651) @JamieDanielson

### :house: (Internal)

* chore(exporter-jaeger): deprecate jaeger exporter [#3585](https://github.com/open-telemetry/opentelemetry-js/pull/3585) @pichlermarc
* fix(sdk-metrics): fix flaky LastValueAggregator test by using fake timer [#3587](https://github.com/open-telemetry/opentelemetry-js/pull/3587) @pichlermarc
* fix(test): fix failing tests by preventing source-map generation [#3642](https://github.com/open-telemetry/opentelemetry-js/pull/3642) @pichlermarc

## 1.9.1

### :bug: (Bug Fix)

Expand All @@ -20,11 +44,10 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
[#3562](https://github.com/open-telemetry/opentelemetry-js/pull/3562) @scheler
* fix: include tracestate in export [#3569](https://github.com/open-telemetry/opentelemetry-js/pull/3569) @flarna

### :books: (Refine Doc)

### :house: (Internal)

* chore: fix cross project links and missing implicitly exported types [#3533](https://github.com/open-telemetry/opentelemetry-js/pull/3533) @legendecas
* feat(sdk-metrics): add exponential histogram mapping functions [#3504](https://github.com/open-telemetry/opentelemetry-js/pull/3504) @mwear

## 1.9.0

Expand Down
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ const sdk = new opentelemetry.NodeSDK({

// initialize the SDK and register with the OpenTelemetry API
// this enables the API to record telemetry
sdk.start()
.then(() => console.log('Tracing initialized'))
.catch((error) => console.log('Error initializing tracing', error));
sdk.start();

// gracefully shut down the SDK on process exit
process.on('SIGTERM', () => {
Expand Down Expand Up @@ -178,9 +176,10 @@ We have a weekly SIG meeting! See the [community page](https://github.com/open-t
Approvers ([@open-telemetry/js-approvers](https://github.com/orgs/open-telemetry/teams/javascript-approvers)):

- [Gerhard Stöbich](https://github.com/Flarna), Dynatrace
- [Haddas Bronfman](https://github.com/haddasbronfman), Cisco
- [John Bley](https://github.com/johnbley), Splunk
- [Marc Pichler](https://github.com/pichlermarc), Dynatrace
- [Mark Wolff](https://github.com/markwolff), Microsoft
- [Martin Kuba](https://github.com/martinkuba), Lightstep
- [Matthew Wear](https://github.com/mwear), LightStep
- [Naseem K. Ullah](https://github.com/naseemkullah), Transit
- [Neville Wylie](https://github.com/MSNev), Microsoft
Expand All @@ -194,6 +193,7 @@ Maintainers ([@open-telemetry/js-maintainers](https://github.com/orgs/open-telem
- [Amir Blum](https://github.com/blumamir), Aspecto
- [Chengzhong Wu](https://github.com/legendecas), Alibaba
- [Daniel Dyla](https://github.com/dyladan), Dynatrace
- [Marc Pichler](https://github.com/pichlermarc), Dynatrace
- [Rauno Viskus](https://github.com/Rauno56), Splunk
- [Valentin Marchaud](https://github.com/vmarchaud), Open Source Contributor

Expand Down Expand Up @@ -275,6 +275,11 @@ These instrumentations are hosted at <https://github.com/open-telemetry/opentele

## Upgrade guidelines

### 0.35.x to 0.36.0

- `@opentelemetry/sdk-node` changed `await start()` to now be synchronous
- `@opentelemetry/sdk-node` changed `await detectResources()` to now be synchronous

### 0.28.x to 0.29.x

- `@opentelemetry/exporter-trace-otlp-http` is now exporting `scopeSpans` instead of `instrumentationLibrarySpans`
Expand Down
2 changes: 2 additions & 0 deletions api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file.
### :bug: (Bug Fix)

* fix(metrics): export `MetricsAPI` type [#3535](https://github.com/open-telemetry/opentelemetry-js/pull/3535)
* fix(api): rename `LoggerOptions` to `DiagLoggerOptions` [#3641](https://github.com/open-telemetry/opentelemetry-js/pull/3641)
* fix(api): export `DiagLoggerOptions` type [#3639](https://github.com/open-telemetry/opentelemetry-js/pull/3639)

## 1.4.0

Expand Down
6 changes: 3 additions & 3 deletions api/src/diag/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export interface ComponentLoggerOptions {
namespace: string;
}

export interface LoggerOptions {
export interface DiagLoggerOptions {
/**
* The {@link DiagLogLevel} used to filter logs sent to the logger.
*
Expand All @@ -117,10 +117,10 @@ export interface DiagLoggerApi {
* If a global diag logger is already set, this will override it.
*
* @param logger - The {@link DiagLogger} instance to set as the default logger.
* @param options - A {@link LoggerOptions} object. If not provided, default values will be set.
* @param options - A {@link DiagLoggerOptions} object. If not provided, default values will be set.
* @returns `true` if the logger was successfully registered, else `false`
*/
setLogger(logger: DiagLogger, options?: LoggerOptions): boolean;
setLogger(logger: DiagLogger, options?: DiagLoggerOptions): boolean;

/**
*
Expand Down
1 change: 1 addition & 0 deletions api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export {
DiagLogger,
DiagLogLevel,
ComponentLoggerOptions,
DiagLoggerOptions,
} from './diag/types';
export type { DiagAPI } from './api/diag';

Expand Down
2 changes: 1 addition & 1 deletion api/src/internal/global-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export function registerGlobal<Type extends keyof OTelGlobalAPI>(
if (api.version !== VERSION) {
// All registered APIs must be of the same version exactly
const err = new Error(
'@opentelemetry/api: All API registration versions must match'
`@opentelemetry/api: Registration of version v${api.version} for ${type} does not match previously registered API v${VERSION}`
);
diag.error(err.stack || err.message);
return false;
Expand Down
8 changes: 8 additions & 0 deletions api/src/trace/SamplingResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
*/

import { SpanAttributes } from './attributes';
import { TraceState } from './trace_state';

/**
* @deprecated use the one declared in @opentelemetry/sdk-trace-base instead.
Expand Down Expand Up @@ -55,4 +56,11 @@ export interface SamplingResult {
* can safely cache the returned value.
*/
attributes?: Readonly<SpanAttributes>;
/**
* A {@link TraceState} that will be associated with the {@link Span} through
* the new {@link SpanContext}. Samplers SHOULD return the TraceState from
* the passed-in {@link Context} if they do not intend to change it. Leaving
* the value undefined will also leave the TraceState unchanged.
*/
traceState?: TraceState;
}
23 changes: 11 additions & 12 deletions api/test/common/internal/global.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,23 +84,22 @@ describe('Global Utils', () => {
assert.notStrictEqual(manager, api1.context['_getContextManager']());
});

it('should return the module NoOp implementation if the version is a mismatch', () => {
const newContextManager = new NoopContextManager();
api1.context.setGlobalContextManager(newContextManager);

// ensure new context manager is returned
assert.strictEqual(api1.context['_getContextManager'](), newContextManager);
it('should not register if the version is a mismatch', () => {
const logger1 = getMockLogger();
const logger2 = getMockLogger();

const globalInstance = getGlobal('context');
api1.diag.setLogger(logger1);
const globalInstance = getGlobal('diag');
assert.ok(globalInstance);
// @ts-expect-error we are modifying internals for testing purposes here
_globalThis[Symbol.for(GLOBAL_API_SYMBOL_KEY)].version = '0.0.1';

// ensure new context manager is not returned because version above is incompatible
assert.notStrictEqual(
api1.context['_getContextManager'](),
newContextManager
);
assert.equal(false, api1.diag.setLogger(logger2)); // won't happen

api1.diag.info('message');
sinon.assert.notCalled(logger2.error);
sinon.assert.notCalled(logger2.info);
sinon.assert.notCalled(logger2.warn);
});

it('should debug log registrations', () => {
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions examples/http/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ function makeRequest() {
// span corresponds to outgoing requests. Here, we have manually created
// the span, which is created to track work that happens outside of the
// request lifecycle entirely.
const span = tracer.startSpan('makeRequest');
api.context.with(api.trace.setSpan(api.context.active(), span), () => {
tracer.startActiveSpan('makeRequest', (span) => {
http.get({
host: 'localhost',
port: 8080,
Expand Down
20 changes: 10 additions & 10 deletions examples/http/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "http-example",
"private": true,
"version": "0.25.0",
"version": "0.35.1",
"description": "Example of HTTP integration with OpenTelemetry",
"main": "index.js",
"scripts": {
Expand All @@ -28,15 +28,15 @@
"url": "https://github.com/open-telemetry/opentelemetry-js/issues"
},
"dependencies": {
"@opentelemetry/api": "^1.0.2",
"@opentelemetry/exporter-jaeger": "0.25.0",
"@opentelemetry/exporter-zipkin": "0.25.0",
"@opentelemetry/instrumentation": "0.25.0",
"@opentelemetry/instrumentation-http": "0.25.0",
"@opentelemetry/resources": "0.25.0",
"@opentelemetry/semantic-conventions": "0.25.0",
"@opentelemetry/sdk-trace-node": "0.25.0",
"@opentelemetry/sdk-trace-base": "0.25.0"
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/exporter-jaeger": "1.9.1",
"@opentelemetry/exporter-zipkin": "1.9.1",
"@opentelemetry/instrumentation": "0.35.1",
"@opentelemetry/instrumentation-http": "0.35.1",
"@opentelemetry/resources": "1.9.1",
"@opentelemetry/semantic-conventions": "1.9.1",
"@opentelemetry/sdk-trace-node": "1.9.1",
"@opentelemetry/sdk-trace-base": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/http",
"devDependencies": {
Expand Down
5 changes: 3 additions & 2 deletions examples/http/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ function startServer(port) {

/** A function which handles requests and send response. */
function handleRequest(request, response) {
const currentSpan = api.trace.getSpan(api.context.active());
const currentSpan = api.trace.getActiveSpan();
// display traceid in the terminal
console.log(`traceid: ${currentSpan.spanContext().traceId}`);
const traceId = currentSpan.spanContext().traceId;
console.log(`traceId: ${traceId}`);
const span = tracer.startSpan('handleRequest', {
kind: 1, // server
attributes: { key: 'value' },
Expand Down
18 changes: 9 additions & 9 deletions examples/https/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "https-example",
"private": true,
"version": "0.35.0",
"version": "0.35.1",
"description": "Example of HTTPs integration with OpenTelemetry",
"main": "build/src/index.js",
"types": "build/src/index.d.ts",
Expand Down Expand Up @@ -33,14 +33,14 @@
},
"dependencies": {
"@opentelemetry/api": "^1.0.0",
"@opentelemetry/exporter-jaeger": "1.9.0",
"@opentelemetry/exporter-zipkin": "1.9.0",
"@opentelemetry/instrumentation": "0.35.0",
"@opentelemetry/instrumentation-http": "0.35.0",
"@opentelemetry/resources": "1.9.0",
"@opentelemetry/sdk-trace-base": "1.9.0",
"@opentelemetry/sdk-trace-node": "1.9.0",
"@opentelemetry/semantic-conventions": "1.9.0"
"@opentelemetry/exporter-jaeger": "1.9.1",
"@opentelemetry/exporter-zipkin": "1.9.1",
"@opentelemetry/instrumentation": "0.35.1",
"@opentelemetry/instrumentation-http": "0.35.1",
"@opentelemetry/resources": "1.9.1",
"@opentelemetry/sdk-trace-base": "1.9.1",
"@opentelemetry/sdk-trace-node": "1.9.1",
"@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/https",
"devDependencies": {
Expand Down
30 changes: 15 additions & 15 deletions examples/opentelemetry-web/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "web-opentelemetry-example",
"private": true,
"version": "0.35.0",
"version": "0.35.1",
"description": "Example of using @opentelemetry/sdk-trace-web and @opentelemetry/sdk-metrics in browser",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -43,20 +43,20 @@
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/context-zone": "1.9.0",
"@opentelemetry/core": "1.9.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.35.0",
"@opentelemetry/exporter-trace-otlp-http": "0.35.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.35.0",
"@opentelemetry/exporter-zipkin": "1.9.0",
"@opentelemetry/instrumentation": "0.35.0",
"@opentelemetry/instrumentation-fetch": "0.35.0",
"@opentelemetry/instrumentation-xml-http-request": "0.35.0",
"@opentelemetry/propagator-b3": "1.9.0",
"@opentelemetry/sdk-metrics": "1.9.0",
"@opentelemetry/sdk-trace-base": "1.9.0",
"@opentelemetry/sdk-trace-web": "1.9.0",
"@opentelemetry/semantic-conventions": "1.9.0"
"@opentelemetry/context-zone": "1.9.1",
"@opentelemetry/core": "1.9.1",
"@opentelemetry/exporter-metrics-otlp-http": "0.35.1",
"@opentelemetry/exporter-trace-otlp-http": "0.35.1",
"@opentelemetry/exporter-trace-otlp-proto": "0.35.1",
"@opentelemetry/exporter-zipkin": "1.9.1",
"@opentelemetry/instrumentation": "0.35.1",
"@opentelemetry/instrumentation-fetch": "0.35.1",
"@opentelemetry/instrumentation-xml-http-request": "0.35.1",
"@opentelemetry/propagator-b3": "1.9.1",
"@opentelemetry/sdk-metrics": "1.9.1",
"@opentelemetry/sdk-trace-base": "1.9.1",
"@opentelemetry/sdk-trace-web": "1.9.1",
"@opentelemetry/semantic-conventions": "1.9.1"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web"
}
Loading

0 comments on commit 5a714bf

Please sign in to comment.