Skip to content

feat(attributes): Add allow_any_value field to attribute schema - #272

Merged
vgrozdanic merged 1 commit into
mainfrom
feat/allow-any-value-attribute-field
Mar 4, 2026
Merged

vgrozdanic merged 1 commit into
mainfrom
feat/allow-any-value-attribute-field

Conversation

@vgrozdanic

@vgrozdanic vgrozdanic commented Mar 3, 2026 •

Copy link
Copy Markdown
Member

Introduce an optional boolean field allow_any_value on attribute definitions. When set to true, it signals that the attribute can hold any value type as per the OTEL AnyValue convention, not just the declared scalar type.

The ingestion pipeline currently rejects non-scalar values for all attributes. This field enables a curated opt-in for attributes where complex/object values must be accepted rather than dropped.

The flag propagates through code generation:

  • TypeScript: value type becomes unknown (since TS object excludes primitives, unknown correctly covers strings + objects)
  • Python: value type becomes object (str is a subtype of object in Python, so this naturally subsumes strings)
  • AttributeMetadata: exposes allowAnyValue (TS) / allow_any_value (Python) so the pipeline and SDKs can read it at runtime

Absence of the field means false — consistent with how has_dynamic_suffix works.

Closes TET-2008: Add a new attribute to sentry conventions to allowlist object value

Introduce an optional boolean field allow_any_value that marks attributes
which can hold any value type as per the OTEL AnyValue convention, rather
than being limited to the declared scalar type.

By default (field absent), the ingestion pipeline rejects non-scalar values
for an attribute. When allow_any_value is true, the pipeline accepts
object/complex values for that attribute instead of dropping them.

The flag propagates through code generation:
- TypeScript: value type becomes unknown (covers all primitives + objects)
- Python: value type becomes object (str is a subtype of object in Python)
- AttributeMetadata: exposes allowAnyValue/allow_any_value for runtime use

Co-Authored-By: Claude <[email protected]>
@github-actions

github-actions Bot commented Mar 3, 2026 •

Copy link
Copy Markdown

Semver Impact of This PR

🟡 Minor (new features)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


New Features ✨

  • (attributes) Add allow_any_value field to attribute schema by vgrozdanic in #272
  • (http) Add http.server.request.time_in_queue attribute by dingsdax in #267
  • (resource) Add resource.deployment.environment by mjq in #266

Bug Fixes 🐛

  • (gen_ai) Input and output token description by obostjancic in #261

Documentation 📚

  • Update README with up-to-date links by ericapisani in #258

Internal Changes 🔧

Deps

  • Bump svelte from 5.51.5 to 5.53.5 by dependabot in #271
  • Bump rollup from 4.40.1 to 4.59.0 by dependabot in #269
  • Bump svelte from 5.48.1 to 5.51.5 by dependabot in #260

Other

  • (ai) Deprecate rest of ai.* attributes by constantinius in #264
  • (deps-dev) Bump tar from 7.5.7 to 7.5.8 by dependabot in #259
  • (gen_ai) Deprecate gen_ai.tool.input, gen_ai.tool.message, gen_ai.tool.output by constantinius in #265

🤖 This preview updates automatically when you update the PR.

@linear

linear Bot commented Mar 3, 2026

Copy link
Copy Markdown

@vgrozdanic
vgrozdanic marked this pull request as ready for review March 3, 2026 11:34
@vgrozdanic
vgrozdanic requested review from a team, Lms24, cleptric, lcian, mjq and nsdeschenes as code owners March 3, 2026 11:34

@Dav1dde Dav1dde left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't necessarily like that the name is tied to OTeL, since the behaviour is independent of OTeL. Then again I can't come up with a better name ad-hoc.

@vgrozdanic
vgrozdanic merged commit d3bf908 into main Mar 4, 2026
12 checks passed
@vgrozdanic
vgrozdanic deleted the feat/allow-any-value-attribute-field branch March 4, 2026 09:42
@cleptric

cleptric commented Mar 4, 2026

Copy link
Copy Markdown
Member

Let's please make this a proper change and we add a value type attribute to the schema. Like https://opentelemetry.io/docs/specs/semconv/general/attributes/#server-attributes does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants