question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make SemanticConventions.cs Public

See original GitHub issue

Feature Request

Is your feature request related to a problem?

I have had to copy the SemanticConventions constants class containing open telemetry attribute names because it is marked as internal.

Describe the solution you’d like:

Please make it public. I would like to add additional tags to my Activity. This may be difficult because it’s a linked file in a lot of projects.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:5
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

5reactions
Oberon00commented, Dec 30, 2020

I suggest switching to using the code generator (https://github.com/open-telemetry/build-tools/tree/master/semantic-conventions) instead of hand-coding the semantic conventions so that the names are consistent with other languages.

Since you asked for other languages, here is Java: https://github.com/open-telemetry/opentelemetry-java/blob/838be8ef8ee501a81fcd666812393955eddcde85/api/all/src/main/java/io/opentelemetry/api/trace/attributes/SemanticAttributes.java (generator script at https://github.com/open-telemetry/opentelemetry-java/blob/master/buildscripts/semantic-convention/generate.sh)

I think all languages should eventually expose semantic conventions, as it should be easy to use them. But note that unlike the Trace API spec, semantic conventions are not yet frozen in the spec (like the Trace SDK spec).

1reaction
pcwiesecommented, May 24, 2021

Hey all, I saw this and thought would be a nice thing to get started. I went ahead and started creating a Jinja template to generate the c# class. Just to make sure I’m going in the correct direction… does this make sense? joaopgrassi@bfe64ed

The Java impl is more complex since it has the actual types and etc. Do we also want to achieve the same here? Or just get the const/enums in place?

Hey, thanks for starting this. I also started this today 😃 We are basically at the same point. Given that you actually provided a link to something viewable I’ll let you take it.

I personally think we just need the const/enum values. So I think the class generation is basically fine. Ultimately I think we want to create a NuGet package for the various projects to reference called OpenTelemetry.SemanticConventions (unless someone has a better name). We want to expose the generated values in a NuGet package and remove the existing SemanticConventions class.

I see the generation happening on-demand locally first, dumping generated files into a new NuGet project, building the package, and testing it against the current projects. At that point, we could either generate the package on demand via a CI pipeline, passing it the released tag version of the spec, and publish the package. Or we can continue generating on-demand and checking the generated files via a normal PR.

The version of the new package should match the spec version we used to generate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Semantic Conventions
OpenTelemetry defines Semantic Conventions (sometimes called Semantic Attributes) that specify common names for different kinds of ...
Read more >
Get started with semantic analysis
This tutorial provides an overview of working with semantic analysis using the .NET Compiler SDK.
Read more >
Semantic Versioning 2.0.0 | Semantic Versioning
Software using Semantic Versioning MUST declare a public API. This API could be declared in the code itself or exist strictly in documentation....
Read more >
Naming convention (programming)
In computer programming, a naming convention is a set of rules for choosing the character sequence to be used for identifiers which denote...
Read more >
Difference Between Syntax and Semantics
Syntax: It refers to the rules and regulations for writing any statement in a programming language like C/C++.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found