File tree 1 file changed +7
-1
lines changed
1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -27,8 +27,11 @@ def flush(self, tags=None):
27
27
Modified based on `datadog.threadstats.base.ThreadStats.flush()`,
28
28
to gain better control over exception handling.
29
29
"""
30
+ original_constant_tags = self .thread_stats .constant_tags .copy ()
30
31
if tags :
31
- self .thread_stats .constant_tags = self .thread_stats .constant_tags + tags
32
+ # Temporarily add tags for this flush
33
+ self .thread_stats .constant_tags = original_constant_tags + tags
34
+
32
35
_ , dists = self .thread_stats ._get_aggregate_metrics_and_dists (float ("inf" ))
33
36
count_dists = len (dists )
34
37
if not count_dists :
@@ -62,6 +65,9 @@ def flush(self, tags=None):
62
65
logger .debug (
63
66
"Flush #%s failed" , self .thread_stats .flush_count , exc_info = True
64
67
)
68
+ finally :
69
+ # Reset constant_tags to its original state
70
+ self .thread_stats .constant_tags = original_constant_tags
65
71
66
72
def stop (self ):
67
73
self .thread_stats .stop ()
You can’t perform that action at this time.
0 commit comments