Skip to content

Commit

Permalink
Merge branch 'main' into issue-4248
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Nov 6, 2023
2 parents 42bb776 + cd232cd commit fae8be2
Show file tree
Hide file tree
Showing 71 changed files with 725 additions and 692 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

### :bug: (Bug Fix)

* fix(core): remove re-export of `version.ts` [#4225](https://github.com/open-telemetry/opentelemetry-js/pull/4225) @david-luna

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
6 changes: 3 additions & 3 deletions api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@
"access": "public"
},
"devDependencies": {
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/webpack": "4.41.34",
"@types/sinon": "10.0.20",
"@types/webpack": "4.41.35",
"@types/webpack-env": "1.16.3",
"codecov": "3.8.3",
"cross-var": "1.1.0",
Expand Down
3 changes: 3 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ All notable changes to experimental packages in this project will be documented
* fix(sdk-node): remove the explicit dependency on @opentelemetry/exporter-jaeger that was kept on the previous release
* '@opentelemetry/exporter-jaeger' is no longer be a dependency of this package. To continue using '@opentelemetry/exporter-jaeger', please install it manually.
* NOTE: `@opentelemetry/exporter-jaeger` is deprecated, consider switching to one of the alternatives described [here](https://www.npmjs.com/package/@opentelemetry/exporter-jaeger)
* fix(otlp-transformer): OTLP json encoding [#4220](https://github.com/open-telemetry/opentelemetry-js/pull/4220) @seemk
* Fixes a bug in the OTLP (http/json) exporters where timestamps were not encoded as strings, causing the export to
be rejected by OTLP endpoints

### :books: (Refine Doc)

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.2",
"@types/mocha": "10.0.3",
"@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.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/webpack-env": "1.16.3",
"babel-plugin-istanbul": "6.1.1",
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 @@ -54,9 +54,9 @@
"@opentelemetry/api-logs": "0.44.0",
"@opentelemetry/otlp-exporter-base": "0.44.0",
"@opentelemetry/resources": "1.17.1",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
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 @@ -74,9 +74,9 @@
"@babel/core": "7.22.20",
"@opentelemetry/api": "1.6.0",
"@opentelemetry/resources": "1.17.1",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",
"babel-loader": "8.3.0",
"babel-plugin-istanbul": "6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export class OTLPLogExporter
}

convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest {
return createExportLogsServiceRequest(logRecords, true);
return createExportLogsServiceRequest(logRecords, {
useHex: true,
useLongBits: false,
});
}

getDefaultUrl(config: OTLPExporterConfigBase): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ export class OTLPLogExporter
}

convert(logRecords: ReadableLogRecord[]): IExportLogsServiceRequest {
return createExportLogsServiceRequest(logRecords, true);
return createExportLogsServiceRequest(logRecords, {
useHex: true,
useLongBits: false,
});
}

getDefaultUrl(config: OTLPExporterNodeConfigBase): string {
Expand Down
10 changes: 2 additions & 8 deletions experimental/packages/exporter-logs-otlp-http/test/logHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import { Resource } from '@opentelemetry/resources';
import * as assert from 'assert';
import { VERSION } from '@opentelemetry/core';
import {
hrTimeToFixed64Nanos,
IAnyValue,
IExportLogsServiceRequest,
IKeyValue,
Expand Down Expand Up @@ -77,22 +76,17 @@ export function ensureExportedBodyIsCorrect(body?: IAnyValue) {
);
}

function hrTimeToFixed64(hrTime: HrTime) {
const { low, high } = hrTimeToFixed64Nanos(hrTime);
return { low, high };
}

export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) {
ensureExportedBodyIsCorrect(logRecord.body);
ensureExportedAttributesAreCorrect(logRecord.attributes);
assert.deepStrictEqual(
logRecord.timeUnixNano,
hrTimeToFixed64(mockedReadableLogRecord.hrTime),
'1680253513123241635',
'timeUnixNano is wrong'
);
assert.deepStrictEqual(
logRecord.observedTimeUnixNano,
hrTimeToFixed64(mockedReadableLogRecord.hrTimeObserved),
'1680253513123241635',
'observedTimeUnixNano is wrong'
);
assert.strictEqual(
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 @@ -65,9 +65,9 @@
"devDependencies": {
"@babel/core": "7.22.20",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
"cpx": "1.5.0",
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 @@ -51,9 +51,9 @@
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.6.0",
"@opentelemetry/otlp-exporter-base": "0.44.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
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 @@ -65,9 +65,9 @@
"devDependencies": {
"@babel/core": "7.22.20",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",
"babel-loader": "8.3.0",
"babel-plugin-istanbul": "6.1.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ export class OTLPTraceExporter
);
}
convert(spans: ReadableSpan[]): IExportTraceServiceRequest {
return createExportTraceServiceRequest(spans, true);
return createExportTraceServiceRequest(spans, {
useHex: true,
useLongBits: false,
});
}

getDefaultUrl(config: OTLPExporterConfigBase): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export class OTLPTraceExporter
}

convert(spans: ReadableSpan[]): IExportTraceServiceRequest {
return createExportTraceServiceRequest(spans, true);
return createExportTraceServiceRequest(spans, {
useHex: true,
useLongBits: false,
});
}

getDefaultUrl(config: OTLPExporterNodeConfigBase): string {
Expand Down
26 changes: 10 additions & 16 deletions experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import {
ILink,
IResource,
ISpan,
UnsignedLong,
} from '@opentelemetry/otlp-transformer';

if (typeof Buffer === 'undefined') {
Expand Down Expand Up @@ -244,59 +243,54 @@ export const multiInstrumentationLibraryTrace: ReadableSpan[] = [
},
];

function fixed64FromString(str: string) {
const { low, high } = UnsignedLong.fromString(str);
return { low, high };
}

export function ensureEventsAreCorrect(events: IEvent[]) {
assert.deepStrictEqual(
events,
[
{
timeUnixNano: fixed64FromString('1574120165429803070'),
timeUnixNano: '1574120165429803070',
name: 'fetchStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165429803070'),
timeUnixNano: '1574120165429803070',
name: 'domainLookupStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165429803070'),
timeUnixNano: '1574120165429803070',
name: 'domainLookupEnd',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165429803070'),
timeUnixNano: '1574120165429803070',
name: 'connectStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165429803070'),
timeUnixNano: '1574120165429803070',
name: 'connectEnd',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165435513070'),
timeUnixNano: '1574120165435513070',
name: 'requestStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165436923070'),
timeUnixNano: '1574120165436923070',
name: 'responseStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: fixed64FromString('1574120165438688070'),
timeUnixNano: '1574120165438688070',
name: 'responseEnd',
attributes: [],
droppedAttributesCount: 0,
Expand Down Expand Up @@ -372,12 +366,12 @@ export function ensureSpanIsCorrect(span: ISpan, useHex = true) {
assert.strictEqual(span.kind, ESpanKind.SPAN_KIND_INTERNAL, 'kind is wrong');
assert.deepStrictEqual(
span.startTimeUnixNano,
fixed64FromString('1574120165429803070'),
'1574120165429803070',
'startTimeUnixNano is wrong'
);
assert.deepStrictEqual(
span.endTimeUnixNano,
fixed64FromString('1574120165438688070'),
'1574120165438688070',
'endTimeUnixNano is wrong'
);
assert.strictEqual(
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 @@ -64,9 +64,9 @@
"devDependencies": {
"@babel/core": "7.22.20",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
"cpx": "1.5.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@
"devDependencies": {
"@babel/core": "7.22.20",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
"cross-var": "1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,9 @@
"@babel/core": "7.22.20",
"@grpc/proto-loader": "^0.7.10",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ import {
View,
} from '@opentelemetry/sdk-metrics';
import {
hrTimeToFixed64Nanos,
encodeAsString,
IKeyValue,
IMetric,
IResource,
UnsignedLong,
} from '@opentelemetry/otlp-transformer';

class TestMetricReader extends MetricReader {
Expand Down Expand Up @@ -152,14 +151,8 @@ export function ensureExportedCounterIsCorrect(
assert.strictEqual(dp.asInt, '1');
assert.strictEqual(dp.flags, 0);

assert.deepStrictEqual(
UnsignedLong.fromString(dp.startTimeUnixNano as string),
hrTimeToFixed64Nanos(startTime)
);
assert.deepStrictEqual(
UnsignedLong.fromString(dp.timeUnixNano as string),
hrTimeToFixed64Nanos(time)
);
assert.deepStrictEqual(dp.startTimeUnixNano, encodeAsString(startTime));
assert.deepStrictEqual(dp.timeUnixNano as string, encodeAsString(time));
}

export function ensureExportedObservableGaugeIsCorrect(
Expand All @@ -179,14 +172,8 @@ export function ensureExportedObservableGaugeIsCorrect(
assert.strictEqual(dp.asDouble, 6);
assert.strictEqual(dp.flags, 0);

assert.deepStrictEqual(
UnsignedLong.fromString(dp.startTimeUnixNano as string),
hrTimeToFixed64Nanos(startTime)
);
assert.deepStrictEqual(
UnsignedLong.fromString(dp.timeUnixNano as string),
hrTimeToFixed64Nanos(time)
);
assert.deepStrictEqual(dp.startTimeUnixNano, encodeAsString(startTime));
assert.deepStrictEqual(dp.timeUnixNano, encodeAsString(time));
}

export function ensureExportedHistogramIsCorrect(
Expand Down Expand Up @@ -215,14 +202,8 @@ export function ensureExportedHistogramIsCorrect(
assert.strictEqual(dp.min, 7);
assert.strictEqual(dp.max, 14);

assert.deepStrictEqual(
UnsignedLong.fromString(dp.startTimeUnixNano as string),
hrTimeToFixed64Nanos(startTime)
);
assert.deepStrictEqual(
UnsignedLong.fromString(dp.timeUnixNano as string),
hrTimeToFixed64Nanos(time)
);
assert.deepStrictEqual(dp.startTimeUnixNano, encodeAsString(startTime));
assert.deepStrictEqual(dp.timeUnixNano, encodeAsString(time));
assert.deepStrictEqual(dp.bucketCounts, bucketCounts);
assert.deepStrictEqual(dp.explicitBounds, explicitBounds);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@
"devDependencies": {
"@babel/core": "7.22.20",
"@opentelemetry/api": "1.6.0",
"@types/mocha": "10.0.2",
"@types/mocha": "10.0.3",
"@types/node": "18.6.5",
"@types/sinon": "10.0.19",
"@types/sinon": "10.0.20",
"@types/webpack-env": "1.16.3",
"babel-loader": "8.3.0",
"babel-plugin-istanbul": "6.1.1",
Expand Down
Loading

0 comments on commit fae8be2

Please sign in to comment.