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

Commit 72cf701

Browse files
committed
fix:cs
1 parent 75fd52d commit 72cf701

12 files changed

+18
-33
lines changed

examples/configuration_guide.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@
2222
$traceIdGlobal = config('otel.middleware.trace_id.global', true);
2323
$traceIdHeaderName = config('otel.middleware.trace_id.header_name', 'X-Trace-Id');
2424

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";
2727
echo "Trace ID Header name: {$traceIdHeaderName}\n";
2828

2929
// 4. Check new HTTP client configuration
3030
$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";
3232

3333
// 5. View all available watchers
3434
$watchers = config('otel.watchers', []);
@@ -47,8 +47,8 @@
4747
echo "OTEL_HTTP_CLIENT_PROPAGATION_ENABLED=true\n";
4848

4949
// 7. Demonstrate how to use in code
50-
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
5150
use Illuminate\Support\Facades\Http;
51+
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
5252

5353
// Fully automatic HTTP request tracing
5454
// No manual code needed - all requests through Http facade are automatically traced with context propagation
@@ -57,10 +57,10 @@
5757
// View tracing status
5858
$status = Measure::getStatus();
5959
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";
6464

6565
// 8. How to disable HTTP client propagation middleware
6666
echo "\n=== How to Disable HTTP Client Propagation ===\n";

examples/duplicate_tracing_test.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
* This file demonstrates how HttpClientWatcher intelligently avoids duplicate tracing
77
* through automatic context propagation using Laravel's globalRequestMiddleware
88
*/
9-
10-
use Illuminate\Support\Facades\Http;
11-
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
12-
139
echo "=== HTTP Client Tracing Solution ===\n\n";
1410

1511
echo "Previous Issue:\n";

examples/octane_span_hierarchy_test.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
* 修复后: span 应该正确关联到父 span,形成完整的 trace 层次结构
99
*/
1010

11-
use Illuminate\Support\Facades\Http;
1211
use Illuminate\Support\Facades\Cache;
13-
use Illuminate\Support\Facades\Route;
1412
use Illuminate\Support\Facades\DB;
13+
use Illuminate\Support\Facades\Http;
14+
use Illuminate\Support\Facades\Route;
1515
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
1616

1717
Route::get('/octane-hierarchy-test', function () {
@@ -50,9 +50,9 @@
5050
'database.query (posts)',
5151
'cache.miss (another_key)',
5252
'http.client.get (httpbin.org/uuid)',
53-
]
54-
]
55-
]
53+
],
54+
],
55+
],
5656
];
5757
});
5858
});
@@ -86,6 +86,6 @@
8686
'each_request_has_unique_trace_id' => true,
8787
'spans_are_properly_nested' => true,
8888
'no_orphaned_spans' => true,
89-
]
89+
],
9090
];
9191
});

examples/simplified_auto_tracing.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
* without needing to manually configure tracing middleware
88
*/
99

10-
use Illuminate\Support\Facades\Http;
1110
use Illuminate\Support\Facades\Cache;
11+
use Illuminate\Support\Facades\Http;
1212
use Illuminate\Support\Facades\Route;
1313
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
1414

@@ -17,6 +17,7 @@
1717
Http::get('https://httpbin.org/ip'); // Automatically traced
1818
event('hello.created', ['name' => 'test']); // EventWatcher automatically traces
1919
Cache::get('foo', 'bar'); // CacheWatcher automatically traces
20+
2021
return 'Hello, World!';
2122
});
2223

@@ -26,6 +27,7 @@
2627
Http::get('https://httpbin.org/ip'); // Automatically traced
2728
event('hello.created2', ['name' => 'test']); // EventWatcher automatically traces
2829
Cache::get('foo', 'bar'); // CacheWatcher automatically traces
30+
2931
return 'Hello, Foo!';
3032
});
3133
});

src/Handlers/RequestHandledHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
namespace Overtrue\LaravelOpenTelemetry\Handlers;
66

77
use Laravel\Octane\Events\RequestHandled;
8-
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
9-
use Overtrue\LaravelOpenTelemetry\Support\HttpAttributesHelper;
108

119
class RequestHandledHandler
1210
{

src/Handlers/RequestReceivedHandler.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
use Laravel\Octane\Events\RequestReceived;
88
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
9-
use Overtrue\LaravelOpenTelemetry\Support\HttpAttributesHelper;
10-
use Overtrue\LaravelOpenTelemetry\Support\SpanNameHelper;
119

1210
class RequestReceivedHandler
1311
{

src/Handlers/RequestTerminatedHandler.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Laravel\Octane\Events\RequestTerminated;
88
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
9-
use Overtrue\LaravelOpenTelemetry\Support\HttpAttributesHelper;
109

1110
class RequestTerminatedHandler
1211
{

src/OpenTelemetryServiceProvider.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,6 @@ protected function registerCommands(): void
111111
}
112112
}
113113

114-
115-
116114
/**
117115
* Register middlewares
118116
*/

tests/Http/Middleware/SpanHierarchyTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Support\Facades\Route;
66
use Overtrue\LaravelOpenTelemetry\Facades\Measure;
7-
use Overtrue\LaravelOpenTelemetry\Http\Middleware\TraceRequest;
87
use Overtrue\LaravelOpenTelemetry\Tests\TestCase;
98

109
class SpanHierarchyTest extends TestCase

tests/Http/Middleware/TraceRequestIntegrationTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Illuminate\Support\Facades\Log;
66
use Illuminate\Support\Facades\Route;
7-
use Overtrue\LaravelOpenTelemetry\Http\Middleware\TraceRequest;
87
use Overtrue\LaravelOpenTelemetry\Tests\TestCase;
98

109
class TraceRequestIntegrationTest extends TestCase

0 commit comments

Comments
 (0)