Skip to content

Commit

Permalink
fix(opentelemetry): close span even if no logs are sent (#8367)
Browse files Browse the repository at this point in the history
* fix(opentelemetry): close span even if no logs are sent

* changelog

(cherry picked from commit 03240ad)
  • Loading branch information
v1v authored and patchback[bot] committed May 19, 2024
1 parent 711c5f3 commit 320768d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/8367-fix-close-span-if-no-logs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "opentelemetry callback plugin - close spans always (https://github.com/ansible-collections/community.general/pull/8367)."
3 changes: 2 additions & 1 deletion plugins/callback/opentelemetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ def update_span_data(self, task_data, host_data, span, disable_logs, disable_att
if not disable_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.end(end_time=host_data.finish)
# Close span always
span.end(end_time=host_data.finish)

def set_span_attributes(self, span, attributes):
""" update the span attributes with the given attributes if not None """
Expand Down

0 comments on commit 320768d

Please sign in to comment.