diff --git a/CHANGELOG.md b/CHANGELOG.md index 65011aa..1601c52 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ [Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-opentracing/compare/0.16.1..HEAD +### Fixed + +- Added the ctk activity name in activity spans to enrich the user readability in backend tracing systems. [#5][ctk-opentracing-5] + +[ctk-opentracing-5]: https://github.com/chaostoolkit-incubator/chaostoolkit-opentracing/issues/5 ## [0.16.1][] - 2023-12-18 diff --git a/chaostracing/oltp.py b/chaostracing/oltp.py index 1a6515c..fd5cbe2 100644 --- a/chaostracing/oltp.py +++ b/chaostracing/oltp.py @@ -231,11 +231,15 @@ def continuous_hypothesis_iteration(self, iteration_index: int, state: Any) -> N .timestamp() * 1e9 ) + activity_name: str = probe["activity"]["name"] with new_span( - "activity", span, start_time=child_start_ts, end_on_exit=False + f"activity: {activity_name}", + span, + start_time=child_start_ts, + end_on_exit=False, ) as child: activity = probe["activity"] - child.set_attribute("chaostoolkit.activity.name", activity["name"]) + child.set_attribute("chaostoolkit.activity.name", activity_name) child.set_attribute( "chaostoolkit.activity.background", activity.get("background", False), @@ -330,13 +334,14 @@ def rollbacks_completed(self, experiment: Experiment, journal: Journal) -> None: def start_activity(self, activity: Activity) -> None: parent = self.current_span + activity_name: str = activity.get("name") if self.continuous_span is not None: if "tolerance" in activity: return stack = ExitStack() - span = stack.enter_context(new_span("activity", parent)) - span.set_attribute("chaostoolkit.activity.name", activity.get("name")) + span = stack.enter_context(new_span(f"activity: {activity_name}", parent)) + span.set_attribute("chaostoolkit.activity.name", activity_name) span.set_attribute( "chaostoolkit.activity.background", activity.get("background", False) )