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

Attribute extraction for root spans #73656

Closed
obostjancic opened this issue Jul 2, 2024 · 0 comments · Fixed by getsentry/relay#3790
Closed

Attribute extraction for root spans #73656

obostjancic opened this issue Jul 2, 2024 · 0 comments · Fixed by getsentry/relay#3790
Assignees

Comments

@obostjancic
Copy link
Member

obostjancic commented Jul 2, 2024

Metric extraction spec

{
   "category": "span",
   "mri": "d:custom/span_attribute_4@none",
   "field": "span.data.foo",
   "tags": [{
        "key": "environment",
        "field": "span.sentry_tags.environment"
    }],
    "condition": null
},

does not work if the temp attribute is present on a root span:

// does not work
Sentry.startSpan({ name: "doSomething", op: "function" }, (rootSpan) => {
  rootSpan.setAttributes({
    foo: "bar",
  });
});

// works
Sentry.startSpan({ name: "doSomething", op: "function" }, (rootSpan) => {
  Sentry.startSpan({ name: "doSomething", op: "function" }, (innerSpan) => {
    innerSpan.setAttributes({
      foo: "bar",
    });
  });
});

The SDK sends this as a transaction event with data added into contexts.trace.data.*. Relay should perform lookup in this data:

"contexts": {
  "trace": {
    "span_id": "84ad0a67500f81ea",
    "trace_id": "cc3345cea6574367a09950eec28c0f02",
    "data": {
      "sentry.origin": "manual",
      "sentry.op": "function",
      "sentry.source": "custom",
      "sentry.sample_rate": 1,
      "foo": 1
    },
    "op": "function",
    "origin": "manual"
  }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants