Federated semantic conventions phase 2#1828
Conversation
|
I followed the convention from the |
| * DO NOT EDIT - AUTOGENERATED FILE | ||
| */ | ||
| @Suppress("unused") | ||
| object LastAttributes { |
There was a problem hiding this comment.
LOL this also makes it very clear that we will want to change this.
There was a problem hiding this comment.
⚠️ 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
weaverregistry template + config to generate Kotlin*Attributesconstant objects. - Introduces a
:semconv:generateSemanticConventionsGradle task to run Weaver and write generated sources intosrc/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.
There was a problem hiding this comment.
⚠️ 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.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
⚠️ 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
⚠️ 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.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
⚠️ 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.
There was a problem hiding this comment.
⚠️ 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.
| } catch (exc: Exception) { | ||
| throw GradleException( | ||
| "OTel weaver command failed. Install weaver and make sure it is on PATH.", | ||
| exc, | ||
| ) | ||
| } |
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.