Skip to content

Commit

Permalink
feat: enhancements to OpenTelemetry support
Browse files Browse the repository at this point in the history
  • Loading branch information
evansims committed Aug 30, 2024
1 parent 4d9ddfc commit 3fe9b36
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,14 +226,26 @@ export const createRequestFunction = function (axiosArgs: RequestArgs, axiosInst
attributes,
});

attributes = telemetryAttributes.prepare(attributes);

if (attributes[TelemetryAttributes.httpServerRequestDuration.name]) {
telemetryMetrics.histogram(TelemetryHistograms.queryDuration, parseInt(attributes[TelemetryAttributes.httpServerRequestDuration.name] as string, 10), attributes);
telemetryMetrics.histogram(
TelemetryHistograms.queryDuration,
parseInt(attributes[TelemetryAttributes.httpServerRequestDuration.name] as string, 10),
telemetryAttributes.prepare(
attributes,
Object.keys(configuration.telemetryConfig.metrics.histogramQueryDuration.attributes())
)
);
}

if (attributes[TelemetryAttributes.httpClientRequestDuration.name]) {
telemetryMetrics.histogram(TelemetryHistograms.requestDuration, Date.now() - start, attributes);
telemetryMetrics.histogram(
TelemetryHistograms.requestDuration,
Date.now() - start,
telemetryAttributes.prepare(
attributes,
Object.keys(configuration.telemetryConfig.metrics.histogramRequestDuration.attributes())
)
);
}

return result;
Expand Down

0 comments on commit 3fe9b36

Please sign in to comment.