Skip to content

Commit

Permalink
add distributions event
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jun 24, 2024
1 parent 0ac8821 commit 40c190c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/datadog/core/telemetry/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,13 @@ def payload(_)
}
end
end

# Telemetry class for the 'distributions' event
class Distributions < GenerateMetrics
def type
'distributions'
end
end
end
end
end
Expand Down
3 changes: 3 additions & 0 deletions sig/datadog/core/telemetry/event.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ module Datadog

def initialize: (String namespace, Enumerable[Hash[Symbol, untyped]] metric_series) -> void
end

class Distributions < GenerateMetrics
end
end
end
end
Expand Down
18 changes: 18 additions & 0 deletions spec/datadog/core/telemetry/event_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,4 +225,22 @@ def contain_configuration(*array)
)
end
end

context 'Distributions' do
let(:event) { described_class::Distributions.new(namespace, metric_series) }

let(:namespace) { 'general' }
let(:metric_name) { 'request_duration' }
let(:points) { [13, 14, 15, 16] }
let(:metric_series) { [{ metric: metric_name, points: points }] }

it do
is_expected.to eq(
{
namespace: namespace,
series: metric_series
}
)
end
end
end

0 comments on commit 40c190c

Please sign in to comment.