From 30e3039c9e725ddacccb41598d85e0046d235b85 Mon Sep 17 00:00:00 2001 From: Brett McBride Date: Mon, 6 May 2024 08:35:19 +1000 Subject: [PATCH] implement events v1.32 (#1291) * implement events v1.32 implement the events api + sdk per spec v1.32: - event logger is now only retrievable via an event logger provider - domain attribute for events is removed - events accept a subset of logrecord params, rather than an entire logrecord * convert severity to a backed enum * lint * remove instead of deprecating logEvent, mark Logger constructor as internal * make severity an enum only * event attributes to iterable * inject ClockInterface, add CachedInstrumentation, update examples * set correct defaults for events * test coverage * Revert "make severity an enum only" This reverts commit 710822907bbc41d1ddcb2c19aa78222f59bde3aa. Also, move PSR-3 mapping into the Severity enum. * event attributes to iterable * apply review feedback --- ComponentProvider/OpenTelemetrySdk.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ComponentProvider/OpenTelemetrySdk.php b/ComponentProvider/OpenTelemetrySdk.php index 45e35ae..730164e 100644 --- a/ComponentProvider/OpenTelemetrySdk.php +++ b/ComponentProvider/OpenTelemetrySdk.php @@ -14,6 +14,7 @@ use OpenTelemetry\Context\Propagation\TextMapPropagatorInterface; use OpenTelemetry\SDK\Common\Attribute\Attributes; use OpenTelemetry\SDK\Common\Instrumentation\InstrumentationScopeFactory; +use OpenTelemetry\SDK\Logs\EventLoggerProvider; use OpenTelemetry\SDK\Logs\LoggerProvider; use OpenTelemetry\SDK\Logs\LogRecordProcessorInterface; use OpenTelemetry\SDK\Logs\Processor\MultiLogRecordProcessor; @@ -239,12 +240,14 @@ public function createPlugin(array $properties, Context $context): SdkBuilder instrumentationScopeFactory: new InstrumentationScopeFactory(Attributes::factory()), resource: $resource, ); + $eventLoggerProvider = new EventLoggerProvider($loggerProvider); // $sdkBuilder->setTracerProvider($tracerProvider); $sdkBuilder->setMeterProvider($meterProvider); $sdkBuilder->setLoggerProvider($loggerProvider); + $sdkBuilder->setEventLoggerProvider($eventLoggerProvider); return $sdkBuilder; }