hashicorp / hashicorp/consul

Consul doesn't set `service_name` in envoy when enabling tracing

Open
#18,576 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
30.1k
Forks
4.6k
Avg merge
1d 18h
Merged PRs (30d)
39

Description

#### Overview of the Issue

When enabling tracing in envoy, there isn't a good way (I could find at least) to set `service_name`. The means all services default to `unknown_service:envoy` where we would expect to name them as `consulservicename:envoy`.

As this config can only be set on `ProxyDefaults` https://developer.hashicorp.com/consul/docs/connect/distributed-tracing there is no way to set this per service (BTW note there is an error in the doc, you can't use `ProxyDefaults` with any other value than `global` in the kubernetes yaml, second to last).

---

#### Reproduction Steps

Use the following `ProxyDefaults` with a standard jaeger all-in-one https://hub.docker.com/r/jaegertracing/all-in-one
```
envoy_tracing_json: |
{
"http":{
"name":"envoy.tracers.opentelemetry",
"typedConfig":{
"@type":"type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig",
"grpc_service": {
"envoy_grpc": {
"cluster_name": "jaeger"
}
}
}
}
}
envoy_extra_static_clusters_json: |
{
"connect_timeout":"3.000s",
"dns_lookup_family":"V4_ONLY",
"lb_policy":"ROUND_ROBIN",
"typed_extension_protocol_options": {
"envoy.extensions.upstreams.http.v3.HttpProtocolOptions":{
"@type":"type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions",
"explicit_http_config":{
"http2_protocol_options":{}
}
}
},
"load_assignment":{
"cluster_name":"jaeger",
"endpoints":[{
"lb_endpoints":[{
"endpoint":{
"address":{
"socket_address":{
"address":"jaeger-otel-grpc.default.svc",
"port_value":4317
}
}
}
}]
}]
},
"name":"jaeger",
"type":"STRICT_DNS"
}
```

`service_name` will not be set, and the service will be called `unknown_service:envoy` (default value when `service_name` is not set https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/trace/v3/opentelemetry.proto.html

image

### Consul info for both Client and Server

Client info

```
agent:
check_monitors = 0
check_ttls = 1
checks = 1
services = 1
build:
prerelease =
revision = e0ab4d29
version = 1.16.1
version_metadata =
consul:
acl = enabled
bootstrap = true
known_datacenters = 1
leader = true
leader_addr = 10.1.81.40:8300
server = true
raft:
applied_index = 1022
commit_index = 1022
fsm_pending = 0
last_contact = 0
last_log_index = 1022
last_log_term = 2
last_snapshot_index = 0
last_snapshot_term = 0
latest_configuration = [{Suffrage:Voter ID:d97e9641-f323-2fae-2fdf-bd7d0172eea9 Address:10.1.81.40:8300}]
latest_configuration_index = 0
num_peers = 0
protocol_version = 3
protocol_version_max = 3
protocol_version_min = 0
snapshot_version_max = 1
snapshot_version_min = 0
state = Leader
term = 2
runtime:
arch = arm64
cpu_count = 5
goroutines = 1040
max_procs = 5
os = linux
version = go1.20.7
serf_lan:
coordinate_resets = 0
encrypted = false
event_queue = 1
event_time = 2
failed = 0
health_score = 0
intent_queue = 1
left = 0
member_time = 2
members = 1
query_queue = 0
query_time = 1
serf_wan:
coordinate_resets = 0
encrypted = false
event_queue = 0
event_time = 1
failed = 0
health_score = 0
intent_queue = 0
left = 0
member_time = 1
members = 1
query_queue = 0
query_time = 1
```

### Operating system and Environment details

Consul 1.16.1 started from helm 1.21.

### Log Fragments

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Start by tracing how ProxyDefaults and envoy_tracing_json are translated into the Envoy OpenTelemetry configuration, using the reproduction and Consul 1.16.1 Helm setup as a reference. Done means the configured service name is propagated so traces identify the Consul service rather than unknown_service:envoy, with coverage for the resulting configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, helm, kubernetes
Domain
infrastructure, observability-sre
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.