Skip to content

Commit

Permalink
Merge branch 'main' into fix/round-timestamp-in-zipkin-annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Sep 28, 2023
2 parents bba7814 + 513d067 commit 6a60367
Show file tree
Hide file tree
Showing 70 changed files with 617 additions and 507 deletions.
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.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/webpack": "4.41.33",
"@types/sinon": "10.0.17",
"@types/webpack": "4.41.34",
"@types/webpack-env": "1.16.3",
"codecov": "3.8.3",
"cross-var": "1.1.0",
Expand Down
1 change: 1 addition & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ All notable changes to experimental packages in this project will be documented

### :bug: (Bug Fix)

* fix(otlp-transformer): Avoid precision loss when converting from HrTime to unix nanoseconds. [#4062](https://github.com/open-telemetry/opentelemetry-js/pull/4062)
* fix(exporter-logs-otlp-http): add @opentelemetry/api-logs as dependency

## 0.41.2
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.1",
"@types/mocha": "10.0.2",
"@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.1",
"@types/mocha": "10.0.2",
"@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.43.0",
"@opentelemetry/otlp-exporter-base": "0.43.0",
"@opentelemetry/resources": "1.17.0",
"@types/mocha": "10.0.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/sinon": "10.0.17",
"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 @@ -88,7 +88,7 @@ export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) {
ensureExportedAttributesAreCorrect(logRecord.attributes);
assert.strictEqual(
logRecord.timeUnixNano,
'1680253513123241728',
'1680253513123241635',
'timeUnixNano is wrong'
);
assert.strictEqual(
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.0",
"@types/mocha": "10.0.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/sinon": "10.0.17",
"@types/webpack-env": "1.16.3",
"babel-loader": "8.3.0",
"babel-plugin-istanbul": "6.1.1",
Expand Down
14 changes: 10 additions & 4 deletions experimental/packages/exporter-logs-otlp-http/test/logHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { Resource } from '@opentelemetry/resources';
import * as assert from 'assert';
import { VERSION } from '@opentelemetry/core';
import {
hrTimeToFixed64Nanos,
IAnyValue,
IExportLogsServiceRequest,
IKeyValue,
Expand Down Expand Up @@ -76,17 +77,22 @@ 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.strictEqual(
assert.deepStrictEqual(
logRecord.timeUnixNano,
1680253513123241700,
hrTimeToFixed64(mockedReadableLogRecord.hrTime),
'timeUnixNano is wrong'
);
assert.strictEqual(
assert.deepStrictEqual(
logRecord.observedTimeUnixNano,
1680253513123241700,
hrTimeToFixed64(mockedReadableLogRecord.hrTimeObserved),
'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.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/sinon": "10.0.17",
"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 @@ -82,12 +82,12 @@ export function ensureExportedLogRecordIsCorrect(logRecord: ILogRecord) {
ensureExportedAttributesAreCorrect(logRecord.attributes);
assert.strictEqual(
logRecord.timeUnixNano,
'1680253513123241728',
'1680253513123241635',
'timeUnixNano is wrong'
);
assert.strictEqual(
logRecord.observedTimeUnixNano,
'1680253513123241728',
'1680253513123241635',
'observedTimeUnixNano is wrong'
);
assert.strictEqual(
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.3",
"@opentelemetry/api": "1.6.0",
"@opentelemetry/otlp-exporter-base": "0.43.0",
"@types/mocha": "10.0.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/sinon": "10.0.17",
"codecov": "3.8.3",
"cpx": "1.5.0",
"cross-var": "1.1.0",
Expand Down
20 changes: 10 additions & 10 deletions experimental/packages/exporter-trace-otlp-grpc/test/traceHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,49 +114,49 @@ export function ensureExportedEventsAreCorrect(events: IEvent[]) {
[
{
attributes: [],
timeUnixNano: '1574120165429803008',
timeUnixNano: '1574120165429803070',
name: 'fetchStart',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165429803008',
timeUnixNano: '1574120165429803070',
name: 'domainLookupStart',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165429803008',
timeUnixNano: '1574120165429803070',
name: 'domainLookupEnd',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165429803008',
timeUnixNano: '1574120165429803070',
name: 'connectStart',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165429803008',
timeUnixNano: '1574120165429803070',
name: 'connectEnd',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165435513088',
timeUnixNano: '1574120165435513070',
name: 'requestStart',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165436923136',
timeUnixNano: '1574120165436923070',
name: 'responseStart',
droppedAttributesCount: 0,
},
{
attributes: [],
timeUnixNano: '1574120165438688000',
timeUnixNano: '1574120165438688070',
name: 'responseEnd',
droppedAttributesCount: 0,
},
Expand Down Expand Up @@ -235,12 +235,12 @@ export function ensureExportedSpanIsCorrect(span: ISpan) {
assert.strictEqual(span.kind, 'SPAN_KIND_INTERNAL', 'kind is wrong');
assert.strictEqual(
span.startTimeUnixNano,
'1574120165429803008',
'1574120165429803070',
'startTimeUnixNano is wrong'
);
assert.strictEqual(
span.endTimeUnixNano,
'1574120165438688000',
'1574120165438688070',
'endTimeUnixNano is wrong'
);
assert.strictEqual(
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.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/sinon": "10.0.17",
"@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 @@ -316,7 +316,6 @@ describe('OTLPTraceExporter - node with json over http', () => {

fakeRequest.on('end', () => {
const responseBody = buff.toString();

const json = JSON.parse(responseBody) as IExportTraceServiceRequest;
const span1 = json.resourceSpans?.[0].scopeSpans?.[0].spans?.[0];
assert.ok(typeof span1 !== 'undefined', "span doesn't exist");
Expand Down
30 changes: 18 additions & 12 deletions experimental/packages/exporter-trace-otlp-http/test/traceHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
ILink,
IResource,
ISpan,
UnsignedLong,
} from '@opentelemetry/otlp-transformer';

if (typeof Buffer === 'undefined') {
Expand Down Expand Up @@ -243,54 +244,59 @@ 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: 1574120165429803000,
timeUnixNano: fixed64FromString('1574120165429803070'),
name: 'fetchStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165429803000,
timeUnixNano: fixed64FromString('1574120165429803070'),
name: 'domainLookupStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165429803000,
timeUnixNano: fixed64FromString('1574120165429803070'),
name: 'domainLookupEnd',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165429803000,
timeUnixNano: fixed64FromString('1574120165429803070'),
name: 'connectStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165429803000,
timeUnixNano: fixed64FromString('1574120165429803070'),
name: 'connectEnd',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165435513000,
timeUnixNano: fixed64FromString('1574120165435513070'),
name: 'requestStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165436923100,
timeUnixNano: fixed64FromString('1574120165436923070'),
name: 'responseStart',
attributes: [],
droppedAttributesCount: 0,
},
{
timeUnixNano: 1574120165438688000,
timeUnixNano: fixed64FromString('1574120165438688070'),
name: 'responseEnd',
attributes: [],
droppedAttributesCount: 0,
Expand Down Expand Up @@ -364,14 +370,14 @@ export function ensureSpanIsCorrect(span: ISpan, useHex = true) {
);
assert.strictEqual(span.name, 'documentFetch', 'name is wrong');
assert.strictEqual(span.kind, ESpanKind.SPAN_KIND_INTERNAL, 'kind is wrong');
assert.strictEqual(
assert.deepStrictEqual(
span.startTimeUnixNano,
1574120165429803008,
fixed64FromString('1574120165429803070'),
'startTimeUnixNano is wrong'
);
assert.strictEqual(
assert.deepStrictEqual(
span.endTimeUnixNano,
1574120165438688000,
fixed64FromString('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.1",
"@types/mocha": "10.0.2",
"@types/node": "18.6.5",
"@types/sinon": "10.0.16",
"@types/sinon": "10.0.17",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
"cpx": "1.5.0",
Expand Down
Loading

0 comments on commit 6a60367

Please sign in to comment.