open-telemetry / open-telemetry/opentelemetry-java

Add support of Number type into Span.setAttribute(Spring, Number)

Open
#5,952 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
2.5k
Forks
1k
Avg merge
3d 17h
Merged PRs (30d)
58

Description

Is your feature request related to a problem? Please describe.

Currently Span class supports only primitive number types such as long, double, int.
It would be nice to have the support of the Number class because it will simplify the use of wrapper classes. It will not be necessary to cast wrappers to primitive types. Also, this casting may lead to precision loss.

Describe the solution you'd like

Have the following method setAttribute(Spring, Number) in the Span class to be able to set wrapper types without casting to primitives.

Describe alternatives you've considered

No response

Additional context

No response

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 by locating the Span class and reviewing its existing setAttribute overloads for primitive number types. Check the related tests and add coverage for Number wrapper values; the work is done when Number values can be passed without casting and the tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.