diff --git a/src/Logs/LogsAggregator.php b/src/Logs/LogsAggregator.php index 6e7136e06..9d19b08a1 100644 --- a/src/Logs/LogsAggregator.php +++ b/src/Logs/LogsAggregator.php @@ -79,7 +79,7 @@ public function add( $log = (new Log($timestamp, $traceId, $level, $formattedMessage)) ->setAttribute('sentry.release', $options->getRelease()) ->setAttribute('sentry.environment', $options->getEnvironment() ?? Event::DEFAULT_ENVIRONMENT) - ->setAttribute('sentry.server.address', $options->getServerName()) + ->setAttribute('server.address', $options->getServerName()) ->setAttribute('sentry.trace.parent_span_id', $parentSpanId); if ($client instanceof Client) { diff --git a/tests/Logs/LogsAggregatorTest.php b/tests/Logs/LogsAggregatorTest.php index 8f47ce48d..208203432 100644 --- a/tests/Logs/LogsAggregatorTest.php +++ b/tests/Logs/LogsAggregatorTest.php @@ -54,7 +54,7 @@ public function testAttributes(array $attributes, array $expected): void $log->attributes()->toSimpleArray(), static function (string $key) { // We are not testing internal Sentry attributes here, only the ones the user supplied - return !str_starts_with($key, 'sentry.'); + return !str_starts_with($key, 'sentry.') && $key !== 'server.address'; }, \ARRAY_FILTER_USE_KEY ) @@ -200,7 +200,7 @@ public function testAttributesAreAddedToLogMessage(): void $this->assertSame('1.0.0', $attributes->get('sentry.release')->getValue()); $this->assertSame('production', $attributes->get('sentry.environment')->getValue()); - $this->assertSame('web-server-01', $attributes->get('sentry.server.address')->getValue()); + $this->assertSame('web-server-01', $attributes->get('server.address')->getValue()); $this->assertSame('User %s performed action %s', $attributes->get('sentry.message.template')->getValue()); $this->assertSame('566e3688a61d4bc8', $attributes->get('sentry.trace.parent_span_id')->getValue()); $this->assertSame('sentry.php', $attributes->get('sentry.sdk.name')->getValue()); diff --git a/tests/Monolog/LogsHandlerTest.php b/tests/Monolog/LogsHandlerTest.php index 004a80c38..e77aa6809 100644 --- a/tests/Monolog/LogsHandlerTest.php +++ b/tests/Monolog/LogsHandlerTest.php @@ -54,7 +54,7 @@ public function testHandle($record, Log $expectedLog): void $log->attributes()->toSimpleArray(), static function (string $key) { // We are not testing Sentry's own attributes here, only the ones the user supplied so filter them out of the expected attributes - return !str_starts_with($key, 'sentry.'); + return !str_starts_with($key, 'sentry.') && $key !== 'server.address'; }, \ARRAY_FILTER_USE_KEY )