-
Notifications
You must be signed in to change notification settings - Fork 0
chore(telemetry): govern semantic conventions centrally #449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| #!/bin/sh | ||
| #MISE description="Validate the semantic convention registry and generated constants" | ||
|
|
||
| set -eu | ||
|
|
||
| root=$(CDPATH='' cd -- "$(dirname -- "$0")/../../../.." && pwd) | ||
| expected="$root/src/TrogonEventStore.SemanticConventions/Generated" | ||
| generated=$(mktemp -d) | ||
| trap 'rm -rf "$generated"' EXIT HUP INT TERM | ||
|
|
||
| "$root/.config/mise/tasks/semconv/generate" "$generated" | ||
| diff -ru "$expected" "$generated" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| #!/bin/sh | ||
| #MISE description="Generate the reusable semantic convention constants" | ||
|
|
||
| set -eu | ||
|
|
||
| root=$(CDPATH='' cd -- "$(dirname -- "$0")/../../../.." && pwd) | ||
| output=${1:-"$root/src/TrogonEventStore.SemanticConventions/Generated"} | ||
| registry_version=$(sed -n '1p' "$root/otel/semconv/registry-version") | ||
| registry="https://github.com/open-telemetry/semantic-conventions@${registry_version}[model]" | ||
| staging=$(mktemp -d) | ||
| trap 'rm -rf "$staging"' EXIT HUP INT TERM | ||
|
|
||
| weaver registry check \ | ||
| --future \ | ||
| --registry "$registry" | ||
|
|
||
| weaver registry generate csharp "$staging" \ | ||
| --future \ | ||
| --registry "$registry" \ | ||
| --templates "$root/otel/semconv/templates" | ||
|
|
||
| set -- "$staging"/*.g.cs | ||
| [ -e "$1" ] || exit 1 | ||
|
|
||
| mkdir -p "$output" | ||
| for generated_file in "$output"/*.g.cs | ||
| do | ||
| [ -e "$generated_file" ] || break | ||
| rm "$generated_file" | ||
| done | ||
|
|
||
| for generated_file | ||
| do | ||
| mv "$generated_file" "$output/" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| v1.43.0 |
13 changes: 13 additions & 0 deletions
13
otel/semconv/templates/registry/csharp/attribute-names.cs.j2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| // <auto-generated /> | ||
|
|
||
| namespace TrogonEventStore.SemanticConventions | ||
| { | ||
| public static class AttributeNames | ||
| { | ||
| {% for group in ctx %} | ||
| {% for attribute in group.attributes %} | ||
| public const string {{ attribute.name | pascal_case }} = "{{ attribute.name }}"; | ||
| {% endfor %} | ||
| {% endfor %} | ||
| } | ||
| }{{ "\n" }} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| whitespace_control: | ||
| trim_blocks: true | ||
| lstrip_blocks: true | ||
|
|
||
| templates: | ||
| - template: attribute-names.cs.j2 | ||
| filter: > | ||
| semconv_grouped_attributes | ||
| | map({ | ||
| root_namespace: .root_namespace, | ||
| attributes: [.attributes[] | select( | ||
| .name == "service.name" or | ||
| .name == "service.instance.id" or | ||
| .name == "service.version" | ||
| )] | ||
| }) | ||
| | map(select(.attributes | length > 0)) | ||
| application_mode: single | ||
| file_name: AttributeNames.g.cs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
src/TrogonEventStore.SemanticConventions/Generated/AttributeNames.g.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // <auto-generated /> | ||
|
|
||
| namespace TrogonEventStore.SemanticConventions | ||
| { | ||
| public static class AttributeNames | ||
| { | ||
| public const string ServiceInstanceId = "service.instance.id"; | ||
| public const string ServiceName = "service.name"; | ||
| public const string ServiceVersion = "service.version"; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| # TrogonEventStore Semantic Conventions | ||
|
|
||
| This package gives TrogonEventStore components one generated source for OpenTelemetry attribute names. It has no runtime dependencies. | ||
|
|
||
| The pinned OpenTelemetry registry version and C# templates under `otel/semconv` are the source of truth. Regenerate the committed constants with `mise run semconv:generate` and verify them with `mise run semconv:check`. |
25 changes: 25 additions & 0 deletions
25
src/TrogonEventStore.SemanticConventions/TrogonEventStore.SemanticConventions.csproj
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
| <PropertyGroup> | ||
| <TargetFramework>netstandard2.0</TargetFramework> | ||
| <VersionPrefix>0.1.0</VersionPrefix> | ||
| <VersionSuffix></VersionSuffix> | ||
| <IsPackable>true</IsPackable> | ||
| <PackageId>TrogonEventStore.SemanticConventions</PackageId> | ||
| <RootNamespace>TrogonEventStore.SemanticConventions</RootNamespace> | ||
| <AssemblyName>TrogonEventStore.SemanticConventions</AssemblyName> | ||
| <Authors>Straw Hat, LLC</Authors> | ||
| <Company>Straw Hat, LLC</Company> | ||
| <Copyright>Copyright Straw Hat, LLC</Copyright> | ||
| <Description>Shared OpenTelemetry semantic convention constants for TrogonEventStore components.</Description> | ||
| <PackageProjectUrl>https://github.com/TrogonStack/TrogonEventStore</PackageProjectUrl> | ||
| <PackageReadmeFile>README.md</PackageReadmeFile> | ||
| <PackageReleaseNotes></PackageReleaseNotes> | ||
| <PackageTags>opentelemetry;semantic-conventions;weaver</PackageTags> | ||
| <RepositoryUrl>https://github.com/TrogonStack/TrogonEventStore</RepositoryUrl> | ||
| <RepositoryType>git</RepositoryType> | ||
| </PropertyGroup> | ||
| <ItemGroup> | ||
| <None Include="README.md" Pack="true" PackagePath="\" /> | ||
| <None Remove="..\..\ouro.png" /> | ||
| </ItemGroup> | ||
| </Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.