Skip to content

Federated semantic conventions phase 2#1828

Open
breedx-splk wants to merge 11 commits into
open-telemetry:mainfrom
breedx-splk:semconv_federation_phase2
Open

Federated semantic conventions phase 2#1828
breedx-splk wants to merge 11 commits into
open-telemetry:mainfrom
breedx-splk:semconv_federation_phase2

Conversation

@breedx-splk

Copy link
Copy Markdown
Contributor

Part of #1814.

This adds a weaver template and gradle script to run weaver and generate these constants files.

In the next phase, we will replace production usages of these constants with references to the new semconv constant classes.

@breedx-splk breedx-splk requested a review from a team as a code owner June 18, 2026 16:11
Copilot AI review requested due to automatic review settings June 18, 2026 16:11
@breedx-splk

Copy link
Copy Markdown
Contributor Author

I followed the convention from the opentelemetry-kotlin repo, which expects a local weaver executable to be available. If we hate that and would rather use a docker image (more like the semantic-conventions-java repo), we can change it....I'm flexible.

* DO NOT EDIT - AUTOGENERATED FILE
*/
@Suppress("unused")
object LastAttributes {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

LOL this also makes it very clear that we will want to change this.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The PR appears to introduce CI-breaking build hygiene issues (missing consumer-rules.pro and missing initial apiDump outputs) and the committed generated Kotlin sources/templates don’t yet conform to enforced Spotless license-header/formatting expectations.

Pull request overview

This PR implements phase 2 of #1814 by introducing a :semconv Gradle module and a Weaver-based codegen pipeline to generate and commit Kotlin attribute-constant classes from the federated semconv registry model (production usage is deferred to later phases).

Changes:

  • Adds a weaver registry template + config to generate Kotlin *Attributes constant objects.
  • Introduces a :semconv:generateSemanticConventions Gradle task to run Weaver and write generated sources into src/main/kotlin.
  • Updates the Android semconv registry/events YAML and commits the initial generated Kotlin constant files.
File summaries
File Description
semconv/build.gradle.kts New :semconv module build + Weaver generation task.
semconv/README.md Documents how to regenerate committed attribute constants.
semconv/model/android/registry.yaml Adds new Android/hw attribute definitions for the registry.
semconv/model/android/events.yaml Adds new scroll/fling/power-save/thermal-status events.
semconv/templates/registry/kotlin/weaver.yaml Weaver config for Kotlin attribute generation + KDoc format mapping.
semconv/templates/registry/kotlin/kotlin_semconv_template.kt.j2 Jinja template for generated Kotlin attribute constants.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/ActivityAttributes.kt Generated attribute constants for activity.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/AndroidAttributes.kt Generated attribute constants for android.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/BatteryAttributes.kt Generated attribute constants for battery.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/FragmentAttributes.kt Generated attribute constants for fragment.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/HeapAttributes.kt Generated attribute constants for heap.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/HwAttributes.kt Generated attribute constants for hw.* (incl. new distance/velocity attrs).
semconv/src/main/kotlin/io/opentelemetry/android/semconv/LastAttributes.kt Generated attribute constants for last.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/NetworkAttributes.kt Generated attribute constants for network.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/ScreenAttributes.kt Generated attribute constants for screen.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/SpanAttributes.kt Generated attribute constants for span.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/StartAttributes.kt Generated attribute constants for start.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/StorageAttributes.kt Generated attribute constants for storage.*.
semconv/src/main/kotlin/io/opentelemetry/android/semconv/WebsocketAttributes.kt Generated attribute constants for websocket.*.

Copilot's findings

  • Files reviewed: 19/19 changed files
  • Comments generated: 4

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread semconv/templates/registry/kotlin/weaver.yaml Outdated
Comment thread semconv/templates/registry/kotlin/kotlin_semconv_template.kt.j2 Outdated
Comment thread semconv/build.gradle.kts
Comment thread semconv/build.gradle.kts

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The Kotlin generation template currently produces consecutive blank lines in committed generated sources, which is likely to fail Spotless/ktlint checks.

Copilot's findings
  • Files reviewed: 21/21 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread semconv/templates/registry/kotlin/kotlin_semconv_template.kt.j2 Outdated
@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.36%. Comparing base (8d36c1f) to head (37b9884).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1828      +/-   ##
==========================================
- Coverage   64.55%   64.36%   -0.20%     
==========================================
  Files         165      165              
  Lines        3645     3645              
  Branches      386      386              
==========================================
- Hits         2353     2346       -7     
- Misses       1182     1185       +3     
- Partials      110      114       +4     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The Kotlin template currently generates consecutive blank lines that are very likely to fail ktlint/Spotless, blocking CI.

Copilot's findings
  • Files reviewed: 21/21 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread semconv/templates/registry/kotlin/kotlin_semconv_template.kt.j2 Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The committed generated Kotlin sources currently violate ktlint/Spotless due to consecutive blank lines emitted by the template, which will fail spotlessCheck.

Copilot's findings
  • Files reviewed: 21/21 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread semconv/templates/registry/kotlin/kotlin_semconv_template.kt.j2
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The Kotlin generator template currently produces committed sources with consecutive blank lines that are likely to fail Spotless/ktlint checks.

Copilot's findings
  • Files reviewed: 21/21 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread semconv/templates/registry/kotlin/kotlin_semconv_template.kt.j2

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Not ready to approve

The new codegen Gradle task reports a misleading “install weaver” error for all failures, which should be clarified before merging.

Copilot's findings

Comments suppressed due to low confidence (1)

semconv/consumer-rules.pro:2

  • This consumer ProGuard rules file currently contains only blank lines, which is easy to misinterpret as an accidental leftover. Other modules keep an empty file when no rules are needed; add a brief comment (or remove the whitespace) to make the intent clear.
  • Files reviewed: 21/21 changed files
  • Comments generated: 1

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.

Comment thread semconv/build.gradle.kts
Comment on lines +55 to +60
} catch (exc: Exception) {
throw GradleException(
"OTel weaver command failed. Install weaver and make sure it is on PATH.",
exc,
)
}
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.

2 participants