Skip to content

Commit a0b33eb

Browse files
Pavel Perestoronineigenein
authored andcommitted
FIX: metric name in hooks is accidentally broken in 8.0.0
1 parent 669d3bf commit a0b33eb

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

tests/test_hooks.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ def test_args(**kwargs):
151151
assert "response" in kwargs
152152
assert "exception" in kwargs
153153
assert "metric" in kwargs
154+
assert "name" in kwargs["metric"]
154155
return dict()
155156

156157
def test_metadata(*args, **kwargs):

time_execution/timed.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ def __exit__(
7070

7171
# Apply the registered hooks, and collect the metadata they might
7272
# return to be stored with the metrics.
73-
metadata = self._apply_hooks(hooks=hooks, response=self.result, exception=__exc_val, metric=metric)
73+
metadata = self._apply_hooks(
74+
hooks=hooks,
75+
response=self.result,
76+
exception=__exc_val,
77+
metric={**metric, "name": self._fqn},
78+
)
7479

7580
metric.update(metadata)
7681
write_metric(name=self._fqn, **metric)

0 commit comments

Comments
 (0)