Skip to content

Support overriding the diagnostics service name - #55

Merged
z4kn4fein merged 1 commit into
configcat:mainfrom
tostavio:support-overriding-service-name
Jul 1, 2026
Merged

Support overriding the diagnostics service name#55
z4kn4fein merged 1 commit into
configcat:mainfrom
tostavio:support-overriding-service-name

Conversation

@tostavio

@tostavio tostavio commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

This pull request lets each ConfigCat Proxy deployment configure the OpenTelemetry service name used for diagnostics telemetry.

Motivation

Multiple ConfigCat Proxy deployments can run in the same Kubernetes cluster or observability environment. A fixed service name makes their OTLP metrics and traces appear under the same service.name resource attribute, which makes monitoring and filtering ambiguous.

This setting lets operators assign a distinct service name per deployment, for example when different proxies serve different environments, tenants, network zones, or traffic paths.

Fix

The key behavior change is in the telemetry reporter. The reporter now builds the OpenTelemetry resource from the configured diagnostics service name instead of always writing the fixed value:

- res := buildResource(version)
+ res := buildResource(conf.ServiceName, version)

- semconv.ServiceName("configcat-proxy"),
+ semconv.ServiceName(serviceName),

The YAML and environment configuration changes only provide this value through the existing diagnostics configuration path.

Changes

  • Adds diag.service_name to the YAML configuration.
  • Adds CONFIGCAT_DIAG_SERVICE_NAME as the matching environment override.
  • Uses the configured value for the OpenTelemetry service.name resource attribute.

Compatibility

When no service name is configured, ConfigCat Proxy keeps using configcat-proxy.

Testing

  • go fmt ./...
  • go vet -tags testing ./...
  • go test -tags testing -race ./config -run TestDiagConfig
  • go test -tags testing -race ./diag/telemetry -run TestBuildResource_ServiceName

Closes #54.

@tostavio
tostavio requested a review from a team as a code owner July 1, 2026 00:34
@tostavio
tostavio force-pushed the support-overriding-service-name branch from a6b2003 to c770762 Compare July 1, 2026 00:45
@z4kn4fein

Copy link
Copy Markdown
Member

Hi @tostavio, thank you for your contribution!

@z4kn4fein
z4kn4fein merged commit b0f6696 into configcat:main Jul 1, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow overriding the diagnostics service name

2 participants