Skip to content

[feature request] source generator using semantic conventions #2856

Open
@thompson-tomo

Description

@thompson-tomo

Component

None

Is your feature request related to a problem?

I want to eliminate the need to define a collection of strings representing my attribute keys.

What is the expected behavior?

I define a struct/class in my project like below

[attributes("disk")]
internal static partial struct DiskAttributeNames
{
}

Once generator runs you end with

internal static partial struct DiskAttributeNames
{
  internal static partial struct disk
  {
    internal static partial struct io
    {
      internal const string direction = "disk.io.direction";
    }
  }
}

And you can use them via DiskAttributeNames.disk.io.direction

Which alternative solutions or features have you considered?

Use nuget package of all semconv attributes but adds a transitive dependency to customer apps which can cause breaking changes

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    comp:semanticconventionsThings related to OpenTelemetry.SemanticConventionsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions