mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
[PR #8367/03240ad7 backport][stable-8] fix(opentelemetry): close span even if no logs are sent (#8389)
fix(opentelemetry): close span even if no logs are sent (#8367)
* fix(opentelemetry): close span even if no logs are sent
* changelog
(cherry picked from commit 03240ad7dc
)
Co-authored-by: Victor Martinez <victormartinezrubio@gmail.com>
This commit is contained in:
parent
711c5f3eb5
commit
eff8ca8d9b
2 changed files with 4 additions and 1 deletions
2
changelogs/fragments/8367-fix-close-span-if-no-logs.yaml
Normal file
2
changelogs/fragments/8367-fix-close-span-if-no-logs.yaml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
bugfixes:
|
||||||
|
- "opentelemetry callback plugin - close spans always (https://github.com/ansible-collections/community.general/pull/8367)."
|
|
@ -350,7 +350,8 @@ class OpenTelemetrySource(object):
|
||||||
if not disable_logs:
|
if not disable_logs:
|
||||||
# This will avoid populating span attributes to the logs
|
# This will avoid populating span attributes to the logs
|
||||||
span.add_event(task_data.dump, attributes={} if disable_attributes_in_logs else attributes)
|
span.add_event(task_data.dump, attributes={} if disable_attributes_in_logs else attributes)
|
||||||
span.end(end_time=host_data.finish)
|
# Close span always
|
||||||
|
span.end(end_time=host_data.finish)
|
||||||
|
|
||||||
def set_span_attributes(self, span, attributes):
|
def set_span_attributes(self, span, attributes):
|
||||||
""" update the span attributes with the given attributes if not None """
|
""" update the span attributes with the given attributes if not None """
|
||||||
|
|
Loading…
Reference in a new issue