Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/API/Instrumentation/WithSpanHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class WithSpanHandler
public static function pre(mixed $target, array $params, ?string $class, string $function, ?string $filename, ?int $lineno, ?array $span_args = [], ?array $attributes = []): void
{
static $instrumentation;
$instrumentation ??= new CachedInstrumentation(name: 'io.opentelemetry.php.with-span', schemaUrl: 'https://opentelemetry.io/schemas/1.25.0');
$instrumentation ??= new CachedInstrumentation(name: 'io.opentelemetry.php.with-span', schemaUrl: 'https://opentelemetry.io/schemas/1.40.0');

$name = $span_args['name'] ?? null;
if ($name === null) {
Expand All @@ -36,10 +36,11 @@ public static function pre(mixed $target, array $params, ?string $class, string
->tracer()
->spanBuilder($name)
->setSpanKind($kind)
->setAttribute('code.function', $function)
->setAttribute('code.function.name', $function)
->setAttribute('code.namespace', $class)
Comment thread
mdomansky marked this conversation as resolved.
Outdated
->setAttribute('code.filepath', $filename)
->setAttribute('code.lineno', $lineno)
->setAttribute('code.file.path', $filename)
->setAttribute('code.line.number', $lineno)
->setAttribute('code.column.number', $lineno)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This doesn't look right. I don't think we should use the line number as column number.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thanks. Fixed.

->setAttributes($attributes ?? [])
->startSpan();
$context = $span->storeInContext(Context::getCurrent());
Expand Down