Skip to content

feat(attributes): add support for spanAttributes, which allows to capture values#4

Open
Litarnus wants to merge 5 commits into
variadic-metadatafrom
capture-span-attributes
Open

feat(attributes): add support for spanAttributes, which allows to capture values#4
Litarnus wants to merge 5 commits into
variadic-metadatafrom
capture-span-attributes

Conversation

@Litarnus

@Litarnus Litarnus commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

Add support for the special attribute spanAttributes which allows the extension to capture parameters and add them to the metadata array.

For example:

function foo(string $name) { ... }

\Sentry\instrument(null, "foo", spanAttributes: ['description' => 'name']);

setEndCallback(static function(array $data) {
    $data['metadata']['description']; <- will contain "example", the value of $name
});

foo("example");

Comment thread sentry.c
Comment thread span_attributes.c
Comment thread sentry.c
zend_string_release(lc_func);
}
} else {
instrumented_func = zend_hash_find_ptr(CG(function_table), lc_func);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Wrong function table for lookup

Medium Severity

Global spanAttributes rules are built only when instrument() resolves the target via CG(function_table), which is the current compilation unit’s table—not the request-wide registry. Registering instrumentation from another file (typical SDK bootstrap) leaves instrumented_func null, so rules are never stored while \Sentry\instrument still succeeds.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 825c271. Configure here.

Comment thread sentry.c

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 3a7a4d8. Configure here.

Comment thread span_attributes.c
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.

1 participant