typelevel / typelevel/otel4s

Case insensitive keys TextMapGetter

Open
#191 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
215
Forks
49
Avg merge
2d 5h
Merged PRs (30d)
17

Description

As mentioned on https://github.com/typelevel/otel4s/issues/147#issuecomment-1531469127 I was seeing an issue where a gRPC server was not linking spans to a distributed trace. This turned out to be because I was using the provided TextMapGetter[Map[String, String]] and gRPC metadata keys are lower case. In my case I am using the B3 propagator so it would have been trying to find [X-B3-TraceId, X-B3-SpanId, X-B3-Sampled] in ["x-b3-traceid", "x-b3-spanid", "x-b3-sampled"].

To resolve this I changed my carrier type to a Map[CIString, String] and wrote a TextMapGetter implementation for that type.

Is this the correct way to deal with this? If so, shall we provide the Map[CIString, String] TextMapGetter instance in this lib?

Contributor guide

Open the contributing guide

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 with the existing TextMapGetter[Map[String, String]] entry point and the B3 propagator behavior described in the issue. Compare case-sensitive lookup with lower-case gRPC metadata keys and the proposed Map[CIString, String] carrier. Done means the supported getter can resolve the B3 keys from gRPC metadata, with appropriate coverage in the project’s existing tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
grpc, scala
Domain
distributed-systems, observability-sre
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.