Skip to content

Commit

Permalink
Merge branch 'main' into jacksonweber/sampler-without-exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
JacksonWeber authored Jan 29, 2024
2 parents e0bd102 + 4655895 commit e4eb1a1
Show file tree
Hide file tree
Showing 75 changed files with 1,178 additions and 1,122 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :rocket: (Enhancement)

### :bug: (Bug Fix)

### :books: (Refine Doc)

### :house: (Internal)

## 1.21.0

### :rocket: (Enhancement)

* feat(sdk-metrics): add constructor option to add metric readers [#4427](https://github.com/open-telemetry/opentelemetry-js/pull/4427) @pichlermarc
* deprecates `MeterProvider.addMetricReader()` please use the constructor option `readers` instead.

Expand All @@ -19,8 +29,6 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/
* fix(sdk-trace-base): ensure attribute value length limit is enforced on span creation [#4417](https://github.com/open-telemetry/opentelemetry-js/pull/4417) @pichlermarc
* fix(sdk-trace-base): Export processed spans while exporter failed [#4287](https://github.com/open-telemetry/opentelemetry-js/pull/4287) @Zirak

### :books: (Refine Doc)

### :house: (Internal)

* chore(opentelemetry-context-zone-peer-dep): support zone.js ^v0.13.0 [#4320](https://github.com/open-telemetry/opentelemetry-js/pull/4320)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ The below table describes which versions of each set of packages are expected to

| Stable Packages | Experimental Packages |
|-----------------------------------------------------------------|-----------------------|
| 1.21.x | 0.48.x |
| 1.20.x | 0.47.x |
| 1.19.x | 0.46.x |
| 1.18.x | 0.45.x |
Expand Down
8 changes: 4 additions & 4 deletions doc/metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const {
getNodeAutoInstrumentations,
} = require("@opentelemetry/auto-instrumentations-node");

const prometheusExporter = new PrometheusExporter({ startServer: true });
const prometheusExporter = new PrometheusExporter();

const sdk = new opentelemetry.NodeSDK({
// Optional - If omitted, the metrics SDK will not be initialized
Expand Down Expand Up @@ -147,7 +147,7 @@ const {
getNodeAutoInstrumentations,
} = require("@opentelemetry/auto-instrumentations-node");

const prometheusExporter = new PrometheusExporter({ startServer: true });
const prometheusExporter = new PrometheusExporter();

const sdk = new opentelemetry.NodeSDK({
// Optional - If omitted, the metrics SDK will not be initialized
Expand Down Expand Up @@ -499,8 +499,8 @@ to use the Prometheus exporter `PrometheusExporter` which is included in the
const { PrometheusExporter } = require('@opentelemetry/exporter-prometheus');
const { MeterProvider } = require('@opentelemetry/sdk-metrics');

// Add your port and startServer to the Prometheus options
const options = { port: 9464, startServer: true };
// Add your port to the Prometheus options
const options = { port: 9464 };
const exporter = new PrometheusExporter(options);

// Creates MeterProvider and installs the exporter as a MetricReader
Expand Down
16 changes: 8 additions & 8 deletions examples/esm-http-ts/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "esm-http-ts",
"private": true,
"version": "0.47.0",
"version": "0.48.0",
"description": "Example of HTTP integration with OpenTelemetry using ESM and TypeScript",
"main": "build/index.js",
"type": "module",
Expand Down Expand Up @@ -31,12 +31,12 @@
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/",
"dependencies": {
"@opentelemetry/api": "1.7.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.47.0",
"@opentelemetry/instrumentation": "0.47.0",
"@opentelemetry/instrumentation-http": "0.47.0",
"@opentelemetry/resources": "1.20.0",
"@opentelemetry/sdk-trace-base": "1.20.0",
"@opentelemetry/sdk-trace-node": "1.20.0",
"@opentelemetry/semantic-conventions": "1.20.0"
"@opentelemetry/exporter-trace-otlp-proto": "0.48.0",
"@opentelemetry/instrumentation": "0.48.0",
"@opentelemetry/instrumentation-http": "0.48.0",
"@opentelemetry/resources": "1.21.0",
"@opentelemetry/sdk-trace-base": "1.21.0",
"@opentelemetry/sdk-trace-node": "1.21.0",
"@opentelemetry/semantic-conventions": "1.21.0"
}
}
18 changes: 9 additions & 9 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.47.0",
"version": "0.48.0",
"description": "Example of HTTP integration with OpenTelemetry",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,14 +29,14 @@
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/exporter-jaeger": "1.20.0",
"@opentelemetry/exporter-zipkin": "1.20.0",
"@opentelemetry/instrumentation": "0.47.0",
"@opentelemetry/instrumentation-http": "0.47.0",
"@opentelemetry/resources": "1.20.0",
"@opentelemetry/sdk-trace-base": "1.20.0",
"@opentelemetry/sdk-trace-node": "1.20.0",
"@opentelemetry/semantic-conventions": "1.20.0"
"@opentelemetry/exporter-jaeger": "1.21.0",
"@opentelemetry/exporter-zipkin": "1.21.0",
"@opentelemetry/instrumentation": "0.48.0",
"@opentelemetry/instrumentation-http": "0.48.0",
"@opentelemetry/resources": "1.21.0",
"@opentelemetry/sdk-trace-base": "1.21.0",
"@opentelemetry/sdk-trace-node": "1.21.0",
"@opentelemetry/semantic-conventions": "1.21.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/http",
"devDependencies": {
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.47.0",
"version": "0.48.0",
"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.20.0",
"@opentelemetry/exporter-zipkin": "1.20.0",
"@opentelemetry/instrumentation": "0.47.0",
"@opentelemetry/instrumentation-http": "0.47.0",
"@opentelemetry/resources": "1.20.0",
"@opentelemetry/sdk-trace-base": "1.20.0",
"@opentelemetry/sdk-trace-node": "1.20.0",
"@opentelemetry/semantic-conventions": "1.20.0"
"@opentelemetry/exporter-jaeger": "1.21.0",
"@opentelemetry/exporter-zipkin": "1.21.0",
"@opentelemetry/instrumentation": "0.48.0",
"@opentelemetry/instrumentation-http": "0.48.0",
"@opentelemetry/resources": "1.21.0",
"@opentelemetry/sdk-trace-base": "1.21.0",
"@opentelemetry/sdk-trace-node": "1.21.0",
"@opentelemetry/semantic-conventions": "1.21.0"
},
"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.47.0",
"version": "0.48.0",
"description": "Example of using @opentelemetry/sdk-trace-web and @opentelemetry/sdk-metrics in browser",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -44,20 +44,20 @@
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/context-zone": "1.20.0",
"@opentelemetry/core": "1.20.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.47.0",
"@opentelemetry/exporter-trace-otlp-http": "0.47.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.47.0",
"@opentelemetry/exporter-zipkin": "1.20.0",
"@opentelemetry/instrumentation": "0.47.0",
"@opentelemetry/instrumentation-fetch": "0.47.0",
"@opentelemetry/instrumentation-xml-http-request": "0.47.0",
"@opentelemetry/propagator-b3": "1.20.0",
"@opentelemetry/sdk-metrics": "1.20.0",
"@opentelemetry/sdk-trace-base": "1.20.0",
"@opentelemetry/sdk-trace-web": "1.20.0",
"@opentelemetry/semantic-conventions": "1.20.0"
"@opentelemetry/context-zone": "1.21.0",
"@opentelemetry/core": "1.21.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.48.0",
"@opentelemetry/exporter-trace-otlp-http": "0.48.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.48.0",
"@opentelemetry/exporter-zipkin": "1.21.0",
"@opentelemetry/instrumentation": "0.48.0",
"@opentelemetry/instrumentation-fetch": "0.48.0",
"@opentelemetry/instrumentation-xml-http-request": "0.48.0",
"@opentelemetry/propagator-b3": "1.21.0",
"@opentelemetry/sdk-metrics": "1.21.0",
"@opentelemetry/sdk-trace-base": "1.21.0",
"@opentelemetry/sdk-trace-web": "1.21.0",
"@opentelemetry/semantic-conventions": "1.21.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/tracer-web"
}
24 changes: 12 additions & 12 deletions examples/otlp-exporter-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "example-otlp-exporter-node",
"private": true,
"version": "0.47.0",
"version": "0.48.0",
"description": "Example of using @opentelemetry/collector-exporter in Node.js",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -29,17 +29,17 @@
},
"dependencies": {
"@opentelemetry/api": "^1.3.0",
"@opentelemetry/core": "1.20.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.47.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.47.0",
"@opentelemetry/exporter-metrics-otlp-proto": "0.47.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.47.0",
"@opentelemetry/exporter-trace-otlp-http": "0.47.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.47.0",
"@opentelemetry/resources": "1.20.0",
"@opentelemetry/sdk-metrics": "1.20.0",
"@opentelemetry/sdk-trace-base": "1.20.0",
"@opentelemetry/semantic-conventions": "1.20.0"
"@opentelemetry/core": "1.21.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "0.48.0",
"@opentelemetry/exporter-metrics-otlp-http": "0.48.0",
"@opentelemetry/exporter-metrics-otlp-proto": "0.48.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.48.0",
"@opentelemetry/exporter-trace-otlp-http": "0.48.0",
"@opentelemetry/exporter-trace-otlp-proto": "0.48.0",
"@opentelemetry/resources": "1.21.0",
"@opentelemetry/sdk-metrics": "1.21.0",
"@opentelemetry/sdk-trace-base": "1.21.0",
"@opentelemetry/semantic-conventions": "1.21.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/examples/otlp-exporter-node"
}
24 changes: 24 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ All notable changes to experimental packages in this project will be documented

### :rocket: (Enhancement)

* feat(exporter-metrics-otlp-http): add option to set the exporter aggregation preference [#4409](https://github.com/open-telemetry/opentelemetry-js/pull/4409) @AkselAllas

### :bug: (Bug Fix)

* fix(sdk-node): allow using samplers when the exporter is defined in the environment [#4394](https://github.com/open-telemetry/opentelemetry-js/pull/4394) @JacksonWeber
Expand All @@ -16,6 +18,28 @@ All notable changes to experimental packages in this project will be documented

### :house: (Internal)

## 0.48.0

### :boom: Breaking Change

* fix(instrumentation)!: pin [email protected] [#4441](https://github.com/open-telemetry/opentelemetry-js/pull/4441)
* Fixes a bug where, in some circumstances, ESM instrumentation packages would try to instrument CJS exports on ESM, causing the end-user application to crash.
* This breaking change only affects users that are using the *experimental* `@opentelemetry/instrumentation/hook.mjs` loader hook AND Node.js 18.19 or later:
* This reverts back to an older version of `import-in-the-middle` due to <https://github.com/DataDog/import-in-the-middle/issues/57>
* This version does not support Node.js 18.19 or later

### :bug: (Bug Fix)

* fix(exporter-prometheus): avoid invoking callback synchronously [#4431](https://github.com/open-telemetry/opentelemetry-js/pull/4431) @legendecas
* fix(exporter-logs-otlp-grpc): set User-Agent header [#4398](https://github.com/open-telemetry/opentelemetry-js/pull/4398) @Vunovati
* fix(exporter-logs-otlp-http): set User-Agent header [#4398](https://github.com/open-telemetry/opentelemetry-js/pull/4398) @Vunovati
* fix(exporter-logs-otlp-proto): set User-Agent header [#4398](https://github.com/open-telemetry/opentelemetry-js/pull/4398) @Vunovati
* fix(instrumentation-fetch): compatibility with Map types for fetch headers

### :house: (Internal)

* refactor(exporter-prometheus): promisify prometheus tests [#4431](https://github.com/open-telemetry/opentelemetry-js/pull/4431) @legendecas

## 0.47.0

### :boom: Breaking Change
Expand Down
6 changes: 3 additions & 3 deletions experimental/backwards-compatibility/node14/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backcompat-node14",
"version": "0.47.0",
"version": "0.48.0",
"private": true,
"description": "Backwards compatibility app for node 14 types and the OpenTelemetry Node.js SDK",
"main": "index.js",
Expand All @@ -9,8 +9,8 @@
"peer-api-check": "node ../../../scripts/peer-api-check.js"
},
"dependencies": {
"@opentelemetry/sdk-node": "0.47.0",
"@opentelemetry/sdk-trace-base": "1.20.0"
"@opentelemetry/sdk-node": "0.48.0",
"@opentelemetry/sdk-trace-base": "1.21.0"
},
"devDependencies": {
"@types/node": "14.18.25",
Expand Down
6 changes: 3 additions & 3 deletions experimental/backwards-compatibility/node16/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backcompat-node16",
"version": "0.47.0",
"version": "0.48.0",
"private": true,
"description": "Backwards compatibility app for node 16 types and the OpenTelemetry Node.js SDK",
"main": "index.js",
Expand All @@ -9,8 +9,8 @@
"peer-api-check": "node ../../../scripts/peer-api-check.js"
},
"dependencies": {
"@opentelemetry/sdk-node": "0.47.0",
"@opentelemetry/sdk-trace-base": "1.20.0"
"@opentelemetry/sdk-node": "0.48.0",
"@opentelemetry/sdk-trace-base": "1.21.0"
},
"devDependencies": {
"@types/node": "16.11.52",
Expand Down
6 changes: 3 additions & 3 deletions experimental/examples/logs/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "logs-example",
"version": "0.47.0",
"version": "0.48.0",
"private": true,
"scripts": {
"start": "ts-node index.ts"
},
"dependencies": {
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/api-logs": "0.47.0",
"@opentelemetry/sdk-logs": "0.47.0"
"@opentelemetry/api-logs": "0.48.0",
"@opentelemetry/sdk-logs": "0.48.0"
},
"devDependencies": {
"@types/node": "18.6.5",
Expand Down
16 changes: 8 additions & 8 deletions experimental/examples/opencensus-shim/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opencensus-shim",
"private": true,
"version": "0.47.0",
"version": "0.48.0",
"description": "Example of using @opentelemetry/shim-opencensus in Node.js",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -31,13 +31,13 @@
"@opencensus/instrumentation-http": "0.1.0",
"@opencensus/nodejs-base": "0.1.0",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/exporter-prometheus": "0.47.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.47.0",
"@opentelemetry/resources": "1.20.0",
"@opentelemetry/sdk-metrics": "1.20.0",
"@opentelemetry/sdk-trace-node": "1.20.0",
"@opentelemetry/semantic-conventions": "1.20.0",
"@opentelemetry/shim-opencensus": "0.47.0"
"@opentelemetry/exporter-prometheus": "0.48.0",
"@opentelemetry/exporter-trace-otlp-grpc": "0.48.0",
"@opentelemetry/resources": "1.21.0",
"@opentelemetry/sdk-metrics": "1.21.0",
"@opentelemetry/sdk-trace-node": "1.21.0",
"@opentelemetry/semantic-conventions": "1.21.0",
"@opentelemetry/shim-opencensus": "0.48.0"
},
"homepage": "https://github.com/open-telemetry/opentelemetry-js/tree/main/experimental/examples/opencensus-shim"
}
1 change: 1 addition & 0 deletions experimental/examples/prometheus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ If you are using the default configurations, the prometheus client will be avail

<p align="center"><img src="images/prom-counter.png?raw=true"/></p>
<p align="center"><img src="images/prom-updowncounter.png?raw=true"/></p>
<p align="center"><img src="images/prom-gauge.png?raw=true"/></p>

## Useful links

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 17 additions & 0 deletions experimental/examples/prometheus/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,23 @@ observableCounter.addCallback(observableResult => {
observableResult.observe(counter, attributes);
});

const randomMetricPromise = async () =>
new Promise(resolve =>
setTimeout(resolve(Math.floor(Math.random() * 100)), 50)
);

const observableGauge = meter.createObservableGauge(
'observable_gauge_requests',
{
description: 'Example of an ObservableGauge',
}
);
// Callbacks are run when metrics are scraped
observableGauge.addCallback(async observableResult => {
const value = await randomMetricPromise();
observableResult.observe(value, attributes);
});

// Record metrics
setInterval(() => {
counter++;
Expand Down
Loading

0 comments on commit e4eb1a1

Please sign in to comment.