Skip to content

Commit

Permalink
[mdatagen] Fix bug where Histograms were marked as not supporting tem…
Browse files Browse the repository at this point in the history
…poraly aggregation

Signed-off-by: Bogdan Drutu <[email protected]>
  • Loading branch information
bogdandrutu committed Jan 23, 2025
1 parent 6a546b2 commit ccbb869
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions .chloggen/fix-bug-histogram-aggregation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver)
component: mdatagen

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fix bug where Histograms were marked as not supporting temporaly aggregation

# One or more tracking issues or pull requests related to the change
issues: [12168]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [api, user]
2 changes: 1 addition & 1 deletion cmd/mdatagen/internal/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ func (d *Histogram) HasMonotonic() bool {
}

func (d *Histogram) HasAggregated() bool {
return false
return true
}

func (d *Histogram) Instrument() string {
Expand Down
2 changes: 1 addition & 1 deletion cmd/mdatagen/internal/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func TestMetricData(t *testing.T) {
{&Sum{Async: true}, "Sum", true, true, "ObservableUpDownCounter", true},
{&Sum{MetricValueType: MetricValueType{pmetric.NumberDataPointValueTypeInt}, Async: true}, "Sum", true, true, "Int64ObservableUpDownCounter", true},
{&Sum{MetricValueType: MetricValueType{pmetric.NumberDataPointValueTypeDouble}, Async: true}, "Sum", true, true, "Float64ObservableUpDownCounter", true},
{&Histogram{}, "Histogram", false, false, "Histogram", false},
{&Histogram{}, "Histogram", true, false, "Histogram", false},
} {
assert.Equal(t, arg.wantType, arg.metricData.Type())
assert.Equal(t, arg.wantHasAggregated, arg.metricData.HasAggregated())
Expand Down

0 comments on commit ccbb869

Please sign in to comment.