Skip to content

Commit

Permalink
Merge branch 'main' into root-span-sampler
Browse files Browse the repository at this point in the history
  • Loading branch information
vmarchaud authored May 12, 2021
2 parents b4c34bd + 1758fa6 commit 97cfd51
Show file tree
Hide file tree
Showing 108 changed files with 1,449 additions and 737 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,14 @@ To request automatic tracing support for a module not on this list, please [file

## Upgrade guidelines

### 0.19.x to x

- `HttpBaggage` renamed to `HttpBaggagePropagator`

- `HttpTraceContext` renamed to `HttpTraceContextPropagator`

- `JaegerHttpTracePropagator` renamed to `JaegerPropagator`

### 0.18.x to 0.19.0

- API is now a peer dependency. This means that users will need to include `@opentelemetry/api` as a dependency of their project in order to use the SDK. NPM version 7+ (Node 15+) should do this automatically.
Expand Down
4 changes: 2 additions & 2 deletions benchmark/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Beginning B3Propagator Benchmark...
#Inject x 2,018,725 ops/sec ±3.49% (100 runs sampled)
#Extract x 2,040,891 ops/sec ±1.75% (100 runs sampled)
Beginning HttpTraceContext Benchmark...
Beginning HttpTraceContextPropagator Benchmark...
2 tests completed.
#Inject x 3,987,007 ops/sec ±1.87% (100 runs sampled)
Expand Down Expand Up @@ -112,7 +112,7 @@ Beginning B3Propagator Benchmark...
#Inject x 5,086,366 ops/sec ±3.18% (100 runs sampled)
#Extract x 4,859,557 ops/sec ±3.80% (100 runs sampled)
Beginning HttpTraceContext Benchmark...
Beginning HttpTraceContextPropagator Benchmark...
2 tests completed.
#Inject x 13,660,710 ops/sec ±1.84% (100 runs sampled)
Expand Down
4 changes: 2 additions & 2 deletions benchmark/propagator.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ const setups = [
}
},
{
name: 'HttpTraceContext',
propagator: new opentelemetry.HttpTraceContext(),
name: 'HttpTraceContextPropagator',
propagator: new opentelemetry.HttpTraceContextPropagator(),
injectCarrier: {},
extractCarrier: {
traceparent: '00-d4cda95b652f4a1592b449d5929fda1b-6e0c63257de34c92-00'
Expand Down
5 changes: 2 additions & 3 deletions examples/collector-exporter-node/docker/collector-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@ exporters:

processors:
batch:
queued_retry:

service:
pipelines:
traces:
receivers: [otlp]
exporters: [zipkin]
processors: [batch, queued_retry]
processors: [batch]
metrics:
receivers: [otlp]
exporters: [prometheus]
processors: [batch, queued_retry]
processors: [batch]
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: "3"
services:
# Collector
collector:
image: otel/opentelemetry-collector:0.16.0
image: otel/opentelemetry-collector:0.25.0
# image: otel/opentelemetry-collector:latest
command: ["--config=/conf/collector-config.yaml", "--log-level=DEBUG"]
volumes:
Expand Down
26 changes: 11 additions & 15 deletions examples/http/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,17 @@ function handleRequest(request, response) {
});
// Annotate our span to capture metadata about the operation
span.addEvent('invoking handleRequest');
try {
const body = [];
request.on('error', (err) => console.log(err));
request.on('data', (chunk) => body.push(chunk));
request.on('end', () => {
// deliberately sleeping to mock some action.
setTimeout(() => {
span.end();
response.end('Hello World!');
}, 2000);
});
} catch (err) {
console.error(err);
span.end();
}

const body = [];
request.on('error', (err) => console.log(err));
request.on('data', (chunk) => body.push(chunk));
request.on('end', () => {
// deliberately sleeping to mock some action.
setTimeout(() => {
span.end();
response.end('Hello World!');
}, 2000);
});
}

startServer(8080);
26 changes: 11 additions & 15 deletions examples/https/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,17 @@ function handleRequest(request, response) {
});
// Annotate our span to capture metadata about the operation
span.addEvent('invoking handleRequest');
try {
const body = [];
request.on('error', (err) => console.log(err));
request.on('data', (chunk) => body.push(chunk));
request.on('end', () => {
// deliberately sleeping to mock some action.
setTimeout(() => {
span.end();
response.end('Hello World!');
}, 2000);
});
} catch (err) {
console.log(err);
span.end();
}

