From 5c2fde81a94029cc67cc1d088e56a8fb9b4d01d8 Mon Sep 17 00:00:00 2001 From: Aviv Guiser Date: Mon, 10 Jun 2024 22:20:57 +0300 Subject: [PATCH 1/7] add option to overwrite otlp service name/namespace/version with env var Signed-off-by: Aviv Guiser --- lib/instrumentation/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/instrumentation/index.ts b/lib/instrumentation/index.ts index 4ae908847b84a7..6f4a9c374394a2 100644 --- a/lib/instrumentation/index.ts +++ b/lib/instrumentation/index.ts @@ -43,9 +43,17 @@ export function init(): void { const traceProvider = new NodeTracerProvider({ resource: new Resource({ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value - [SemanticResourceAttributes.SERVICE_NAME]: 'renovate', - [SemanticResourceAttributes.SERVICE_NAMESPACE]: 'renovatebot.com', - [SemanticResourceAttributes.SERVICE_VERSION]: pkg.version, + [SemanticResourceAttributes.SERVICE_NAME]: process.env.OTEL_SERVICE_NAME + ? process.env.OTEL_SERVICE_NAME + : 'renovate', + [SemanticResourceAttributes.SERVICE_NAMESPACE]: process.env + .OTEL_SERVICE_NAMESPACE + ? process.env.OTEL_SERVICE_NAMESPACE + : 'renovatebot.com', + [SemanticResourceAttributes.SERVICE_VERSION]: process.env + .OTEL_SERVICE_VERSION + ? process.env.OTEL_SERVICE_VERSION + : pkg.version, }), }); From c63247dfdfdc3298478795d7f6a2143b30e56d36 Mon Sep 17 00:00:00 2001 From: Aviv Guiser Date: Tue, 11 Jun 2024 12:03:26 +0300 Subject: [PATCH 2/7] simplifed if condition Signed-off-by: Aviv Guiser --- lib/instrumentation/index.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/lib/instrumentation/index.ts b/lib/instrumentation/index.ts index 6f4a9c374394a2..c1a93491089551 100644 --- a/lib/instrumentation/index.ts +++ b/lib/instrumentation/index.ts @@ -43,17 +43,12 @@ export function init(): void { const traceProvider = new NodeTracerProvider({ resource: new Resource({ // https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/resource/semantic_conventions/README.md#semantic-attributes-with-sdk-provided-default-value - [SemanticResourceAttributes.SERVICE_NAME]: process.env.OTEL_SERVICE_NAME - ? process.env.OTEL_SERVICE_NAME - : 'renovate', - [SemanticResourceAttributes.SERVICE_NAMESPACE]: process.env - .OTEL_SERVICE_NAMESPACE - ? process.env.OTEL_SERVICE_NAMESPACE - : 'renovatebot.com', - [SemanticResourceAttributes.SERVICE_VERSION]: process.env - .OTEL_SERVICE_VERSION - ? process.env.OTEL_SERVICE_VERSION - : pkg.version, + [SemanticResourceAttributes.SERVICE_NAME]: + process.env.OTEL_SERVICE_NAME ?? 'renovate', + [SemanticResourceAttributes.SERVICE_NAMESPACE]: + process.env.OTEL_SERVICE_NAMESPACE ?? 'renovatebot.com', + [SemanticResourceAttributes.SERVICE_VERSION]: + process.env.OTEL_SERVICE_VERSION ?? pkg.version, }), }); From a05f82fa119174893d564cf1c5c4f9216fcdccdb Mon Sep 17 00:00:00 2001 From: Aviv Guiser Date: Tue, 11 Jun 2024 13:24:39 +0300 Subject: [PATCH 3/7] added docs for new env var Signed-off-by: Aviv Guiser --- docs/usage/opentelemetry.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/usage/opentelemetry.md b/docs/usage/opentelemetry.md index 0ff295ba39f4fe..60ac1bd532ea0b 100644 --- a/docs/usage/opentelemetry.md +++ b/docs/usage/opentelemetry.md @@ -30,6 +30,10 @@ This means that Renovate sends traces via [OTLP/HTTP](https://opentelemetry.io/d To activate the instrumentation, you must set the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable. This variable controls the endpoint for the telemetry data. Once this endpoint is set, you can use all environment variables listed in the [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md). +You can also set the following environment variables: +OTEL_SERVICE_NAME: to control the service name that will be emitted in traces +OTEL_SERVICE_NAMESPACE: to control the service namespace that will be emitted in traces +OTEL_SERVICE_VERSION: to control the service version that will be emitted in traces ## Debugging From 959215ff4f936af8b6731ab2d7ee0f2a3ec93274 Mon Sep 17 00:00:00 2001 From: Aviv Guiser Date: Tue, 11 Jun 2024 13:41:42 +0300 Subject: [PATCH 4/7] add default to docs Signed-off-by: Aviv Guiser --- docs/usage/opentelemetry.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/usage/opentelemetry.md b/docs/usage/opentelemetry.md index 60ac1bd532ea0b..b839ed4dd7a5b2 100644 --- a/docs/usage/opentelemetry.md +++ b/docs/usage/opentelemetry.md @@ -31,9 +31,9 @@ To activate the instrumentation, you must set the `OTEL_EXPORTER_OTLP_ENDPOINT` This variable controls the endpoint for the telemetry data. Once this endpoint is set, you can use all environment variables listed in the [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md). You can also set the following environment variables: -OTEL_SERVICE_NAME: to control the service name that will be emitted in traces -OTEL_SERVICE_NAMESPACE: to control the service namespace that will be emitted in traces -OTEL_SERVICE_VERSION: to control the service version that will be emitted in traces +OTEL_SERVICE_NAME: to control the service name that will be emitted in traces, defaults to `renovate` +OTEL_SERVICE_NAMESPACE: to control the service namespace that will be emitted in traces, defaults to `renovatebot.com` +OTEL_SERVICE_VERSION: to control the service version that will be emitted in traces, defaults to using the pkg version ## Debugging From 987cfa83197810e33cc78911e0cc8badbe93efc4 Mon Sep 17 00:00:00 2001 From: Aviv Guiser Date: Tue, 11 Jun 2024 19:13:45 +0300 Subject: [PATCH 5/7] reformat docs Signed-off-by: Aviv Guiser --- docs/usage/opentelemetry.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/usage/opentelemetry.md b/docs/usage/opentelemetry.md index b839ed4dd7a5b2..7373d757909884 100644 --- a/docs/usage/opentelemetry.md +++ b/docs/usage/opentelemetry.md @@ -31,9 +31,10 @@ To activate the instrumentation, you must set the `OTEL_EXPORTER_OTLP_ENDPOINT` This variable controls the endpoint for the telemetry data. Once this endpoint is set, you can use all environment variables listed in the [OpenTelemetry specification](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/configuration/sdk-environment-variables.md). You can also set the following environment variables: -OTEL_SERVICE_NAME: to control the service name that will be emitted in traces, defaults to `renovate` -OTEL_SERVICE_NAMESPACE: to control the service namespace that will be emitted in traces, defaults to `renovatebot.com` -OTEL_SERVICE_VERSION: to control the service version that will be emitted in traces, defaults to using the pkg version + +- `OTEL_SERVICE_NAME`: to control the service name that will be emitted in traces, defaults to `renovate` +- `OTEL_SERVICE_NAMESPAC`E: to control the service namespace that will be emitted in traces, defaults to `renovatebot.com` +- `OTEL_SERVICE_VERSION`: to control the service version that will be emitted in traces, defaults to using the pkg version ## Debugging From 99a439bbcc49ef79acfe4b5ac7895613ee8b3143 Mon Sep 17 00:00:00 2001 From: AvivGuiser Date: Tue, 11 Jun 2024 20:50:33 +0300 Subject: [PATCH 6/7] Update docs/usage/opentelemetry.md Co-authored-by: Sebastian Poxhofer --- docs/usage/opentelemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/opentelemetry.md b/docs/usage/opentelemetry.md index 7373d757909884..413549c0d60e0a 100644 --- a/docs/usage/opentelemetry.md +++ b/docs/usage/opentelemetry.md @@ -33,7 +33,7 @@ Once this endpoint is set, you can use all environment variables listed in the [ You can also set the following environment variables: - `OTEL_SERVICE_NAME`: to control the service name that will be emitted in traces, defaults to `renovate` -- `OTEL_SERVICE_NAMESPAC`E: to control the service namespace that will be emitted in traces, defaults to `renovatebot.com` +- `OTEL_SERVICE_NAMESPACE`: to control the service namespace that will be emitted in traces, defaults to `renovatebot.com` - `OTEL_SERVICE_VERSION`: to control the service version that will be emitted in traces, defaults to using the pkg version ## Debugging From 98330ded39fd15b2fa60e47061919e561fa47416 Mon Sep 17 00:00:00 2001 From: Sebastian Poxhofer Date: Wed, 12 Jun 2024 12:20:14 +0200 Subject: [PATCH 7/7] Update docs/usage/opentelemetry.md --- docs/usage/opentelemetry.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage/opentelemetry.md b/docs/usage/opentelemetry.md index 413549c0d60e0a..bfec6276211516 100644 --- a/docs/usage/opentelemetry.md +++ b/docs/usage/opentelemetry.md @@ -34,7 +34,7 @@ You can also set the following environment variables: - `OTEL_SERVICE_NAME`: to control the service name that will be emitted in traces, defaults to `renovate` - `OTEL_SERVICE_NAMESPACE`: to control the service namespace that will be emitted in traces, defaults to `renovatebot.com` -- `OTEL_SERVICE_VERSION`: to control the service version that will be emitted in traces, defaults to using the pkg version +- `OTEL_SERVICE_VERSION`: to control the service version that will be emitted in traces, defaults to using the release version of Renovate ## Debugging