Skip to content
This repository was archived by the owner on Dec 5, 2025. It is now read-only.

Commit c93898d

Browse files
committed
wip
1 parent 8eaf286 commit c93898d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"php": ">=8.2",
1919
"open-telemetry/sdk": "*",
2020
"open-telemetry/exporter-otlp": "*",
21-
"ext-opentelemetry": "*"
21+
"ext-opentelemetry": "*",
22+
"open-telemetry/opentelemetry-auto-laravel": "^0.0.25"
2223
},
2324
"require-dev": {
2425
"orchestra/testbench": "^9.0",

src/Support/Measure.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Overtrue\LaravelOpenTelemetry\Support;
44

5+
use Closure;
56
use Illuminate\Contracts\Foundation\Application;
67
use OpenTelemetry\API\Globals;
78
use OpenTelemetry\API\Trace\Propagation\TraceContextPropagator;
@@ -12,6 +13,8 @@
1213
use OpenTelemetry\Context\ContextInterface;
1314
use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface;
1415
use OpenTelemetry\Context\ScopeInterface;
16+
use OpenTelemetry\SDK\Propagation\PropagatorFactory;
17+
use OpenTelemetry\SDK\Registry;
1518

1619
class Measure
1720
{
@@ -30,7 +33,7 @@ public function span(string $name): SpanBuilder
3033
return new SpanBuilder($this->tracer()->spanBuilder($name));
3134
}
3235

33-
public function start(string|int $name, ?\Closure $callback = null): StartedSpan
36+
public function start(string|int $name, ?Closure $callback = null): StartedSpan
3437
{
3538
$name = (string) $name;
3639
$spanBuilder = $this->span($name);
@@ -87,7 +90,7 @@ public function traceId(): ?string
8790

8891
public function propagator()
8992
{
90-
return $this->app->get(TextMapPropagatorInterface::class) ?? TraceContextPropagator::getInstance();
93+
return (new PropagatorFactory())->create();
9194
}
9295

9396
public function propagationHeaders(?ContextInterface $context = null): array

0 commit comments

Comments
 (0)