Skip to content

Commit bab94b9

Browse files
committed
Update for service.name (in elastic-apm 5.10.1)
1 parent 39b04a9 commit bab94b9

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

ecs_logging/_stdlib.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ def format_to_ecs(self, record):
165165
extras["span.id"] = extras.pop("elasticapm_span_id", None)
166166
extras["transaction.id"] = extras.pop("elasticapm_transaction_id", None)
167167
extras["trace.id"] = extras.pop("elasticapm_trace_id", None)
168+
extras["service.name"] = extras.pop("elasticapm_service_name", None)
168169

169170
# Merge in any keys that were set within 'extra={...}'
170171
for field, value in extras.items():

tests/test_apm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ def test_elasticapm_structlog_log_correlation_ecs_fields(spec_validator):
3939
"span": {"id": span_id},
4040
"trace": {"id": trace_id},
4141
"transaction": {"id": transaction_id},
42+
"service": {"name": "apm-service"},
4243
}
4344

4445

@@ -85,6 +86,7 @@ def test_elastic_apm_stdlib_no_filter_log_correlation_ecs_fields():
8586
"span": {"id": span_id},
8687
"trace": {"id": trace_id},
8788
"transaction": {"id": transaction_id},
89+
"service": {"name": "apm-service"},
8890
}
8991

9092

@@ -129,6 +131,7 @@ def test_elastic_apm_stdlib_with_filter_log_correlation_ecs_fields():
129131
"span": {"id": span_id},
130132
"trace": {"id": trace_id},
131133
"transaction": {"id": transaction_id},
134+
"service": {"name": "apm-service"},
132135
}
133136

134137

@@ -174,4 +177,5 @@ def test_elastic_apm_stdlib_exclude_fields():
174177
},
175178
"message": "test message",
176179
"trace": {"id": trace_id},
180+
"service": {"name": "apm-service"},
177181
}

0 commit comments

Comments
 (0)