Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream' into fix/zonejs-version
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc committed Dec 14, 2023
2 parents 80de34d + dddab06 commit e0ffaa7
Show file tree
Hide file tree
Showing 65 changed files with 777 additions and 523 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/close-stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v8
- uses: actions/stale@v9
with:
days-before-stale: 60
days-before-close: 14
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
cache: 'npm'
cache-dependency-path: |
package-lock.json
node-version: '16'
node-version: '20'

- name: Lint changelog file
uses: avto-dev/markdown-lint@v1
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :bug: (Bug Fix)

* fix(api-logs): allow for TimeInput type for LogRecord timestamps [#4345](https://github.com/open-telemetry/opentelemetry-js/pull/4345)
* fix(sdk-trace-web): only access location if it is defined [#4063](https://github.com/open-telemetry/opentelemetry-js/pull/4063)
* fix(sdk-trace-base): processor onStart called with a span having empty attributes

Expand Down
4 changes: 2 additions & 2 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,10 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"@types/webpack": "4.41.36",
"@types/webpack": "4.41.38",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
Expand Down
7 changes: 7 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,21 @@ All notable changes to experimental packages in this project will be documented

### :boom: Breaking Change

* fix(exporter-metrics-otlp-grpc): programatic headers take precedence over environment variables [#2370](https://github.com/open-telemetry/opentelemetry-js/pull/4334) @Vunovati
* fix(exporter-metrics-otlp-http): programatic headers take precedence over environment variables [#2370](https://github.com/open-telemetry/opentelemetry-js/pull/4334) @Vunovati
* fix(exporter-metrics-otlp-proto): programatic headers take precedence over environment variables [#2370](https://github.com/open-telemetry/opentelemetry-js/pull/4334) @Vunovati

### :rocket: (Enhancement)

* feat(sdk-logs): add droppedAttributesCount field to ReadableLogRecord

### :bug: (Bug Fix)

* fix(sdk-logs): avoid map attribute set when count limit exceeded
* fix(instrumentation-fetch): only access navigator if it is defined [#4063](https://github.com/open-telemetry/opentelemetry-js/pull/4063)
* allows for experimental usage of this instrumentation with non-browser runtimes
* fix(instrumentation-http): memory leak when responses are not resumed
* fix(instrumentation-http): Do not mutate given headers object for outgoing http requests. Fixes aws-sdk signing error on retries. [#4346](https://github.com/open-telemetry/opentelemetry-js/pull/4346)

## 0.45.1

Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/api-events/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@opentelemetry/api": "^1.0.0"
},
"devDependencies": {
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
Expand Down
2 changes: 1 addition & 1 deletion experimental/packages/api-logs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@opentelemetry/api": "^1.0.0"
},
"devDependencies": {
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
Expand Down
6 changes: 3 additions & 3 deletions experimental/packages/api-logs/src/types/LogRecord.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { AttributeValue, Context } from '@opentelemetry/api';
import { AttributeValue, Context, TimeInput } from '@opentelemetry/api';

export type LogAttributeValue = AttributeValue | LogAttributes;
export interface LogAttributes {
Expand Down Expand Up @@ -53,12 +53,12 @@ export interface LogRecord {
/**
* The time when the log record occurred as UNIX Epoch time in nanoseconds.
*/
timestamp?: number;
timestamp?: TimeInput;

/**
* Time when the event was observed by the collection system.
*/
observedTimestamp?: number;
observedTimestamp?: TimeInput;

/**
* Numerical value of the severity.
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-logs-otlp-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/api-logs": "0.45.1",
"@opentelemetry/otlp-exporter-base": "0.45.1",
"@opentelemetry/resources": "1.18.1",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const mockedReadableLogRecord: ReadableLogRecord = {
attributes: {
'some-attribute': 'some attribute value',
},
droppedAttributesCount: 0,
severityNumber: SeverityNumber.ERROR,
severityText: 'error',
body: 'some_log_body',
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-logs-otlp-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@
],
"sideEffects": false,
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/resources": "1.18.1",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const mockedReadableLogRecord: ReadableLogRecord = {
attributes: {
'some-attribute': 'some attribute value',
},
droppedAttributesCount: 0,
severityNumber: SeverityNumber.ERROR,
severityText: 'error',
body: 'some_log_body',
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-logs-otlp-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"babel-plugin-istanbul": "6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const mockedReadableLogRecord: ReadableLogRecord = {
attributes: {
'some-attribute': 'some attribute value',
},
droppedAttributesCount: 0,
severityNumber: SeverityNumber.ERROR,
severityText: 'error',
body: 'some_log_body',
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-grpc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.7.0",
"@opentelemetry/otlp-exporter-base": "0.45.1",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-http/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",
Expand Down
4 changes: 2 additions & 2 deletions experimental/packages/exporter-trace-otlp-proto/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"babel-plugin-istanbul": "6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,9 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"babel-plugin-istanbul": "6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase<
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
),
...config?.headers,
};

this.metadata ||= new Metadata();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,15 @@ describe('when configuring via environment', () => {
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = '';
envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = '';
});
it('should use override url defined in env with url defined in constructor', () => {
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/metrics';
const constructorDefinedEndpoint = 'http://constructor/v1/metrics';
const collectorExporter = new OTLPMetricExporter({
url: constructorDefinedEndpoint,
});
assert.strictEqual(collectorExporter._otlpExporter.url, 'constructor');
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = '';
});
it('should use headers defined via env', () => {
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar';
const collectorExporter = new OTLPMetricExporter();
Expand Down Expand Up @@ -363,6 +372,23 @@ describe('when configuring via environment', () => {
envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = '';
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
});
it('should override headers defined via env with headers defined in constructor', () => {
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo';
const collectorExporter = new OTLPMetricExporter({
headers: {
foo: 'constructor',
},
});
assert.deepStrictEqual(
collectorExporter._otlpExporter.metadata?.get('foo'),
['constructor']
);
assert.deepStrictEqual(
collectorExporter._otlpExporter.metadata?.get('bar'),
['foo']
);
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
});
});

testOTLPMetricExporter({ useTLS: true });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase<
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
),
...config?.headers,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ describe('OTLPMetricExporter - node with json over http', () => {
);
envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = '';
});
it('should use override url defined in env with url defined in constructor', () => {
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/metrics';
const constructorDefinedEndpoint = 'http://constructor/v1/metrics';
const collectorExporter = new OTLPMetricExporter({
url: constructorDefinedEndpoint,
});
assert.strictEqual(
collectorExporter._otlpExporter.url,
constructorDefinedEndpoint
);
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = '';
});
it('should use headers defined via env', () => {
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar';
const collectorExporter = new OTLPMetricExporter();
Expand All @@ -318,6 +330,20 @@ describe('OTLPMetricExporter - node with json over http', () => {
envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = '';
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
});
it('should override headers defined via env with headers defined in constructor', () => {
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo';
const collectorExporter = new OTLPMetricExporter({
headers: {
foo: 'constructor',
},
});
assert.strictEqual(
collectorExporter._otlpExporter.headers.foo,
'constructor'
);
assert.strictEqual(collectorExporter._otlpExporter.headers.bar, 'foo');
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
});
it('should use delta temporality defined via env', () => {
for (const envValue of ['delta', 'DELTA', 'DeLTa', 'delta ']) {
envSource.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = envValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"access": "public"
},
"devDependencies": {
"@babel/core": "7.23.3",
"@babel/core": "7.23.6",
"@opentelemetry/api": "1.7.0",
"@types/mocha": "10.0.4",
"@types/mocha": "10.0.6",
"@types/node": "18.6.5",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class OTLPMetricExporterNodeProxy extends OTLPProtoExporterNodeBase<
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
),
...config?.headers,
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ describe('OTLPMetricExporter - node with proto over http', () => {
);
envSource.OTEL_EXPORTER_OTLP_METRICS_ENDPOINT = '';
});
it('should use override url defined in env with url defined in constructor', () => {
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = 'http://foo.bar/v1/metrics';
const constructorDefinedEndpoint = 'http://constructor/v1/metrics';
const collectorExporter = new OTLPMetricExporter({
url: constructorDefinedEndpoint,
});
assert.strictEqual(
collectorExporter._otlpExporter.url,
constructorDefinedEndpoint
);
envSource.OTEL_EXPORTER_OTLP_ENDPOINT = '';
});
it('should use headers defined via env', () => {
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar';
const collectorExporter = new OTLPMetricExporter();
Expand All @@ -163,6 +175,20 @@ describe('OTLPMetricExporter - node with proto over http', () => {
envSource.OTEL_EXPORTER_OTLP_METRICS_HEADERS = '';
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
});
it('should override headers defined via env with headers defined in constructor', () => {
envSource.OTEL_EXPORTER_OTLP_HEADERS = 'foo=bar,bar=foo';
const collectorExporter = new OTLPMetricExporter({
headers: {
foo: 'constructor',
},
});
assert.strictEqual(
collectorExporter._otlpExporter.headers.foo,
'constructor'
);
assert.strictEqual(collectorExporter._otlpExporter.headers.bar, 'foo');
envSource.OTEL_EXPORTER_OTLP_HEADERS = '';
});
});

describe('export', () => {
Expand Down
Loading

0 comments on commit e0ffaa7

Please sign in to comment.