|
22 | 22 | $traceIdGlobal = config('otel.middleware.trace_id.global', true); |
23 | 23 | $traceIdHeaderName = config('otel.middleware.trace_id.header_name', 'X-Trace-Id'); |
24 | 24 |
|
25 | | -echo "Trace ID Middleware enabled: " . ($traceIdEnabled ? 'Yes' : 'No') . "\n"; |
26 | | -echo "Trace ID Middleware global: " . ($traceIdGlobal ? 'Yes' : 'No') . "\n"; |
| 25 | +echo 'Trace ID Middleware enabled: '.($traceIdEnabled ? 'Yes' : 'No')."\n"; |
| 26 | +echo 'Trace ID Middleware global: '.($traceIdGlobal ? 'Yes' : 'No')."\n"; |
27 | 27 | echo "Trace ID Header name: {$traceIdHeaderName}\n"; |
28 | 28 |
|
29 | 29 | // 4. Check new HTTP client configuration |
30 | 30 | $httpClientPropagationEnabled = config('otel.http_client.propagation_middleware.enabled', true); |
31 | | -echo "HTTP Client propagation middleware enabled: " . ($httpClientPropagationEnabled ? 'Yes' : 'No') . "\n"; |
| 31 | +echo 'HTTP Client propagation middleware enabled: '.($httpClientPropagationEnabled ? 'Yes' : 'No')."\n"; |
32 | 32 |
|
33 | 33 | // 5. View all available watchers |
34 | 34 | $watchers = config('otel.watchers', []); |
|
47 | 47 | echo "OTEL_HTTP_CLIENT_PROPAGATION_ENABLED=true\n"; |
48 | 48 |
|
49 | 49 | // 7. Demonstrate how to use in code |
50 | | -use Overtrue\LaravelOpenTelemetry\Facades\Measure; |
51 | 50 | use Illuminate\Support\Facades\Http; |
| 51 | +use Overtrue\LaravelOpenTelemetry\Facades\Measure; |
52 | 52 |
|
53 | 53 | // Fully automatic HTTP request tracing |
54 | 54 | // No manual code needed - all requests through Http facade are automatically traced with context propagation |
|
57 | 57 | // View tracing status |
58 | 58 | $status = Measure::getStatus(); |
59 | 59 | echo "\n=== Tracing Status ===\n"; |
60 | | -echo "Recording: " . ($status['is_recording'] ? 'Yes' : 'No') . "\n"; |
61 | | -echo "Current trace ID: " . ($status['current_trace_id'] ?? 'None') . "\n"; |
62 | | -echo "Active spans count: " . $status['active_spans_count'] . "\n"; |
63 | | -echo "Tracer provider: " . $status['tracer_provider']['class'] . "\n"; |
| 60 | +echo 'Recording: '.($status['is_recording'] ? 'Yes' : 'No')."\n"; |
| 61 | +echo 'Current trace ID: '.($status['current_trace_id'] ?? 'None')."\n"; |
| 62 | +echo 'Active spans count: '.$status['active_spans_count']."\n"; |
| 63 | +echo 'Tracer provider: '.$status['tracer_provider']['class']."\n"; |
64 | 64 |
|
65 | 65 | // 8. How to disable HTTP client propagation middleware |
66 | 66 | echo "\n=== How to Disable HTTP Client Propagation ===\n"; |
|
0 commit comments