Skip to content

Commit

Permalink
implement suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
garoazinha committed Jan 16, 2025
1 parent 46a5505 commit c02ec91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions metrics_sdk/lib/opentelemetry/sdk/metrics/aggregation/sum.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ def collect(start_time, end_time, data_points)
end

def update(increment, attributes, data_points)
return if @is_monotonic && increment < 0

ndp = data_points[attributes] || data_points[attributes] = NumberDataPoint.new(
attributes,
nil,
Expand All @@ -48,8 +50,6 @@ def update(increment, attributes, data_points)
nil
)

return if is_monotonic && increment < 0

ndp.value += increment
nil
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def update(value, attributes)

def aggregate_metric_data(start_time, end_time, aggregation: nil)
aggregator = aggregation || @default_aggregation
is_monotonic = aggregator.respond_to?(:is_monotonic) && aggregator.is_monotonic
is_monotonic = aggregator.respond_to?(:is_monotonic) ? aggregator.is_monotonic : nil

MetricData.new(
@name,
Expand Down

0 comments on commit c02ec91

Please sign in to comment.