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

frontend: add more attributes to the spans #1322

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

simonpasquier
Copy link
Collaborator

@simonpasquier simonpasquier commented Feb 13, 2025

What this PR does

This change modifies the existing middlewares to add span attributes and be consistent with logging.

The following attributes are added:

  • cloud.provider (always Azure) [1]
  • cloud.resource_id [1]
  • aro.subscription.id
  • aro.subscription.state
  • aro.resource_group.name
  • aro.resource.name
  • aro.api_version

The following attributes have also been renamed to better match the
guidelines on attribute naming (TL;DR: use dot separators to delimit
namespaces and underscores for multi-word names):

  • aro.correlation.id -> aro.correlation_id
  • aro.client.request.id -> aro.client.request_id
  • aro.request.id -> aro.request_id

[1] https://pkg.go.dev/go.opentelemetry.io/otel@v1.34.0/semconv/v1.27.0
Jira:
Link to demo recording:

Special notes for your reviewer

@simonpasquier simonpasquier force-pushed the add-more-span-attributes branch from c776528 to 478b6ec Compare February 13, 2025 16:21
@@ -72,13 +64,8 @@ func TestMiddlewareTracing(t *testing.T) {
} {
t.Run(tc.name, func(t *testing.T) {
// Setup the testing tracer.
inMemoryExporter := tracetest.NewInMemoryExporter()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi @frzifus I've reworked a bit the test framework for tracing. let me know what you think.

Copy link
Collaborator

@dinhxuanvu dinhxuanvu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Just a minor question on the ID convention part.


var attrs []attribute.KeyValue
if a.subscriptionID != "" {
attrs = append(attrs, attribute.String("aro.subscription_id", a.subscriptionID))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sticking to subscription_id or subcription.id? I can't remember if we had a conversion on the ID convention or not. Remind me if we did.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point and I don't remember that we decided explicitly for one or the other.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but since we already have aro.correlation.id, it's probably best to stick with the '.' approach. I'll update.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok after thinking a bit more, I have taken a mixed approach. We can discuss more next week (nothing urgent here).

@simonpasquier simonpasquier force-pushed the add-more-span-attributes branch 2 times, most recently from c1b0ebe to 10a7824 Compare February 20, 2025 16:27
This change modifies the existing middlewares to add new span attributes
and be consistent with logging.

In practice, the following attributes are added:
* `cloud.provider` (always `Azure`) [1]
* `cloud.resource_id` [1]
* `aro.subscription.id`
* `aro.subscription.state`
* `aro.resource_group.name`
* `aro.resource.name`
* `aro.api_version`

The following attributes have also been renamed to better match the
guidelines on attribute naming (TL;DR: use dot separators to delimit
namespaces and underscores for multi-word names):
* `aro.correlation.id` -> `aro.correlation_id`
* `aro.client.request.id` -> `aro.client.request_id`
* `aro.request.id` -> `aro.request_id`

[1] https://pkg.go.dev/go.opentelemetry.io/otel@v1.34.0/semconv/v1.27.0

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
@simonpasquier simonpasquier force-pushed the add-more-span-attributes branch from 10a7824 to 907c7e1 Compare February 20, 2025 16:30
@dinhxuanvu
Copy link
Collaborator

Everything looks fine for now. Will sync up on the trace IDs next week to move this this PR forward.

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

Successfully merging this pull request may close these issues.

2 participants