Skip to content

Commit

Permalink
hotfix: set correct metric intervals
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewDryga committed Apr 11, 2024
1 parent 5005b4e commit b6763f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporter do
},
resource: resource,
unit: to_string(unit),
metricKind: "GAUGE",
metricKind: "CUMULATIVE",
valueType: "DOUBLE",
points: [
%{
Expand Down Expand Up @@ -373,7 +373,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporter do
valueType: "DOUBLE",
points: [
%{
interval: format_interval(started_at, ended_at),
interval: %{"endTime" => DateTime.to_iso8601(ended_at)},
value: %{"doubleValue" => min}
}
]
Expand All @@ -389,7 +389,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporter do
valueType: "DOUBLE",
points: [
%{
interval: format_interval(started_at, ended_at),
interval: %{"endTime" => DateTime.to_iso8601(ended_at)},
value: %{"doubleValue" => max}
}
]
Expand All @@ -399,7 +399,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporter do

# holding the value of the selected measurement from the most recent event
defp format_time_series(Metrics.LastValue, name, labels, resource, measurements, unit) do
{started_at, ended_at, last_value} = measurements
{_started_at, ended_at, last_value} = measurements

[
%{
Expand All @@ -413,7 +413,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporter do
valueType: "DOUBLE",
points: [
%{
interval: format_interval(started_at, ended_at),
interval: %{"endTime" => DateTime.to_iso8601(ended_at)},
value: %{"doubleValue" => last_value}
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporterTest do
},
"resource" => %{"type" => "test"},
"unit" => "request",
"metricKind" => "GAUGE",
"metricKind" => "CUMULATIVE",
"valueType" => "DOUBLE",
"points" => [
%{
Expand Down Expand Up @@ -353,8 +353,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporterTest do
"points" => [
%{
"interval" => %{
"endTime" => DateTime.to_iso8601(one_minute_ago),
"startTime" => DateTime.to_iso8601(two_minutes_ago)
"endTime" => DateTime.to_iso8601(one_minute_ago)
},
"value" => %{"doubleValue" => 5.5}
}
Expand All @@ -372,8 +371,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporterTest do
"points" => [
%{
"interval" => %{
"endTime" => DateTime.to_iso8601(one_minute_ago),
"startTime" => DateTime.to_iso8601(two_minutes_ago)
"endTime" => DateTime.to_iso8601(one_minute_ago)
},
"value" => %{"doubleValue" => 11.3}
}
Expand Down Expand Up @@ -449,8 +447,7 @@ defmodule Domain.Telemetry.GoogleCloudMetricsReporterTest do
"points" => [
%{
"interval" => %{
"endTime" => DateTime.to_iso8601(one_minute_ago),
"startTime" => DateTime.to_iso8601(two_minutes_ago)
"endTime" => DateTime.to_iso8601(one_minute_ago)
},
"value" => %{"doubleValue" => -1}
}
Expand Down

0 comments on commit b6763f1

Please sign in to comment.