Skip to content

Commit f46abd5

Browse files
Merge pull request #310265 from AarDavMax/aaronmax-functions-resource-detectors-and-semantic-conventions
Functions resource detectors
2 parents 90296f7 + 91ed0aa commit f46abd5

1 file changed

Lines changed: 37 additions & 0 deletions

File tree

articles/azure-functions/opentelemetry-howto.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -422,6 +422,43 @@ When you export your data by using OpenTelemetry, keep these considerations in m
422422
* You don't need to manually register middleware; the Java worker autodiscovers `OpenTelemetryInvocationMiddleware`.
423423
::: zone-end
424424
425+
## Resource detectors and semantic conventions
426+
427+
In Azure Functions, resource attributes describe the function app process and its environment. Span attributes describe a single invocation.
428+
429+
### Default behavior (no action required)
430+
431+
In Azure Functions on App Service, resource detectors typically populate common attributes automatically, including:
432+
433+
- `service.name` (defaults to the function app name)
434+
- Azure cloud attributes such as `cloud.provider`, `cloud.region`, and `cloud.resource_id`
435+
436+
In most cases, these defaults are sufficient for correct Application Map grouping and Azure context.
437+
438+
### When to override `service.name` (Cloud Role Name)
439+
440+
Override only if you need a different, stable node name in Application Insights (Application Map grouping), for example to normalize naming across slots or environments.
441+
442+
Set `OTEL_SERVICE_NAME` to override the detected value:
443+
444+
```bash
445+
export OTEL_SERVICE_NAME="my-function-app"
446+
```
447+
448+
### Invocation span attributes (usually automatic)
449+
450+
You won’t have to set these manually unless you’re creating a custom invocation span.
451+
452+
- `faas.name` (function name)
453+
- `faas.trigger` (for example `http`, `servicebus`, `eventhubs`)
454+
- `faas.execution` (invocation/execution identifier)
455+
456+
> [!IMPORTANT]
457+
> Function apps can host multiple functions in one process. Do not put function-specific values on the resource. Put per-invocation identity on spans.
458+
459+
> [!NOTE]
460+
> When running locally (Functions Core Tools) or in containerized/self-hosted environments where Azure metadata is unavailable, `service.name` may default to a generic value. Set `OTEL_SERVICE_NAME` locally to match production naming.
461+
425462
## Troubleshooting
426463

427464
When you export your data by using OpenTelemetry, keep these common issues and solutions in mind.

0 commit comments

Comments
 (0)