Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
71759f1
Adding the query and tracking of stored procedures to events
cjksplunk Nov 24, 2025
5498a7a
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Nov 24, 2025
97aab1a
Merge branch 'open-telemetry:main' into add-stored-procedure-columns-…
cjksplunk Nov 24, 2025
3b5ca90
Fixed missing process id
cjksplunk Nov 24, 2025
a8ffaef
Removing stored procedure type
cjksplunk Nov 25, 2025
0821ddf
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Nov 26, 2025
0e85536
Added changelog entry
cjksplunk Nov 26, 2025
c155be3
Added changelog entry
cjksplunk Nov 26, 2025
c1d747c
reverted changelog entry
cjksplunk Nov 26, 2025
f5a90a2
fix changelog entry
cjksplunk Nov 26, 2025
0bc4785
updates to variable naming and usage
cjksplunk Nov 26, 2025
f4eea59
updates to variable naming and usage
cjksplunk Nov 26, 2025
81d191f
updates to variable naming and usage
cjksplunk Nov 26, 2025
8a2b5ed
ran make generate
cjksplunk Nov 27, 2025
f504f37
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Nov 27, 2025
8024074
Moved QuerySampleCount and TopQueryCount ot of params and reference c…
cjksplunk Nov 27, 2025
0890020
Added issue to changelog
cjksplunk Dec 1, 2025
0bf933d
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Dec 2, 2025
fb96860
Replaced values with vars
cjksplunk Dec 2, 2025
c5d313a
Integrating stored procedure values for samples
cjksplunk Dec 2, 2025
28fa28f
updates to test data
cjksplunk Dec 2, 2025
b3c7078
Merge branch 'postgres-stored-procedure-stats' into add-stored-proced…
cjksplunk Dec 2, 2025
c8efaec
Backout unintended merge
cjksplunk Dec 2, 2025
1b76557
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Dec 2, 2025
9bc1b70
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Dec 16, 2025
a58a5c9
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Dec 16, 2025
26101d3
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Dec 17, 2025
7ba3c74
updating change log
cjksplunk Dec 17, 2025
f9531c3
Fix for inaccurate query count being reported in postgresql query met…
sv-splunk Jan 5, 2026
42432a7
change log
sv-splunk Jan 5, 2026
a06028f
this fix is for sqlserver
sv-splunk Jan 5, 2026
98e2e15
fill issue details
sv-splunk Jan 5, 2026
ca3a16a
go generate
sv-splunk Jan 6, 2026
e521c6f
fix lint
sv-splunk Jan 6, 2026
e7cf472
Merge branch 'main' into postgresql_fix_for_inaccurate_query_executio…
sv-splunk Jan 6, 2026
68893f7
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 6, 2026
3cf3d01
make gogci
sv-splunk Jan 6, 2026
58f51c5
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 6, 2026
20de936
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 7, 2026
9df4eb6
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 7, 2026
87935cd
tweak to samples sql
cjksplunk Jan 7, 2026
9433fdf
Revert checks around sending metrics for countInDb=1, since it's addr…
sv-splunk Jan 7, 2026
a2d7baf
Merge branch 'main' into postgresql_fix_for_inaccurate_query_executio…
sv-splunk Jan 8, 2026
7d1720c
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 8, 2026
132a147
Merge branch 'main' into postgresql_fix_for_inaccurate_query_executio…
sv-splunk Jan 8, 2026
4db323b
Updates in prep for testing
cjksplunk Jan 8, 2026
cf85aa1
Merge branch 'postgresql_fix_for_inaccurate_query_execution_count' in…
cjksplunk Jan 8, 2026
bb78240
fix lint
sv-splunk Jan 8, 2026
b47bd3e
cleanup
sv-splunk Jan 8, 2026
d051411
Fix invalid casting and update old test
sv-splunk Jan 9, 2026
e32d34c
Updating topN query to use HAVING instead of external WHERE clause
sv-splunk Jan 9, 2026
4795057
Merge branch 'main' into sqlserver_fix_for_inaccurate_query_execution…
sv-splunk Jan 9, 2026
0a6c22a
Merge branch 'sqlserver_fix_for_inaccurate_query_execution_count' int…
cjksplunk Jan 9, 2026
d6923c3
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 12, 2026
c36abac
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 15, 2026
53e83a2
Query Tuning
cjksplunk Jan 15, 2026
f521b20
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 16, 2026
cfaa9ea
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 20, 2026
45b2173
Adding '''WHERE st.text IS NOT NULL; ''' to topx and samples queries
cjksplunk Jan 20, 2026
ad0c684
Merge branch 'open-telemetry:main' into add-stored-procedure-columns-…
cjksplunk Jan 21, 2026
e52062a
Backed out changes to samples query
cjksplunk Jan 21, 2026
088a342
Adding documentation for default samples count
cjksplunk Jan 22, 2026
135c988
Revert "Add stored procedure columns to events (#1)"
cjksplunk Jan 22, 2026
0712589
Reapply "Add stored procedure columns to events (#1)"
cjksplunk Jan 22, 2026
5b5f5e8
Merge branch 'open-telemetry:main' into add-stored-procedure-columns-…
cjksplunk Jan 22, 2026
1299b7e
Merge branch 'main' into add-stored-procedure-columns-to-events
cjksplunk Jan 22, 2026
5b3bf23
removing not null from samples again
cjksplunk Jan 22, 2026
d71a5a0
[chore][processor/resourcedetection] Add E2E tests for upcloud detect…
paulojmdias Jan 22, 2026
b44a544
[chore][processor/resourcedetection] Add E2E tests for vultr detector…
paulojmdias Jan 22, 2026
715f827
[chore][processor/resourcedetection] Add E2E tests for ec2 detector (…
paulojmdias Jan 22, 2026
fd71490
[chore][processor/resourcedetection] Add E2E tests for scaleway detec…
paulojmdias Jan 22, 2026
8a0e243
[chore][processor/resourcedetection] Add E2E tests for azure detector…
paulojmdias Jan 23, 2026
ea79aa4
Update Move functions in routing connector to not use pointer. (#45563)
vengalraoguttha Jan 23, 2026
216e339
[receiver/filelog] Suppress repeated permission denied errors (#44350)
khpeet Jan 23, 2026
18e7362
[pkg/stanza/trim] Improve performance of Trailing and Leading (#45281)
constanca-m Jan 23, 2026
84c53d0
[ci] Ensure github token is available for github cli (#45602)
paulojmdias Jan 23, 2026
a14bac8
Merge branch 'upstream-main' into add-stored-procedure-columns-to-events
cjksplunk Jan 23, 2026
961984b
Updating documentation
cjksplunk Jan 23, 2026
dc103f1
Merge branch 'upstream-main'
cjksplunk Jan 23, 2026
ebe0a15
Merge branch 'main' into add-stored-procedure-columns-to-events
cjksplunk Jan 23, 2026
925178b
Merge remote-tracking branch 'origin/main'
cjksplunk Jan 23, 2026
bb200b3
Merge branch 'main' into add-stored-procedure-columns-to-events
cjksplunk Jan 23, 2026
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
2 changes: 1 addition & 1 deletion .chloggen/add-stored-procedure-columns-to-events.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ issues: [44656]
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext: Refined query and reported events to include stored procedure information when applicable.
Expanded default samples count from 200 to 250 to account for teh addition of stored procedure events.
Additionally, the maximum number of active queries reported by default has been increased from 200 to 250 to account for record deaggregation introduced by this change, ensuring the effective limit remains consistent with the previous 200-query baseline.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
Expand Down
29 changes: 29 additions & 0 deletions .chloggen/issue-39491.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Suppress repeated permission-denied errors

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [39491]

# (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: |
Only one error is logged per file per process run, and an informational message is emitted when the file becomes readable again.
This reduces log spam and improves clarity for operators.

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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: [user]
27 changes: 27 additions & 0 deletions .chloggen/vengal-reduce-allocs-in-routing-connector.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

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

# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
component: connector/routing

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Update existing util functions to reduce allocs.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [45061]

# (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:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# 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]
12 changes: 7 additions & 5 deletions .github/workflows/update-otel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ jobs:
with:
path: opentelemetry-collector
repository: open-telemetry/opentelemetry-collector
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
- name: Prepare to update dependencies
run: |
exec > >(tee log.out) 2>&1
Expand All @@ -40,6 +45,8 @@ jobs:
echo "LAST_COMMIT=$LAST_COMMIT"
echo "BRANCH_NAME=$branch"
} >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ steps.otelbot-token.outputs.token }}
- name: Gets packages from links with retries
uses: nick-fields/retry@ce71cc2ab81d554ebbe88c79ab5975992d79ba08 # v3.0.2
with:
Expand All @@ -51,11 +58,6 @@ jobs:
exec > >(tee -a log.out) 2>&1
cd opentelemetry-collector-contrib
make update-otel OTEL_STABLE_VERSION=${{ env.LAST_COMMIT }} OTEL_VERSION=${{ env.LAST_COMMIT }}
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
id: otelbot-token
with:
app-id: ${{ vars.OTELBOT_APP_ID }}
private-key: ${{ secrets.OTELBOT_PRIVATE_KEY }}
- name: Push and create PR
run: |
exec > >(tee -a log.out) 2>&1
Expand Down
23 changes: 23 additions & 0 deletions connector/routingconnector/internal/pdatautil/utils.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

package pdatautil // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector/internal/pdatautil"

// OnceValue to set a given value only once.
type OnceValue[K any] struct {
val K
isInit bool
}

func (ov *OnceValue[K]) IsInit() bool {
return ov.isInit
}

func (ov *OnceValue[K]) Init(val K) {
ov.isInit = true
ov.val = val
}

func (ov *OnceValue[K]) Value() K {
return ov.val
}
26 changes: 13 additions & 13 deletions connector/routingconnector/internal/plogutil/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ package plogutil // import "github.com/open-telemetry/opentelemetry-collector-co

import (
"go.opentelemetry.io/collector/pdata/plog"

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector/internal/pdatautil"
)

// MoveResourcesIf calls f sequentially for each ResourceLogs present in the first plog.Logs.
Expand All @@ -27,27 +29,25 @@ func MoveRecordsWithContextIf(from, to plog.Logs, f func(plog.ResourceLogs, plog
rls := from.ResourceLogs()
rls.RemoveIf(func(rl plog.ResourceLogs) bool {
sls := rl.ScopeLogs()
var rlCopy *plog.ResourceLogs
var rlCopy pdatautil.OnceValue[plog.ResourceLogs]
sls.RemoveIf(func(sl plog.ScopeLogs) bool {
lrs := sl.LogRecords()
var slCopy *plog.ScopeLogs
var slCopy pdatautil.OnceValue[plog.ScopeLogs]
lrs.RemoveIf(func(lr plog.LogRecord) bool {
if !f(rl, sl, lr) {
return false
}
if rlCopy == nil {
rlc := to.ResourceLogs().AppendEmpty()
rlCopy = &rlc
rl.Resource().CopyTo(rlCopy.Resource())
rlCopy.SetSchemaUrl(rl.SchemaUrl())
if !rlCopy.IsInit() {
rlCopy.Init(to.ResourceLogs().AppendEmpty())
rl.Resource().CopyTo(rlCopy.Value().Resource())
rlCopy.Value().SetSchemaUrl(rl.SchemaUrl())
}
if slCopy == nil {
slc := rlCopy.ScopeLogs().AppendEmpty()
slCopy = &slc
sl.Scope().CopyTo(slCopy.Scope())
slCopy.SetSchemaUrl(sl.SchemaUrl())
if !slCopy.IsInit() {
slCopy.Init(rlCopy.Value().ScopeLogs().AppendEmpty())
sl.Scope().CopyTo(slCopy.Value().Scope())
slCopy.Value().SetSchemaUrl(sl.SchemaUrl())
}
lr.MoveTo(slCopy.LogRecords().AppendEmpty())
lr.MoveTo(slCopy.Value().LogRecords().AppendEmpty())
return true
})
return sl.LogRecords().Len() == 0
Expand Down
120 changes: 62 additions & 58 deletions connector/routingconnector/internal/pmetricutil/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@

package pmetricutil // import "github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector/internal/pmetricutil"

import "go.opentelemetry.io/collector/pdata/pmetric"
import (
"go.opentelemetry.io/collector/pdata/pmetric"

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector/internal/pdatautil"
)

// MoveResourcesIf calls f sequentially for each ResourceSpans present in the first pmetric.Metrics.
// If f returns true, the element is removed from the first pmetric.Metrics and added to the second pmetric.Metrics.
Expand All @@ -25,21 +29,21 @@ func MoveMetricsWithContextIf(from, to pmetric.Metrics, f func(pmetric.ResourceM
rms := from.ResourceMetrics()
rms.RemoveIf(func(rm pmetric.ResourceMetrics) bool {
sms := rm.ScopeMetrics()
var rmCopy *pmetric.ResourceMetrics
var rmCopy pdatautil.OnceValue[pmetric.ResourceMetrics]
sms.RemoveIf(func(sm pmetric.ScopeMetrics) bool {
ms := sm.Metrics()
var smCopy *pmetric.ScopeMetrics
var smCopy pdatautil.OnceValue[pmetric.ScopeMetrics]
ms.RemoveIf(func(m pmetric.Metric) bool {
if !f(rm, sm, m) {
return false
}
if rmCopy == nil {
rmCopy = copyResourceMetrics(rm, to.ResourceMetrics())
if !rmCopy.IsInit() {
rmCopy.Init(copyResourceMetrics(rm, to.ResourceMetrics()))
}
if smCopy == nil {
smCopy = copyScopeMetrics(sm, rmCopy.ScopeMetrics())
if !smCopy.IsInit() {
smCopy.Init(copyScopeMetrics(sm, rmCopy.Value().ScopeMetrics()))
}
m.MoveTo(smCopy.Metrics().AppendEmpty())
m.MoveTo(smCopy.Value().Metrics().AppendEmpty())
return true
})
return sm.Metrics().Len() == 0
Expand All @@ -56,12 +60,12 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
rms := from.ResourceMetrics()
rms.RemoveIf(func(rm pmetric.ResourceMetrics) bool {
sms := rm.ScopeMetrics()
var rmCopy *pmetric.ResourceMetrics
var rmCopy pdatautil.OnceValue[pmetric.ResourceMetrics]
sms.RemoveIf(func(sm pmetric.ScopeMetrics) bool {
ms := sm.Metrics()
var smCopy *pmetric.ScopeMetrics
var smCopy pdatautil.OnceValue[pmetric.ScopeMetrics]
ms.RemoveIf(func(m pmetric.Metric) bool {
var mCopy *pmetric.Metric
var mCopy pdatautil.OnceValue[pmetric.Metric]

// TODO condense this code
switch m.Type() {
Expand All @@ -71,17 +75,17 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
if !f(rm, sm, m, dp) {
return false
}
if rmCopy == nil {
rmCopy = copyResourceMetrics(rm, to.ResourceMetrics())
if !rmCopy.IsInit() {
rmCopy.Init(copyResourceMetrics(rm, to.ResourceMetrics()))
}
if smCopy == nil {
smCopy = copyScopeMetrics(sm, rmCopy.ScopeMetrics())
if !smCopy.IsInit() {
smCopy.Init(copyScopeMetrics(sm, rmCopy.Value().ScopeMetrics()))
}
if mCopy == nil {
mCopy = copyMetricDescription(m, smCopy.Metrics())
mCopy.SetEmptyGauge()
if !mCopy.IsInit() {
mCopy.Init(copyMetricDescription(m, smCopy.Value().Metrics()))
mCopy.Value().SetEmptyGauge()
}
dp.MoveTo(mCopy.Gauge().DataPoints().AppendEmpty())
dp.MoveTo(mCopy.Value().Gauge().DataPoints().AppendEmpty())
return true
})
return dps.Len() == 0
Expand All @@ -91,18 +95,18 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
if !f(rm, sm, m, dp) {
return false
}
if rmCopy == nil {
rmCopy = copyResourceMetrics(rm, to.ResourceMetrics())
if !rmCopy.IsInit() {
rmCopy.Init(copyResourceMetrics(rm, to.ResourceMetrics()))
}
if smCopy == nil {
smCopy = copyScopeMetrics(sm, rmCopy.ScopeMetrics())
if !smCopy.IsInit() {
smCopy.Init(copyScopeMetrics(sm, rmCopy.Value().ScopeMetrics()))
}
if mCopy == nil {
mCopy = copyMetricDescription(m, smCopy.Metrics())
mCopy.SetEmptySum().SetAggregationTemporality(m.Sum().AggregationTemporality())
mCopy.Sum().SetIsMonotonic(m.Sum().IsMonotonic())
if !mCopy.IsInit() {
mCopy.Init(copyMetricDescription(m, smCopy.Value().Metrics()))
mCopy.Value().SetEmptySum().SetAggregationTemporality(m.Sum().AggregationTemporality())
mCopy.Value().Sum().SetIsMonotonic(m.Sum().IsMonotonic())
}
dp.MoveTo(mCopy.Sum().DataPoints().AppendEmpty())
dp.MoveTo(mCopy.Value().Sum().DataPoints().AppendEmpty())
return true
})
return dps.Len() == 0
Expand All @@ -112,17 +116,17 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
if !f(rm, sm, m, dp) {
return false
}
if rmCopy == nil {
rmCopy = copyResourceMetrics(rm, to.ResourceMetrics())
if !rmCopy.IsInit() {
rmCopy.Init(copyResourceMetrics(rm, to.ResourceMetrics()))
}
if smCopy == nil {
smCopy = copyScopeMetrics(sm, rmCopy.ScopeMetrics())
if !smCopy.IsInit() {
smCopy.Init(copyScopeMetrics(sm, rmCopy.Value().ScopeMetrics()))
}
if mCopy == nil {
mCopy = copyMetricDescription(m, smCopy.Metrics())
mCopy.SetEmptyHistogram().SetAggregationTemporality(m.Histogram().AggregationTemporality())
if !mCopy.IsInit() {
mCopy.Init(copyMetricDescription(m, smCopy.Value().Metrics()))
mCopy.Value().SetEmptyHistogram().SetAggregationTemporality(m.Histogram().AggregationTemporality())
}
dp.MoveTo(mCopy.Histogram().DataPoints().AppendEmpty())
dp.MoveTo(mCopy.Value().Histogram().DataPoints().AppendEmpty())
return true
})
return dps.Len() == 0
Expand All @@ -132,17 +136,17 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
if !f(rm, sm, m, dp) {
return false
}
if rmCopy == nil {
rmCopy = copyResourceMetrics(rm, to.ResourceMetrics())
if !rmCopy.IsInit() {
rmCopy.Init(copyResourceMetrics(rm, to.ResourceMetrics()))
}
if smCopy == nil {
smCopy = copyScopeMetrics(sm, rmCopy.ScopeMetrics())
if !smCopy.IsInit() {
smCopy.Init(copyScopeMetrics(sm, rmCopy.Value().ScopeMetrics()))
}
if mCopy == nil {
mCopy = copyMetricDescription(m, smCopy.Metrics())
mCopy.SetEmptyExponentialHistogram().SetAggregationTemporality(m.ExponentialHistogram().AggregationTemporality())
if !mCopy.IsInit() {
mCopy.Init(copyMetricDescription(m, smCopy.Value().Metrics()))
mCopy.Value().SetEmptyExponentialHistogram().SetAggregationTemporality(m.ExponentialHistogram().AggregationTemporality())
}
dp.MoveTo(mCopy.ExponentialHistogram().DataPoints().AppendEmpty())
dp.MoveTo(mCopy.Value().ExponentialHistogram().DataPoints().AppendEmpty())
return true
})
return dps.Len() == 0
Expand All @@ -152,17 +156,17 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
if !f(rm, sm, m, dp) {
return false
}
if rmCopy == nil {
rmCopy = copyResourceMetrics(rm, to.ResourceMetrics())
if !rmCopy.IsInit() {
rmCopy.Init(copyResourceMetrics(rm, to.ResourceMetrics()))
}
if smCopy == nil {
smCopy = copyScopeMetrics(sm, rmCopy.ScopeMetrics())
if !smCopy.IsInit() {
smCopy.Init(copyScopeMetrics(sm, rmCopy.Value().ScopeMetrics()))
}
if mCopy == nil {
mCopy = copyMetricDescription(m, smCopy.Metrics())
mCopy.SetEmptySummary()
if !mCopy.IsInit() {
mCopy.Init(copyMetricDescription(m, smCopy.Value().Metrics()))
mCopy.Value().SetEmptySummary()
}
dp.MoveTo(mCopy.Summary().DataPoints().AppendEmpty())
dp.MoveTo(mCopy.Value().Summary().DataPoints().AppendEmpty())
return true
})
return dps.Len() == 0
Expand All @@ -176,24 +180,24 @@ func MoveDataPointsWithContextIf(from, to pmetric.Metrics, f func(pmetric.Resour
})
}

func copyResourceMetrics(from pmetric.ResourceMetrics, to pmetric.ResourceMetricsSlice) *pmetric.ResourceMetrics {
func copyResourceMetrics(from pmetric.ResourceMetrics, to pmetric.ResourceMetricsSlice) pmetric.ResourceMetrics {
rmc := to.AppendEmpty()
from.Resource().CopyTo(rmc.Resource())
rmc.SetSchemaUrl(from.SchemaUrl())
return &rmc
return rmc
}

func copyScopeMetrics(from pmetric.ScopeMetrics, to pmetric.ScopeMetricsSlice) *pmetric.ScopeMetrics {
func copyScopeMetrics(from pmetric.ScopeMetrics, to pmetric.ScopeMetricsSlice) pmetric.ScopeMetrics {
smc := to.AppendEmpty()
from.Scope().CopyTo(smc.Scope())
smc.SetSchemaUrl(from.SchemaUrl())
return &smc
return smc
}

func copyMetricDescription(from pmetric.Metric, to pmetric.MetricSlice) *pmetric.Metric {
func copyMetricDescription(from pmetric.Metric, to pmetric.MetricSlice) pmetric.Metric {
mc := to.AppendEmpty()
mc.SetName(from.Name())
mc.SetDescription(from.Description())
mc.SetUnit(from.Unit())
return &mc
return mc
}
Loading
Loading