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

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

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

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

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.

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

Dominant language
Java
Stars
2.5k
Forks
1.1k
Avg merge
5d 11h
Merged PRs (30d)
41

Getting set up

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.

More from open-telemetry/opentelemetry-java

All issues in open-telemetry/opentelemetry-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.