From 0abff5e6234cbcc6a136a78aadd90d50269228aa Mon Sep 17 00:00:00 2001 From: Weslen Teche Date: Sun, 28 Jan 2024 00:21:43 -0300 Subject: [PATCH] update monolog example (#231) --- .../tests/Integration/LaravelInstrumentationTest.php | 1 + src/Logs/Monolog/composer.json | 6 +++--- src/Logs/Monolog/example/manual-sdk.php | 4 ++-- src/Logs/Monolog/example/multiple-channels.php | 4 ++-- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/Instrumentation/Laravel/tests/Integration/LaravelInstrumentationTest.php b/src/Instrumentation/Laravel/tests/Integration/LaravelInstrumentationTest.php index 8400f517..5dd520bb 100644 --- a/src/Instrumentation/Laravel/tests/Integration/LaravelInstrumentationTest.php +++ b/src/Instrumentation/Laravel/tests/Integration/LaravelInstrumentationTest.php @@ -28,6 +28,7 @@ public function test_request_response(): void $span = $this->storage[1]; $this->assertSame('GET', $span->getName()); } + public function test_cache_log_db(): void { $this->router()->get('/hello', function () { diff --git a/src/Logs/Monolog/composer.json b/src/Logs/Monolog/composer.json index a08b4992..cb5ee7b0 100644 --- a/src/Logs/Monolog/composer.json +++ b/src/Logs/Monolog/composer.json @@ -10,7 +10,7 @@ "prefer-stable": true, "require": { "monolog/monolog": "^1.1|^2|^3", - "open-telemetry/api": "^1.0.0beta16" + "open-telemetry/api": "^1.0" }, "autoload": { "psr-4": { @@ -22,8 +22,8 @@ "google/protobuf": ">=3.5.0", "guzzlehttp/guzzle": "^7.4", "nyholm/psr7": "^1.6", - "open-telemetry/exporter-otlp": ">=1.0.0beta6", - "open-telemetry/sdk": ">=1.0.0beta7", + "open-telemetry/exporter-otlp": ">=1.0", + "open-telemetry/sdk": ">=1.0", "phan/phan": "^5.0", "phpbench/phpbench": "^1.2", "phpstan/phpstan": "^1.1", diff --git a/src/Logs/Monolog/example/manual-sdk.php b/src/Logs/Monolog/example/manual-sdk.php index a5179387..5b61d4e6 100644 --- a/src/Logs/Monolog/example/manual-sdk.php +++ b/src/Logs/Monolog/example/manual-sdk.php @@ -15,13 +15,13 @@ use OpenTelemetry\SDK\Common\Time\ClockFactory; use OpenTelemetry\SDK\Logs\Exporter\ConsoleExporter; use OpenTelemetry\SDK\Logs\LoggerProvider; -use OpenTelemetry\SDK\Logs\Processor\BatchLogsProcessor; +use OpenTelemetry\SDK\Logs\Processor\BatchLogRecordProcessor; use Psr\Log\LogLevel; require dirname(__DIR__) . '/vendor/autoload.php'; $loggerProvider = new LoggerProvider( - new BatchLogsProcessor( + new BatchLogRecordProcessor( new ConsoleExporter((new StreamTransportFactory())->create('php://stdout', 'text')), ClockFactory::getDefault() ), diff --git a/src/Logs/Monolog/example/multiple-channels.php b/src/Logs/Monolog/example/multiple-channels.php index 70f10d6a..dfaec849 100644 --- a/src/Logs/Monolog/example/multiple-channels.php +++ b/src/Logs/Monolog/example/multiple-channels.php @@ -10,7 +10,7 @@ use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeFactory; use OpenTelemetry\SDK\Common\Time\ClockFactory; use OpenTelemetry\SDK\Logs\LoggerProvider; -use OpenTelemetry\SDK\Logs\Processor\BatchLogsProcessor; +use OpenTelemetry\SDK\Logs\Processor\BatchLogRecordProcessor; use Psr\Log\LogLevel; require dirname(__DIR__) . '/vendor/autoload.php'; @@ -21,7 +21,7 @@ */ $loggerProvider = new LoggerProvider( - new BatchLogsProcessor( + new BatchLogRecordProcessor( new LogsExporter((new StreamTransportFactory())->create('php://stdout', 'application/json')), ClockFactory::getDefault() ),