statsd-instrument 3.0.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/lint.yml +22 -0
  3. data/.github/workflows/{ci.yml → tests.yml} +3 -21
  4. data/.rubocop.yml +2 -1
  5. data/CHANGELOG.md +18 -0
  6. data/Gemfile +8 -10
  7. data/README.md +7 -4
  8. data/Rakefile +6 -6
  9. data/benchmark/send-metrics-to-dev-null-log +14 -14
  10. data/benchmark/send-metrics-to-local-udp-receiver +18 -18
  11. data/lib/statsd/instrument/assertions.rb +7 -7
  12. data/lib/statsd/instrument/batched_udp_sink.rb +159 -0
  13. data/lib/statsd/instrument/client.rb +3 -3
  14. data/lib/statsd/instrument/datagram.rb +1 -1
  15. data/lib/statsd/instrument/datagram_builder.rb +10 -22
  16. data/lib/statsd/instrument/dogstatsd_datagram_builder.rb +2 -2
  17. data/lib/statsd/instrument/environment.rb +19 -11
  18. data/lib/statsd/instrument/expectation.rb +6 -18
  19. data/lib/statsd/instrument/matchers.rb +8 -4
  20. data/lib/statsd/instrument/railtie.rb +1 -1
  21. data/lib/statsd/instrument/rubocop/measure_as_dist_argument.rb +1 -1
  22. data/lib/statsd/instrument/rubocop/metaprogramming_positional_arguments.rb +2 -2
  23. data/lib/statsd/instrument/rubocop/metric_prefix_argument.rb +1 -1
  24. data/lib/statsd/instrument/rubocop/metric_return_value.rb +3 -3
  25. data/lib/statsd/instrument/rubocop/metric_value_keyword_argument.rb +1 -1
  26. data/lib/statsd/instrument/rubocop/positional_arguments.rb +4 -4
  27. data/lib/statsd/instrument/rubocop/singleton_configuration.rb +1 -1
  28. data/lib/statsd/instrument/rubocop/splat_arguments.rb +2 -2
  29. data/lib/statsd/instrument/rubocop.rb +13 -34
  30. data/lib/statsd/instrument/strict.rb +1 -1
  31. data/lib/statsd/instrument/udp_sink.rb +11 -13
  32. data/lib/statsd/instrument/version.rb +1 -1
  33. data/lib/statsd/instrument.rb +56 -59
  34. data/lib/statsd-instrument.rb +1 -1
  35. data/statsd-instrument.gemspec +2 -0
  36. data/test/assertions_test.rb +200 -155
  37. data/test/benchmark/clock_gettime.rb +1 -1
  38. data/test/benchmark/metrics.rb +8 -8
  39. data/test/benchmark/tags.rb +4 -4
  40. data/test/capture_sink_test.rb +11 -11
  41. data/test/client_test.rb +64 -64
  42. data/test/datagram_builder_test.rb +41 -41
  43. data/test/datagram_test.rb +5 -5
  44. data/test/dogstatsd_datagram_builder_test.rb +22 -22
  45. data/test/environment_test.rb +26 -17
  46. data/test/helpers/rubocop_helper.rb +3 -3
  47. data/test/helpers_test.rb +12 -12
  48. data/test/integration_test.rb +6 -6
  49. data/test/log_sink_test.rb +2 -2
  50. data/test/matchers_test.rb +46 -46
  51. data/test/null_sink_test.rb +2 -2
  52. data/test/rubocop/measure_as_dist_argument_test.rb +2 -2
  53. data/test/rubocop/metaprogramming_positional_arguments_test.rb +2 -2
  54. data/test/rubocop/metric_prefix_argument_test.rb +2 -2
  55. data/test/rubocop/metric_return_value_test.rb +3 -3
  56. data/test/rubocop/metric_value_keyword_argument_test.rb +3 -3
  57. data/test/rubocop/positional_arguments_test.rb +2 -2
  58. data/test/rubocop/singleton_configuration_test.rb +8 -8
  59. data/test/rubocop/splat_arguments_test.rb +2 -2
  60. data/test/statsd_datagram_builder_test.rb +6 -6
  61. data/test/statsd_instrumentation_test.rb +104 -104
  62. data/test/statsd_test.rb +35 -35
  63. data/test/test_helper.rb +13 -6
  64. data/test/udp_sink_test.rb +142 -44
  65. metadata +21 -7
  66. data/test/benchmark/default_tags.rb +0 -47
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'statsd-instrument'
4
- require 'benchmark/ips'
5
-
6
- StatsD.logger = Logger.new(File::NULL)
7
-
8
- class Suite
9
- def warming(*args)
10
- StatsD.default_tags = if args[0] == "with default tags"
11
- { first_tag: 'first_value', second_tag: 'second_value' }
12
- end
13
- puts "warming with default tags: #{StatsD.default_tags}"
14
- end
15
-
16
- def running(*args)
17
- StatsD.default_tags = if args[0] == "with default tags"
18
- { first_tag: 'first_value', second_tag: 'second_value' }
19
- end
20
- puts "running with default tags: #{StatsD.default_tags}"
21
- end
22
-
23
- def warmup_stats(*)
24
- end
25
-
26
- def add_report(*)
27
- end
28
- end
29
-
30
- suite = Suite.new
31
-
32
- Benchmark.ips do |bench|
33
- bench.config(suite: suite)
34
- bench.report("without default tags") do
35
- StatsD.increment('GoogleBase.insert', tags: {
36
- first_tag: 'first_value',
37
- second_tag: 'second_value',
38
- third_tag: 'third_value',
39
- })
40
- end
41
-
42
- bench.report("with default tags") do
43
- StatsD.increment('GoogleBase.insert', tags: { third_tag: 'third_value' })
44
- end
45
-
46
- bench.compare!
47
- end