@@ -58,7 +58,7 @@ def parse_metrics(bytes):
58
58
59
59
@minimum_python_37_with_gevent
60
60
@pytest .mark .forked
61
- def test_incr (sentry_init , capture_envelopes , maybe_monkeypatched_threading ):
61
+ def test_increment (sentry_init , capture_envelopes , maybe_monkeypatched_threading ):
62
62
sentry_init (
63
63
release = "fun-release" ,
64
64
environment = "not-fun-env" ,
@@ -67,7 +67,8 @@ def test_incr(sentry_init, capture_envelopes, maybe_monkeypatched_threading):
67
67
ts = time .time ()
68
68
envelopes = capture_envelopes ()
69
69
70
- metrics .incr ("foobar" , 1.0 , tags = {"foo" : "bar" , "blub" : "blah" }, timestamp = ts )
70
+ metrics .increment ("foobar" , 1.0 , tags = {"foo" : "bar" , "blub" : "blah" }, timestamp = ts )
71
+ # python specific alias
71
72
metrics .incr ("foobar" , 2.0 , tags = {"foo" : "bar" , "blub" : "blah" }, timestamp = ts )
72
73
Hub .current .flush ()
73
74
@@ -487,8 +488,8 @@ def test_multiple(sentry_init, capture_envelopes):
487
488
metrics .gauge ("my-gauge" , 20.0 , tags = {"x" : "y" }, timestamp = ts )
488
489
metrics .gauge ("my-gauge" , 30.0 , tags = {"x" : "y" }, timestamp = ts )
489
490
for _ in range (10 ):
490
- metrics .incr ("counter-1" , 1.0 , timestamp = ts )
491
- metrics .incr ("counter-2" , 1.0 , timestamp = ts )
491
+ metrics .increment ("counter-1" , 1.0 , timestamp = ts )
492
+ metrics .increment ("counter-2" , 1.0 , timestamp = ts )
492
493
493
494
Hub .current .flush ()
494
495
@@ -589,7 +590,7 @@ def test_metric_summaries(
589
590
with start_transaction (
590
591
op = "stuff" , name = "/foo" , source = TRANSACTION_SOURCE_ROUTE
591
592
) as transaction :
592
- metrics .incr ("root-counter" , timestamp = ts )
593
+ metrics .increment ("root-counter" , timestamp = ts )
593
594
with metrics .timing ("my-timer-metric" , tags = {"a" : "b" }, timestamp = ts ):
594
595
for x in range (10 ):
595
596
metrics .distribution ("my-dist" , float (x ), timestamp = ts )
@@ -859,7 +860,7 @@ def before_emit(key, tags):
859
860
tags ["extra" ] = "foo"
860
861
del tags ["release" ]
861
862
# this better be a noop!
862
- metrics .incr ("shitty-recursion" )
863
+ metrics .increment ("shitty-recursion" )
863
864
return True
864
865
865
866
sentry_init (
@@ -873,8 +874,8 @@ def before_emit(key, tags):
873
874
)
874
875
envelopes = capture_envelopes ()
875
876
876
- metrics .incr ("removed-metric" , 1.0 )
877
- metrics .incr ("actual-metric" , 1.0 )
877
+ metrics .increment ("removed-metric" , 1.0 )
878
+ metrics .increment ("actual-metric" , 1.0 )
878
879
Hub .current .flush ()
879
880
880
881
(envelope ,) = envelopes
@@ -906,7 +907,7 @@ def test_aggregator_flush(
906
907
)
907
908
envelopes = capture_envelopes ()
908
909
909
- metrics .incr ("a-metric" , 1.0 )
910
+ metrics .increment ("a-metric" , 1.0 )
910
911
Hub .current .flush ()
911
912
912
913
assert len (envelopes ) == 1
@@ -925,7 +926,7 @@ def test_tag_serialization(
925
926
)
926
927
envelopes = capture_envelopes ()
927
928
928
- metrics .incr (
929
+ metrics .increment (
929
930
"counter" ,
930
931
tags = {
931
932
"no-value" : None ,
@@ -970,12 +971,12 @@ def test_flush_recursion_protection(
970
971
real_capture_envelope = test_client .transport .capture_envelope
971
972
972
973
def bad_capture_envelope (* args , ** kwargs ):
973
- metrics .incr ("bad-metric" )
974
+ metrics .increment ("bad-metric" )
974
975
return real_capture_envelope (* args , ** kwargs )
975
976
976
977
monkeypatch .setattr (test_client .transport , "capture_envelope" , bad_capture_envelope )
977
978
978
- metrics .incr ("counter" )
979
+ metrics .increment ("counter" )
979
980
980
981
# flush twice to see the inner metric
981
982
Hub .current .flush ()
@@ -1004,12 +1005,12 @@ def test_flush_recursion_protection_background_flush(
1004
1005
real_capture_envelope = test_client .transport .capture_envelope
1005
1006
1006
1007
def bad_capture_envelope (* args , ** kwargs ):
1007
- metrics .incr ("bad-metric" )
1008
+ metrics .increment ("bad-metric" )
1008
1009
return real_capture_envelope (* args , ** kwargs )
1009
1010
1010
1011
monkeypatch .setattr (test_client .transport , "capture_envelope" , bad_capture_envelope )
1011
1012
1012
- metrics .incr ("counter" )
1013
+ metrics .increment ("counter" )
1013
1014
1014
1015
# flush via sleep and flag
1015
1016
Hub .current .client .metrics_aggregator ._force_flush = True
0 commit comments