@@ -58,7 +58,7 @@ def parse_metrics(bytes):
5858
5959@minimum_python_37_with_gevent
6060@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 ):
6262 sentry_init (
6363 release = "fun-release" ,
6464 environment = "not-fun-env" ,
@@ -67,7 +67,8 @@ def test_incr(sentry_init, capture_envelopes, maybe_monkeypatched_threading):
6767 ts = time .time ()
6868 envelopes = capture_envelopes ()
6969
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
7172 metrics .incr ("foobar" , 2.0 , tags = {"foo" : "bar" , "blub" : "blah" }, timestamp = ts )
7273 Hub .current .flush ()
7374
@@ -487,8 +488,8 @@ def test_multiple(sentry_init, capture_envelopes):
487488 metrics .gauge ("my-gauge" , 20.0 , tags = {"x" : "y" }, timestamp = ts )
488489 metrics .gauge ("my-gauge" , 30.0 , tags = {"x" : "y" }, timestamp = ts )
489490 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 )
492493
493494 Hub .current .flush ()
494495
@@ -589,7 +590,7 @@ def test_metric_summaries(
589590 with start_transaction (
590591 op = "stuff" , name = "/foo" , source = TRANSACTION_SOURCE_ROUTE
591592 ) as transaction :
592- metrics .incr ("root-counter" , timestamp = ts )
593+ metrics .increment ("root-counter" , timestamp = ts )
593594 with metrics .timing ("my-timer-metric" , tags = {"a" : "b" }, timestamp = ts ):
594595 for x in range (10 ):
595596 metrics .distribution ("my-dist" , float (x ), timestamp = ts )
@@ -859,7 +860,7 @@ def before_emit(key, tags):
859860 tags ["extra" ] = "foo"
860861 del tags ["release" ]
861862 # this better be a noop!
862- metrics .incr ("shitty-recursion" )
863+ metrics .increment ("shitty-recursion" )
863864 return True
864865
865866 sentry_init (
@@ -873,8 +874,8 @@ def before_emit(key, tags):
873874 )
874875 envelopes = capture_envelopes ()
875876
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 )
878879 Hub .current .flush ()
879880
880881 (envelope ,) = envelopes
@@ -906,7 +907,7 @@ def test_aggregator_flush(
906907 )
907908 envelopes = capture_envelopes ()
908909
909- metrics .incr ("a-metric" , 1.0 )
910+ metrics .increment ("a-metric" , 1.0 )
910911 Hub .current .flush ()
911912
912913 assert len (envelopes ) == 1
@@ -925,7 +926,7 @@ def test_tag_serialization(
925926 )
926927 envelopes = capture_envelopes ()
927928
928- metrics .incr (
929+ metrics .increment (
929930 "counter" ,
930931 tags = {
931932 "no-value" : None ,
@@ -970,12 +971,12 @@ def test_flush_recursion_protection(
970971 real_capture_envelope = test_client .transport .capture_envelope
971972
972973 def bad_capture_envelope (* args , ** kwargs ):
973- metrics .incr ("bad-metric" )
974+ metrics .increment ("bad-metric" )
974975 return real_capture_envelope (* args , ** kwargs )
975976
976977 monkeypatch .setattr (test_client .transport , "capture_envelope" , bad_capture_envelope )
977978
978- metrics .incr ("counter" )
979+ metrics .increment ("counter" )
979980
980981 # flush twice to see the inner metric
981982 Hub .current .flush ()
@@ -1004,12 +1005,12 @@ def test_flush_recursion_protection_background_flush(
10041005 real_capture_envelope = test_client .transport .capture_envelope
10051006
10061007 def bad_capture_envelope (* args , ** kwargs ):
1007- metrics .incr ("bad-metric" )
1008+ metrics .increment ("bad-metric" )
10081009 return real_capture_envelope (* args , ** kwargs )
10091010
10101011 monkeypatch .setattr (test_client .transport , "capture_envelope" , bad_capture_envelope )
10111012
1012- metrics .incr ("counter" )
1013+ metrics .increment ("counter" )
10131014
10141015 # flush via sleep and flag
10151016 Hub .current .client .metrics_aggregator ._force_flush = True
0 commit comments