Skip to content
Open
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions src/API/Instrumentation/WithSpanHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use OpenTelemetry\API\Trace\SpanKind;
use OpenTelemetry\API\Trace\StatusCode;
use OpenTelemetry\Context\Context;
use OpenTelemetry\SemConv\Attributes\CodeAttributes;
use Throwable;

/**
Expand Down Expand Up @@ -36,10 +37,10 @@ public static function pre(mixed $target, array $params, ?string $class, string
->tracer()
->spanBuilder($name)
->setSpanKind($kind)
->setAttribute('code.function', $function)
->setAttribute(CodeAttributes::CODE_FUNCTION_NAME, $function)
->setAttribute('code.namespace', $class)
->setAttribute('code.filepath', $filename)
->setAttribute('code.lineno', $lineno)
->setAttribute(CodeAttributes::CODE_FILE_PATH, $filename)
->setAttribute(CodeAttributes::CODE_LINE_NUMBER, $lineno)
->setAttributes($attributes ?? [])
->startSpan();
$context = $span->storeInContext(Context::getCurrent());
Expand Down