2 Commits

Author SHA1 Message Date
releaser afac050279 chore(release): prepare for v0.3.1 (#145)
Release / release (push) Successful in 52s
otelsetup / vulnerabilities (push) Successful in 1m51s
otelsetup / test (push) Successful in 2m27s
pre-commit / pre-commit (push) Successful in 6m30s
## [0.3.1] - 2026-05-29

### 🐛 Bug Fixes

- Set service.instance.id for unique instance label (#144)

<!-- generated by git-cliff -->

---

**Note:** Please use **Squash Merge** when merging this PR.

Reviewed-on: #145
Co-authored-by: Unbound Releaser <releaser@unbound.se>
Co-committed-by: Unbound Releaser <releaser@unbound.se>
2026-05-29 06:47:04 +00:00
argoyle afa847c76c fix: set service.instance.id for unique instance label (#144)
Release / release (push) Successful in 54s
pre-commit / pre-commit (push) Successful in 6m51s
otelsetup / vulnerabilities (push) Failing after 10m48s
otelsetup / test (push) Failing after 10m50s
2026-05-29 06:39:14 +00:00
3 changed files with 18 additions and 2 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
{
"version": "v0.3.0"
"version": "v0.3.1"
}
+6
View File
@@ -2,6 +2,12 @@
All notable changes to this project will be documented in this file.
## [0.3.1] - 2026-05-29
### 🐛 Bug Fixes
- Set service.instance.id for unique instance label (#144)
## [0.3.0] - 2026-05-26
### 🚀 Features
+11 -1
View File
@@ -22,7 +22,17 @@ import (
// SetupOTelSDK bootstraps the OpenTelemetry pipeline.
func SetupOTelSDK(ctx context.Context, enabled bool, serviceName, buildVersion, environment string) (func(context.Context) error, error) {
if os.Getenv("OTEL_RESOURCE_ATTRIBUTES") == "" {
if err := os.Setenv("OTEL_RESOURCE_ATTRIBUTES", fmt.Sprintf("service.name=%s,service.version=%s,service.environment=%s", serviceName, buildVersion, environment)); err != nil {
// service.instance.id makes every pod a distinct telemetry resource. The
// OTLP→Prometheus exporter maps it to the `instance` label on metrics and
// target_info, which keeps multi-replica services from colliding on a
// single series and gives joins a unique (job, instance) key. Hostname is
// the pod name under Kubernetes; fall back to the service name if it is
// unavailable so the attribute is always present.
instanceID, err := os.Hostname()
if err != nil || instanceID == "" {
instanceID = serviceName
}
if err := os.Setenv("OTEL_RESOURCE_ATTRIBUTES", fmt.Sprintf("service.name=%s,service.version=%s,service.environment=%s,service.instance.id=%s", serviceName, buildVersion, environment, instanceID)); err != nil {
return func(context.Context) error {
return nil
}, err