Skip to content
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

Review and update OTel semantic conventions #10560

Closed
lmolkova opened this issue Oct 23, 2024 · 4 comments
Closed

Review and update OTel semantic conventions #10560

lmolkova opened this issue Oct 23, 2024 · 4 comments

Comments

@lmolkova
Copy link
Member

I see a few minor discrepancies:

  1. faas.trigger is set to some Azure Function constant like eventHubTrigger

Image

Based on semantic conventions, I believe it should be pubsub - https://github.com/open-telemetry/semantic-conventions/blob/main/docs/faas/faas-spans.md and the fact that it's an Event Hub is captured in the corresponding messaging.system.

faas.trigger has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

Value Description Stability
datasource A response to some data source operation such as a database or filesystem read/write Experimental
http To provide an answer to an inbound HTTP request Experimental
other If none of the others apply Experimental
pubsub A function is set to be executed when messages are sent to a messaging system Experimental
timer A function is scheduled to be executed regularly Experimental
  1. Very minor: ai.sdk.prefix = azurefunctions:4.1036.0.0 or dotnetiso:1.1.0.0 is populated on resources even when I don't use Application Insights SDK and use pure OTel like here https://github.com/lmolkova/testfuncotel. We probably should not set it if AppInsights is not enabled.

  2. faas.version = 4.1036.0.0 is set on host resources, but it should not be set for Azure functions according to semconv

    Azure Functions: Not applicable. Do not set this attribute.

    Let's fix one side or the other.

  3. faas.execution is used instead of faas.invocation_id. It was right according to OTel schema 1.17 which Functions support, but it was renamed later. Can we update the schema version for OTel case while it's all still experimental?

  4. service.version on the host is reported as 4.1036.0.0 which does not seem right - it seems to be internal Function host version, but I assume users would expect it to be something about their code (if we can infer it).
    It maybe just something to document - the 4.1036.0.0 is probably automatically picked up by otel-dotnet from the assembly version and is probably easily overridden with OTEL env var.

Happy to discuss further and help if you'd like to change anything in the otel semantic conventions.

@stebet
Copy link

stebet commented Jan 30, 2025

@RohitRanjanMS It would be awesome if the function host set the root span name to the faas.name or the HTTP method + http.route values for incoming HTTP requests. Currently the root spans are just named after the request method (GET, POST, etc.).

Example:

Image

Would that make sense @lmolkova?

@lmolkova
Copy link
Member Author

lmolkova commented Jan 31, 2025

yep, I think it's not the case because http.route is not available for some reason. I wonder if we can force-update this activity name to {verb} {function name}.

Tried to check what FaaS semconv recommend and I think they are not clear enough - open-telemetry/semantic-conventions#1858

@stebet
Copy link

stebet commented Jan 31, 2025

The trigger route is available from the Raw property on the context.FunctionMetadata here:

Activity.Current?.AddTag(ResourceSemanticConventions.FaaSName, context.FunctionMetadata.Name);

Here's an example where the route property is fetched:

if (httpBinding.Raw != null && httpBinding.Raw.TryGetValue("route", StringComparison.OrdinalIgnoreCase, out JToken value))

I can try making a PR, I have no idea how easy or hard it is to run the host locally but let's see :)

@RohitRanjanMS
Copy link
Member

This is done. Will be available in host 1039 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants