Skip to content

Samplers use Locale dependent formatting for description #4880

Description

@lmonkiewicz

Describe the bug
RateLimiingSampler and TraceIdRationBasedSampler use String.format("RateLimitingSampler{%.2f}", maxTracesPerSecond) for building a description. Formatting of numbers in such way may result in 999.00 for en_US locale and 999,00 for pl_PL.

I propose to enforce locale for those two samplers, using String.format(Locale.ENGLISH, "RateLimitingSampler{%.2f}", maxTracesPerSecond).

If that solution is acceptable, I can take care of it.

Steps to reproduce
Change locale on your JVM to pl_PL and run JaegerRemoteSamplerTest test suite. Most tests will fail on checking of description formats.

What did you expect to see?
Behavior independent of locale.

What did you see instead?

Expecting actual:
  "JaegerRemoteSampler{ParentBased{root:RateLimitingSampler{999,00},remoteParentSampled:AlwaysOnSampler,remoteParentNotSampled:AlwaysOffSampler,localParentSampled:AlwaysOnSampler,localParentNotSampled:AlwaysOffSampler}}"
to contain:
  "RateLimitingSampler{999.00}" 

What version and what artifacts are you using?
Artifacts: opentelemetry-java, jaeger-remote-sampler
Version: fdfacb0bdea770f354e27305b5aab77a9d965a4f

Environment
Compiler: OpenJDK 18.0.1
OS: MacOS

Metadata

Metadata

Assignees

Labels

BugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions