cloudfoundry / cloudfoundry/loggregator-agent-release

instance_id tag always 0 exporting traces using OTEL

Open
#698 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
14
Forks
34
Avg merge
7h 6m
Merged PRs (30d)
2

Description

We are using OTEL collector to receive telemetry from loggregator. For metrics and logs, the instace_id tag is the applicacion index (as stated in the docs) but when a span is generated on a gorouter (from an Envelope_Timer) the instance_id is always 0.

Eg:

Otel collector span dump:

    Trace ID       : 572d882b982442f17038cef2b6a7a7e2
    Parent ID      :
    ID             : 7038cef2b6a7a7e2
    Name           : /
    Kind           : Server
    Start time     : 2025-04-23 08:46:18.756613328 +0000 UTC
    End time       : 2025-04-23 08:46:18.76391097 +0000 UTC
    Status code    : Unset
    Status message :
Attributes:
     -> instance_id: Str(0)
     -> source_id: Str(0967492b-e013-4c4c-8607-e423b5e67ca4)
     -> component: Str(route-emitter)
     -> index: Str(09b2820c-76fc-4e22-be43-ceeb8b54b477)
     -> space_name: Str(test)
     -> space_id: Str(937d13ff-dbce-4740-bfdd-494d64727202)
     -> uri: Str(http://go-hello.t.cf.domain/)
     -> organization_id: Str(c1bc891b-1ec2-4131-a599-c6a18b51f90d)
     -> process_id: Str(0967492b-e013-4c4c-8607-e423b5e67ca4)
     -> custom_tag: Str(some_value)
     -> process_instance_id: Str(d5334cfb-a204-47c2-7b9f-8d42)
     -> request_id: Str(572d882b-9824-42f1-7038-cef2b6a7a7e2)
     -> remote_address: Str(x.x.x.16:44156)
     -> app_id: Str(0967492b-e013-4c4c-8607-e423b5e67ca4)
     -> process_type: Str(web)
     -> organization_name: Str(engineering-enablement)
     -> status_code: Str(200)
     -> deployment: Str(cf-test)
     -> method: Str(GET)
     -> app_name: Str(go-hello)
     -> user_agent: Str(curl/7.88.1)
     -> forwarded: Str(x.x.x.39 x.x.x.97)
     -> job: Str(router)
     -> content_length: Str(58)
     -> peer_type: Str(Server)
     -> ip: Str(x.x.x.179)
     -> origin: Str(gorouter)
     -> routing_instance_id: Str()

RTR Access log:

go-hello.t.cf.domain - [2025-04-23T08:46:18.756541129Z] "GET / HTTP/1.1" 200 0 58 "-" "curl/7.88.1" "x.x.x.16:44156" "x.x.x.92:61018" x_forwarded_for:"x.x.x.39, x.x.x.97, x.x.x.16" x_forwarded_proto:"http" vcap_request_id:"572d882b-9824-42f1-7038-cef2b6a7a7e2" response_time:0.007161 gorouter_time:0.000173 app_id:"0967492b-e013-4c4c-8607-e423b5e67ca4" app_index:"2" instance_id:"d5334cfb-a204-47c2-7b9f-8d42" x_cf_routererror:"-" x_forwarded_host:"-" traceparent:"00-572d882b982442f17038cef2b6a7a7e2-7038cef2b6a7a7e2-01" tracestate:"gorouter=7038cef2b6a7a7e2"

I will try to investigate where is the bug.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how an Envelope_Timer span is created and how its attributes are populated, then compare that mapping with the RTR access log's app_index and instance_id fields. Done means the exported span reports the expected application index instead of always reporting instance_id as 0, with coverage for this behavior if the relevant test location is found.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.