Skip to content

Conversation

@NeedleInAJayStack
Copy link
Contributor

@NeedleInAJayStack NeedleInAJayStack commented Oct 11, 2025

This generates and exposes unstable attributes like those marked development, experimental or release_candidate, and gates them behind a non-default Experimental trait.

closes #27

@NeedleInAJayStack NeedleInAJayStack requested a review from a team as a code owner October 11, 2025 06:12
@NeedleInAJayStack NeedleInAJayStack requested review from slashmo and removed request for a team October 11, 2025 06:12
@NeedleInAJayStack NeedleInAJayStack changed the title Adds Non-Stable Attributes Adds Unstable Attributes Oct 11, 2025
Package.swift Outdated
traits: [
.trait(name: "Tracing"),
.default(enabledTraits: ["Tracing"]),
.trait(name: "Experimental"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I created the experimental trait as discussed in #27, but what do you think about using "Unstable" instead?

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I'll get to a detailed review later. One thing I thought about is that just having the trait without additional markers on the unstable attributes may be a bit too little because you don't immediately see whether you'd even need the trait based on the attributes used. One option I thought about is to prefix them all with experimental/unstable, so it's immediately obvious from the call-side. What do you think?

Choose a reason for hiding this comment

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

I like that. Plus we should add a clear note in the Readme explaining that if you use the experimental trait, you must use .upToNextMinor as they might break between minor versions.

Copy link
Contributor Author

@NeedleInAJayStack NeedleInAJayStack Oct 11, 2025

Choose a reason for hiding this comment

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

Yeah, definitely a good concern. The only thing I'd want to be careful of is to abide by the Development section of the stability guide, in particular:

OpenTelemetry clients MUST NOT be designed in a manner that breaks existing users when a signal transitions from Development to Stable. This would punish users of the release candidate, and hinder adoption.

I believe that this would disallow any symbol-prefixing or namespacing (since abc becoming stable would transition the symbol from experimentalAbc -> abc, and break existing users).

Two approaches that come to mind and are compatible with the spec:

  1. Using @available attributes to provide compiler warnings on non-stable attributes. This may be too intrusive, as some projects consider any compiler warnings to be a code smell.
  2. Adjusting documentation to more obviously flag non-stable attributes as mentioned in the issue. This may not be intrusive enough, as a user might not view the docs before using.

What do you guys think?

Choose a reason for hiding this comment

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

Maybe doc comments are enough, combined with the package trait.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, thanks for linking to the spec. I agree that it makes sense to follow it here. As you suggested option 1 with @available checks seems too intrusive because it would basically "punish" users of the unstable API always, not just when upgrading to a release that graduated some of the unstable attributes.

So overall I agree that the best option is to make it very clear in the documentation of individual attributes and in the trait documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sounds good! I've added a big, bolded **UNSTABLE** to the beginning of each attribute documentation here: aadf494

README.md Outdated

[Unstable](https://opentelemetry.io/docs/specs/otel/versioning-and-stability/#semantic-conventions-stability) attributes are available, but are gated behind a non-default `Experimental` trait. To use them, you must explicitly include the this trait in your `Package.swift`.

**Be aware that unstable attributes may experience breaking changes on minor version updates of this package, so use with caution!** If this breakage is unacceptable, but non-standard tags are still required, a version dependency range that only allows patch updates should be used.

Choose a reason for hiding this comment

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

Let's add an explicit instruction to use .upToNextMinor, so that at least we promise not to break them between patch versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good thought - I was going to do that, but it looks like .upToNextMinor is deprecated, so I went with explaining the equivalent range restriction. Is that right that it's deprecated?

Choose a reason for hiding this comment

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

I think this is the right one, on Range, not deprecated https://developer.apple.com/documentation/swift/range/uptonextminor(from:)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh awesome, thanks for linking that! I've adjusted the documentation in 30eb17f to recommend that upToNextMinor is used.

@NeedleInAJayStack
Copy link
Contributor Author

NeedleInAJayStack commented Oct 14, 2025

I also changed name of the "Experimental" trait to "Unstable" in c8b909c, since it slightly more accurately describes which attributes are included. Let me know if you disagree.

Edit: This has been reverted to "Experimental" based on the discussion here: #43 (comment)

@slashmo slashmo changed the title Adds Unstable Attributes Adds Experimental Attributes Oct 17, 2025
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.

Generate development/experimental attributes

3 participants