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.
- checksums.yaml +4 -4
- data/.github/workflows/lint.yml +22 -0
- data/.github/workflows/{ci.yml → tests.yml} +3 -21
- data/.rubocop.yml +2 -1
- data/CHANGELOG.md +18 -0
- data/Gemfile +8 -10
- data/README.md +7 -4
- data/Rakefile +6 -6
- data/benchmark/send-metrics-to-dev-null-log +14 -14
- data/benchmark/send-metrics-to-local-udp-receiver +18 -18
- data/lib/statsd/instrument/assertions.rb +7 -7
- data/lib/statsd/instrument/batched_udp_sink.rb +159 -0
- data/lib/statsd/instrument/client.rb +3 -3
- data/lib/statsd/instrument/datagram.rb +1 -1
- data/lib/statsd/instrument/datagram_builder.rb +10 -22
- data/lib/statsd/instrument/dogstatsd_datagram_builder.rb +2 -2
- data/lib/statsd/instrument/environment.rb +19 -11
- data/lib/statsd/instrument/expectation.rb +6 -18
- data/lib/statsd/instrument/matchers.rb +8 -4
- data/lib/statsd/instrument/railtie.rb +1 -1
- data/lib/statsd/instrument/rubocop/measure_as_dist_argument.rb +1 -1
- data/lib/statsd/instrument/rubocop/metaprogramming_positional_arguments.rb +2 -2
- data/lib/statsd/instrument/rubocop/metric_prefix_argument.rb +1 -1
- data/lib/statsd/instrument/rubocop/metric_return_value.rb +3 -3
- data/lib/statsd/instrument/rubocop/metric_value_keyword_argument.rb +1 -1
- data/lib/statsd/instrument/rubocop/positional_arguments.rb +4 -4
- data/lib/statsd/instrument/rubocop/singleton_configuration.rb +1 -1
- data/lib/statsd/instrument/rubocop/splat_arguments.rb +2 -2
- data/lib/statsd/instrument/rubocop.rb +13 -34
- data/lib/statsd/instrument/strict.rb +1 -1
- data/lib/statsd/instrument/udp_sink.rb +11 -13
- data/lib/statsd/instrument/version.rb +1 -1
- data/lib/statsd/instrument.rb +56 -59
- data/lib/statsd-instrument.rb +1 -1
- data/statsd-instrument.gemspec +2 -0
- data/test/assertions_test.rb +200 -155
- data/test/benchmark/clock_gettime.rb +1 -1
- data/test/benchmark/metrics.rb +8 -8
- data/test/benchmark/tags.rb +4 -4
- data/test/capture_sink_test.rb +11 -11
- data/test/client_test.rb +64 -64
- data/test/datagram_builder_test.rb +41 -41
- data/test/datagram_test.rb +5 -5
- data/test/dogstatsd_datagram_builder_test.rb +22 -22
- data/test/environment_test.rb +26 -17
- data/test/helpers/rubocop_helper.rb +3 -3
- data/test/helpers_test.rb +12 -12
- data/test/integration_test.rb +6 -6
- data/test/log_sink_test.rb +2 -2
- data/test/matchers_test.rb +46 -46
- data/test/null_sink_test.rb +2 -2
- data/test/rubocop/measure_as_dist_argument_test.rb +2 -2
- data/test/rubocop/metaprogramming_positional_arguments_test.rb +2 -2
- data/test/rubocop/metric_prefix_argument_test.rb +2 -2
- data/test/rubocop/metric_return_value_test.rb +3 -3
- data/test/rubocop/metric_value_keyword_argument_test.rb +3 -3
- data/test/rubocop/positional_arguments_test.rb +2 -2
- data/test/rubocop/singleton_configuration_test.rb +8 -8
- data/test/rubocop/splat_arguments_test.rb +2 -2
- data/test/statsd_datagram_builder_test.rb +6 -6
- data/test/statsd_instrumentation_test.rb +104 -104
- data/test/statsd_test.rb +35 -35
- data/test/test_helper.rb +13 -6
- data/test/udp_sink_test.rb +142 -44
- metadata +21 -7
- 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
|