Skip to content

Commit a46e6d0

Browse files
david-lunatrentm
andauthored
chore: add debug logs for configs affecting Kibana UI (#737)
Co-authored-by: Trent Mick <[email protected]>
1 parent 2641e46 commit a46e6d0

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

packages/opentelemetry-node/lib/detectors.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,14 @@ function resolveDetectors(detectors) {
9797
return [];
9898
}
9999

100+
// NOTE: Kibana is doing a breakdown by service instance when plotting the metrics dashboard. So it needs the instance ID.
101+
// Dashboard was added in https://github.com/elastic/kibana/pull/215735
102+
if (!detectorKeys.includes('serviceinstance')) {
103+
log.info(
104+
`The "serviceinstance" resource detector has not been selected. This will result in Kibana's APM Service Metrics dashboard not working. See https://elastic.github.io/opentelemetry/edot-sdks/nodejs/configuration.html#otel_node_resource_detectors-details`
105+
);
106+
}
107+
100108
/** @type {Array<ResourceDetector | ResourceDetector[]>} */
101109
const resolvedDetectors = [distroDetector];
102110
for (const key of detectorKeys) {

packages/opentelemetry-node/lib/environment.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ const envToRestore = {};
1010
* Tweak `process.env` before calling NodeSDK.
1111
*/
1212
function setupEnvironment() {
13-
if (!('OTEL_TRACES_EXPORTER' in process.env)) {
14-
// Ensure this envvar is set to avoid a diag.warn() in NodeSDK.
15-
process.env.OTEL_TRACES_EXPORTER = 'otlp';
16-
}
17-
1813
if ('OTEL_LOG_LEVEL' in process.env) {
1914
envToRestore['OTEL_LOG_LEVEL'] = process.env.OTEL_LOG_LEVEL;
2015
// Make sure NodeSDK doesn't see this envvar and overwrite our diag

packages/opentelemetry-node/lib/sdk.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,20 @@ function startNodeSDK(cfg = {}) {
134134
// TODO: support `OTEL_METRICS_EXPORTER`, including being a list of exporters (e.g. console, debug)
135135
// TODO: metrics exporter should do for metrics what `TracerProviderWithEnvExporters` does for traces, does that include `url` export endpoint?
136136

137+
// Setting default temporality to delta to avoid histogram storing issues in ES.
138+
// Or log if there is a different value set by the user
139+
// Ref: https://github.com/elastic/opentelemetry/pull/63
137140
const temporalityPreference = getStringFromEnv(
138141
'OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE'
139142
);
140143
if (typeof temporalityPreference === 'undefined') {
141-
// Setting default temporality to delta to avoid histogram storing issues in ES
142-
// Ref: https://github.com/elastic/opentelemetry/pull/63
143144
process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE = 'delta';
145+
} else if (temporalityPreference !== 'delta') {
146+
const docsUrl =
147+
'https://elastic.github.io/opentelemetry/compatibility/limitations.html#ingestion-of-metrics-data';
148+
log.info(
149+
`Metrics temporality preference set to "${temporalityPreference}". Use "delta" temporality if you want to store Histogram metrics in Elasticsearch. See ${docsUrl}`
150+
);
144151
}
145152

146153
// The implementation in SDK does treats the undefined and 'none' value

0 commit comments

Comments
 (0)