Files
temporal/develop/docs
Stephan Behnke 587e0779e9 OTEL setup via environment variables (#5230)
## What changed?
<!-- Describe what has changed in this PR -->

- allow configuring a custom OTEL `service.name` prefix
- allow configuring an OTEL exporter via env vars (following the [OTEL
spec](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#configuration-options))

**Note that the OTEL exporter from the environment variables will only
be created if there isn't already one from the config.** Creating an
additional one wouldn't make any sense since the env variables would be
applied to both anyways and there would not be any difference between
them.

## Why?
<!-- Tell your future self why have you made these changes -->

Addresses:
- https://github.com/temporalio/temporal/issues/4042
- https://github.com/temporalio/temporal/issues/4041
- our own (increasing) need to enable OpenTelemetry tracing without
touching the Server config (for ad-hoc debugging when working on a SDK,
for example)

## How did you test it?
<!-- How have you verified this change? Tested locally? Added a unit
test? Checked in staging env? -->

I ran an OTEL collector to verify it sends the tracing exports.

These are the env vars I set to make it work:
```go
os.Setenv("OTEL_TRACES_EXPORTER", "oltp")
os.Setenv("OTEL_EXPORTER_OTLP_TRACES_INSECURE", "true")
```

## Potential risks
<!-- Assuming the worst case, what can be broken when deploying this
change to production? -->

I doubt anyone would accidentally have these env variables specified and
turn on OpenTelemetry by accident.

Unless these are specified; no behavior change occurs.

## Is hotfix candidate?
<!-- Is this PR a hotfix candidate or does it require a notification to
be sent to the broader community? (Yes/No) -->

No
2024-02-27 09:30:00 -08:00
..
2024-01-30 18:30:09 +00:00