Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set spanmetricsprocessor call metric IsMonotonic to true #2837

Merged
merged 4 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion processor/spanmetricsprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ func (p *processorImp) collectCallMetrics(ilm *pdata.InstrumentationLibraryMetri

mCalls := pdata.NewMetric()
mCalls.SetDataType(pdata.MetricDataTypeIntSum)
mCalls.SetName("calls")
mCalls.SetName("calls_total")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may need to update the tests to reflect the new name.

mCalls.IntSum().SetIsMonotonic(true)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a test for this. I think it should be in verifyConsumeMetricsInput.

mCalls.IntSum().DataPoints().Append(dpCalls)
mCalls.IntSum().SetAggregationTemporality(pdata.AggregationTemporalityCumulative)
ilm.Metrics().Append(mCalls)
Expand Down
3 changes: 2 additions & 1 deletion processor/spanmetricsprocessor/processor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,11 @@ func verifyConsumeMetricsInput(input pdata.Metrics, t *testing.T) bool {
mi := 0
// The first 3 metrics are for call counts.
for ; mi < 3; mi++ {
assert.Equal(t, "calls", m.At(mi).Name())
assert.Equal(t, "calls_total", m.At(mi).Name())

data := m.At(mi).IntSum()
assert.Equal(t, pdata.AggregationTemporalityCumulative, data.AggregationTemporality())
assert.True(t, data.IsMonotonic())

dps := data.DataPoints()
require.Equal(t, 1, dps.Len())
Expand Down