const body = [];
request.on('error', (err) => console.log(err));
request.on('data', (chunk) => body.push(chunk));
request.on('end', () => {
// deliberately sleeping to mock some action.
setTimeout(() => {
span.end();
response.end('Hello World!');
}, 2000);
});
}

startServer(443);
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const axios = require("axios");
const { HttpTraceContext } = require("@opentelemetry/core");
const { HttpTraceContextPropagator } = require("@opentelemetry/core");
const { BasicTracerProvider } = require("@opentelemetry/tracing");
const { context, propagation, setSpan, trace, ROOT_CONTEXT } = require("@opentelemetry/api");
const {
Expand All @@ -8,7 +8,7 @@ const {
const bodyParser = require("body-parser");

// set global propagator
propagation.setGlobalPropagator(new HttpTraceContext());
propagation.setGlobalPropagator(new HttpTraceContextPropagator());

// set global context manager
context.setGlobalContextManager(new AsyncHooksContextManager());
Expand Down
12 changes: 6 additions & 6 deletions packages/opentelemetry-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This package provides default implementations of the OpenTelemetry API for trace
- [OpenTelemetry Core](#opentelemetry-core)
- [Built-in Implementations](#built-in-implementations)
- [Built-in Propagators](#built-in-propagators)
- [HttpTraceContext Propagator](#httptracecontext-propagator)
- [HttpTraceContextPropagator Propagator](#httptracecontext-propagator)
- [Composite Propagator](#composite-propagator)
- [Baggage Propagator](#baggage-propagator)
- [Built-in Sampler](#built-in-sampler)
Expand All @@ -25,16 +25,16 @@ This package provides default implementations of the OpenTelemetry API for trace

### Built-in Propagators

#### HttpTraceContext Propagator
#### HttpTraceContextPropagator Propagator

OpenTelemetry provides a text-based approach to propagate context to remote services using the [W3C Trace Context](https://www.w3.org/TR/trace-context/) HTTP headers.

```js
const api = require("@opentelemetry/api");
const { HttpTraceContext } = require("@opentelemetry/core");
const { HttpTraceContextPropagator } = require("@opentelemetry/core");

/* Set Global Propagator */
api.propagation.setGlobalPropagator(new HttpTraceContext());
api.propagation.setGlobalPropagator(new HttpTraceContextPropagator());
```

#### Composite Propagator
Expand All @@ -57,10 +57,10 @@ Provides a text-based approach to propagate [baggage](https://w3c.github.io/bagg

```js
const api = require("@opentelemetry/api");
const { HttpBaggage } = require("@opentelemetry/core");
const { HttpBaggagePropagator } = require("@opentelemetry/core");

/* Set Global Propagator */
api.propagation.setGlobalPropagator(new HttpBaggage());
api.propagation.setGlobalPropagator(new HttpBaggagePropagator());
```

### Built-in Sampler
Expand Down
3 changes: 2 additions & 1 deletion packages/opentelemetry-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"@opentelemetry/api": "^1.0.0-rc.0"
},
"dependencies": {
"semver": "^7.1.3"
"semver": "^7.1.3",
"@opentelemetry/semantic-conventions": "0.19.0"
}
}
28 changes: 28 additions & 0 deletions packages/opentelemetry-core/src/baggage/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* 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 const BAGGAGE_KEY_PAIR_SEPARATOR = '=';
export const BAGGAGE_PROPERTIES_SEPARATOR = ';';
export const BAGGAGE_ITEMS_SEPARATOR = ',';

// Name of the http header used to propagate the baggage
export const BAGGAGE_HEADER = 'baggage';
// Maximum number of name-value pairs allowed by w3c spec
export const BAGGAGE_MAX_NAME_VALUE_PAIRS = 180;
// Maximum number of bytes per a single name-value pair allowed by w3c spec
export const BAGGAGE_MAX_PER_NAME_VALUE_PAIRS = 4096;
// Maximum total length of all name-value pairs allowed by w3c spec
export const BAGGAGE_MAX_TOTAL_LENGTH = 8192;
128 changes: 0 additions & 128 deletions packages/opentelemetry-core/src/baggage/propagation/HttpBaggage.ts

This file was deleted.

Loading

0 comments on commit 97cfd51

Please sign in to comment.