Skip to content

Commit

Permalink
workaround for bug/behaviour in otlp-metrics-exporter (#26)
Browse files Browse the repository at this point in the history
A bug in the OpenTelemetry JavaScript library related to passing an options object with undefined headers to certain exporters can lead to an application crash because of an attempt to access an undefined property. 

The reported fix should involve adding proper validation for headers in the affected exporters to prevent passing undefined values. This would prevent the crash from occurring in end-user applications.
---------

Co-authored-by: m.witti <moritz.witti@liwest.at>
  • Loading branch information
moflwi and moflwi authored Mar 13, 2024
1 parent bcd24a7 commit de49a1e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Backend/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ function opentelemetry_create() {
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: process.env.OPENTELEMETRY_METRICS_API_ENDPOINT,
headers: { Authorization: process.env.OPENTELEMETRY_METRICS_API_TOKEN },
headers: { Authorization: process.env.OPENTELEMETRY_METRICS_API_TOKEN ? process.env.OPENTELEMETRY_METRICS_API_TOKEN : 'undefined'},
temporalityPreference: AggregationTemporality.DELTA
}),
exportIntervalMillis: 5000,
Expand Down
2 changes: 1 addition & 1 deletion Backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "philbot-backend",
"version": "3.12.3",
"version": "3.12.4",
"author": "philipp-lengauer <p.lengauer@gmail.com>",
"dependencies": {
"form-data": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion DiscordGateway2HTTP/opentelemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ function create() {
metricReader: new opentelemetry_metrics.PeriodicExportingMetricReader({
exporter: new opentelemetry_metrics_otlp.OTLPMetricExporter({
url: process.env.OPENTELEMETRY_METRICS_API_ENDPOINT,
headers: { Authorization: process.env.OPENTELEMETRY_METRICS_API_TOKEN },
headers: { Authorization: process.env.OPENTELEMETRY_METRICS_API_TOKEN ? process.env.OPENTELEMETRY_METRICS_API_TOKEN : 'undefined'},
temporalityPreference: opentelemetry_metrics.AggregationTemporality.DELTA
}),
exportIntervalMillis: 5000,
Expand Down
2 changes: 1 addition & 1 deletion DiscordGateway2HTTP/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "philbot-discordgateway2http",
"version": "2.3.3",
"version": "2.3.4",
"author": "philipp-lengauer <p.lengauer@gmail.com>",
"description": "connects to the discord gateway and forwards all events via HTTP(s) to a pre-configured endpoint",
"type": "module",
Expand Down

0 comments on commit de49a1e

Please sign in to comment.