File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -58,6 +58,18 @@ def test_global_labels_override(self):
5858 for metric in random_metrics :
5959 self .assertIn (f'{ metric } {{global_label="global_value"}} 0' , export )
6060
61+ def test_edited_metric_labels (self ):
62+ """Test that editing labels on an added metric do not affect global labels"""
63+ test_labels = {"label1" : "value1" , "label2" : "value2" }
64+ e = Exporter (no_config_file = True , labels = test_labels )
65+ random_metrics = generate_random_metric_config (10 )
66+ e .config ["metrics" ] = random_metrics
67+ e .metrics = []
68+ e .export_config_metrics () # Generate metrics from the config
69+ for metric in e .metrics :
70+ self .assertEqual (metric .labels , test_labels )
71+ metric .labels = {"asdf" : str (uuid4 ())}
72+ self .assertEqual (e .labels , test_labels )
6173
6274 def test_append_metrics (self ):
6375 """Ensures metrics can be appended after init"""
You can’t perform that action at this time.
0 commit comments