Skip to content

Commit

Permalink
Merge branch 'main' into feat/transformer-serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
pichlermarc authored Mar 14, 2024
2 parents dfffc23 + 3a426e8 commit 92f2e42
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 11 deletions.
3 changes: 3 additions & 0 deletions experimental/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ All notable changes to experimental packages in this project will be documented

### :bug: (Bug Fix)

* fix(exporter-*-otlp-*): use parseHeaders() to ensure header-values are not 'undefined' #4540
* Fixes a bug where passing `undefined` as a header value would crash the end-user app after the export timeout elapsed.

### :books: (Refine Doc)

### :house: (Internal)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,13 @@ import type {
IExportLogsServiceResponse,
} from '@opentelemetry/otlp-transformer';
import { getEnv, baggageUtils } from '@opentelemetry/core';
import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base';
import {
OTLPExporterNodeBase,
parseHeaders,
} from '@opentelemetry/otlp-exporter-base';
import { JsonLogsSerializer } from '@opentelemetry/otlp-transformer';
import { createExportLogsServiceRequest } from '@opentelemetry/otlp-transformer';

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / browser-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / browser-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / browser-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-windows-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (14)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (16)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (18)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / webworker-tests

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

'createExportLogsServiceRequest' is declared but its value is never read.

Check failure on line 32 in experimental/packages/exporter-logs-otlp-http/src/platform/node/OTLPLogExporter.ts

View workflow job for this annotation

GitHub Actions / node-tests (20)

'createExportLogsServiceRequest' is declared but its value is never read.


import { getDefaultUrl } from '../config';
import { VERSION } from '../../version';
Expand Down Expand Up @@ -61,7 +66,7 @@ export class OTLPLogExporter
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS
),
...config.headers,
...parseHeaders(config?.headers),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
OTLPExporterNodeBase,
parseHeaders,
} from '@opentelemetry/otlp-exporter-base';
import { ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base';
import {
Expand Down Expand Up @@ -57,7 +58,7 @@ export class OTLPLogExporter
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_LOGS_HEADERS
),
...config.headers,
...parseHeaders(config?.headers),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@

import { ReadableSpan, SpanExporter } from '@opentelemetry/sdk-trace-base';
import { getEnv, baggageUtils } from '@opentelemetry/core';
import { OTLPExporterNodeBase } from '@opentelemetry/otlp-exporter-base';
import {
OTLPExporterNodeBase,
parseHeaders,
} from '@opentelemetry/otlp-exporter-base';
import {
OTLPExporterNodeConfigBase,
appendResourcePathToUrl,
Expand Down Expand Up @@ -54,7 +57,7 @@ export class OTLPTraceExporter
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS
),
...config.headers,
...parseHeaders(config?.headers),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
OTLPExporterNodeBase,
parseHeaders,
} from '@opentelemetry/otlp-exporter-base';
import { ServiceClientType } from '@opentelemetry/otlp-proto-exporter-base';
import {
Expand Down Expand Up @@ -55,7 +56,7 @@ export class OTLPTraceExporter
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_TRACES_HEADERS
),
...config.headers,
...parseHeaders(config?.headers),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
ProtobufMetricsSerializer,
} from '@opentelemetry/otlp-transformer';
import { VERSION } from './version';
import { parseHeaders } from '@opentelemetry/otlp-exporter-base';

const USER_AGENT = {
'User-Agent': `OTel-OTLP-Exporter-JavaScript/${VERSION}`,
Expand All @@ -48,7 +49,7 @@ class OTLPMetricExporterProxy extends OTLPGRPCExporterNodeBase<
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
),
...config?.headers,
...parseHeaders(config?.headers),
};
super(
config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import {
OTLPExporterNodeConfigBase,
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
parseHeaders,
} from '@opentelemetry/otlp-exporter-base';
import {
IExportMetricsServiceRequest,
Expand Down Expand Up @@ -50,7 +51,7 @@ class OTLPExporterNodeProxy extends OTLPExporterNodeBase<
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
),
...config?.headers,
...parseHeaders(config?.headers),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
appendResourcePathToUrl,
appendRootPathToUrlIfNeeded,
OTLPExporterNodeBase,
parseHeaders,
} from '@opentelemetry/otlp-exporter-base';
import {
IExportMetricsServiceRequest,
Expand Down Expand Up @@ -51,7 +52,7 @@ class OTLPMetricExporterNodeProxy extends OTLPExporterNodeBase<
...baggageUtils.parseKeyPairsIntoRecord(
getEnv().OTEL_EXPORTER_OTLP_METRICS_HEADERS
),
...config?.headers,
...parseHeaders(config?.headers),
};
}

Expand Down
4 changes: 3 additions & 1 deletion experimental/packages/otlp-exporter-base/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ export function parseHeaders(
if (typeof value !== 'undefined') {
headers[key] = String(value);
} else {
diag.warn(`Header "${key}" has wrong value and will be ignored`);
diag.warn(
`Header "${key}" has invalid value (${value}) and will be ignored`
);
}
});
return headers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('utils', () => {
const args = spyWarn.args[0];
assert.strictEqual(
args[0],
'Header "foo1" has wrong value and will be ignored'
'Header "foo1" has invalid value (undefined) and will be ignored'
);
});

Expand Down

0 comments on commit 92f2e42

Please sign in to comment.