Skip to content

Commit 62bc6ba

Browse files
committed
Fix handling of different types.
1 parent 0c2ad3a commit 62bc6ba

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/metrics/backend/datadog/interface.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ module Interface
6565
def metric(name, type, description: nil, unit: nil)
6666
klass = Metric
6767

68-
case name
68+
case type
6969
when :counter
7070
# klass = Metric
7171
when :guage

test/metrics/backend/datadog.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ def my_method(argument)
1515

1616
Metrics::Provider(MyClass) do
1717
MYCLASS_CALL_COUNT = Metrics.metric('my_class.call', :counter, description: 'Call counter.')
18+
MYCLASS_CALL_DISTRIBUTION = Metrics.metric('my_class.call', :distribution, description: 'Call distribution.')
1819

1920
def my_method(argument)
2021
MYCLASS_CALL_COUNT.emit(1, tags: ["foo", "bar"])
@@ -28,6 +29,10 @@ def my_method(argument)
2829
expect(Metrics::VERSION).to be =~ /\d+\.\d+\.\d+/
2930
end
3031

32+
it "supports distributions" do
33+
expect(MYCLASS_CALL_DISTRIBUTION).to be_a(Metrics::Backend::Datadog::Distribution)
34+
end
35+
3136
with "mock server" do
3237
include Sus::Fixtures::Async::ReactorContext
3338

0 commit comments

Comments
 (0)