Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Tracing: How to add dynamic attributes to all spans?

Open
#2,970 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
android, kotlin

Research direction

Start by reading the SpanEventMapper behavior and the definitions of SpanEvent and SpanEvent.Meta, especially additionalProperties, then compare them with OtelTracerProvider.Builder.addTag. The issue is done when the supported approach for dynamic attributes is established or an agreed API change is specified and covered by relevant tests.

Written by the indexing model from the issue text.

Description

automatically closed question stale
Question

I'd like to be able to add an attribute that may change throughout the lifetime of the app to all spans logged by the SDK. I'm using OpenTelemetry so I can add tags that are static and known at initialization time via OtelTracerProvider.Builder.addTag, but this doesn't work for attributes that either aren't static or aren't known at initialization time.

I looked into SpanEventMapper but very little of the SpanEvent object is mutable (only resource and name) and the SDK drops Spans if the mapper returns a new object instead of the one that was passed in.

Is there another approach to solving this problem? If not, would you consider making SpanEvent.Meta.additionalProperties a MutableMap or exposing a setter to add properties?

Dominant language
Kotlin
Stars
226
Forks
86
Avg merge
1d 12h
Merged PRs (30d)
65

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 DataDog/dd-sdk-android

All issues in DataDog/dd-sdk-android

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.