Skip to content

Commit baa71d1

Browse files
djaglowskichengchuanpeng
authored andcommitted
[connector/routing] Mark MutatesData: true (open-telemetry#37390)
``` panic: invalid access to shared data goroutine 5496 [running]: go.opentelemetry.io/collector/pdata/internal.(*State).AssertMutable(...) /home/runner/go/pkg/mod/go.opentelemetry.io/collector/[email protected]/internal/state.go:20 go.opentelemetry.io/collector/pdata/plog.LogRecordSlice.RemoveIf({0x14000726040?, 0x1400249c000?}, 0x136e82da8?) /home/runner/go/pkg/mod/go.opentelemetry.io/collector/[email protected]/plog/generated_logrecordslice.go:108 +0x144 github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector/internal/plogutil.MoveRecordsWithContextIf({0x14001a8c000?, 0x1400249c000?}, {0x14001a8d080?, 0x1400249c014?}, 0x14001b2cd30) /home/runner/go/pkg/mod/github.com/open-telemetry/opentelemetry-collector-contrib/connector/[email protected]/internal/plogutil/logs.go:36 +0x14c github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector.(*logsConnector).switchLogs(0x14002aa56e0, {0x10a491cf8, 0x10f2917c0}, {0x14001a8c000?, 0x1400249c000?}) /home/runner/go/pkg/mod/github.com/open-telemetry/opentelemetry-collector-contrib/connector/[email protected]/logs.go:99 +0x1e0 github.com/open-telemetry/opentelemetry-collector-contrib/connector/routingconnector.(*logsConnector).ConsumeLogs(0x14001f78f20?, {0x10a491cf8?, 0x10f2917c0?}, {0x14001a8c000?, 0x1400249c000?}) ```
1 parent d59c853 commit baa71d1

File tree

7 files changed

+36
-9
lines changed

7 files changed

+36
-9
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'bug_fix'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: routingconnector
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: The connector splits the original payload so that it may be emitted in parts to each route.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [37390]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

connector/routingconnector/logs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func newLogsConnector(
6161
}
6262

6363
func (c *logsConnector) Capabilities() consumer.Capabilities {
64-
return consumer.Capabilities{MutatesData: false}
64+
return consumer.Capabilities{MutatesData: true}
6565
}
6666

6767
func (c *logsConnector) ConsumeLogs(ctx context.Context, ld plog.Logs) error {

connector/routingconnector/logs_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestLogsRegisterConsumersForValidRoute(t *testing.T) {
5454

5555
require.NoError(t, err)
5656
require.NotNil(t, conn)
57-
assert.False(t, conn.Capabilities().MutatesData)
57+
assert.True(t, conn.Capabilities().MutatesData)
5858

5959
rtConn := conn.(*logsConnector)
6060
require.NoError(t, err)
@@ -413,7 +413,7 @@ func TestLogsConnectorCapabilities(t *testing.T) {
413413
)
414414

415415
require.NoError(t, err)
416-
assert.False(t, conn.Capabilities().MutatesData)
416+
assert.True(t, conn.Capabilities().MutatesData)
417417
}
418418

419419
func TestLogsConnectorDetailed(t *testing.T) {

connector/routingconnector/metrics.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func newMetricsConnector(
6262
}
6363

6464
func (c *metricsConnector) Capabilities() consumer.Capabilities {
65-
return consumer.Capabilities{MutatesData: false}
65+
return consumer.Capabilities{MutatesData: true}
6666
}
6767

6868
func (c *metricsConnector) ConsumeMetrics(ctx context.Context, md pmetric.Metrics) error {

connector/routingconnector/metrics_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestMetricsRegisterConsumersForValidRoute(t *testing.T) {
5454

5555
require.NoError(t, err)
5656
require.NotNil(t, conn)
57-
assert.False(t, conn.Capabilities().MutatesData)
57+
assert.True(t, conn.Capabilities().MutatesData)
5858

5959
rtConn := conn.(*metricsConnector)
6060
require.NoError(t, err)
@@ -435,7 +435,7 @@ func TestMetricsConnectorCapabilities(t *testing.T) {
435435
)
436436

437437
require.NoError(t, err)
438-
assert.False(t, conn.Capabilities().MutatesData)
438+
assert.True(t, conn.Capabilities().MutatesData)
439439
}
440440

441441
func TestMetricsConnectorDetailed(t *testing.T) {

connector/routingconnector/traces.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func newTracesConnector(
6161
}
6262

6363
func (*tracesConnector) Capabilities() consumer.Capabilities {
64-
return consumer.Capabilities{MutatesData: false}
64+
return consumer.Capabilities{MutatesData: true}
6565
}
6666

6767
func (c *tracesConnector) ConsumeTraces(ctx context.Context, td ptrace.Traces) error {

connector/routingconnector/traces_test.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ func TestTracesRegisterConsumersForValidRoute(t *testing.T) {
5454

5555
require.NoError(t, err)
5656
require.NotNil(t, conn)
57-
assert.False(t, conn.Capabilities().MutatesData)
57+
assert.True(t, conn.Capabilities().MutatesData)
5858

5959
rtConn := conn.(*tracesConnector)
6060
require.NoError(t, err)
@@ -393,7 +393,7 @@ func TestTraceConnectorCapabilities(t *testing.T) {
393393
)
394394

395395
require.NoError(t, err)
396-
assert.False(t, conn.Capabilities().MutatesData)
396+
assert.True(t, conn.Capabilities().MutatesData)
397397
}
398398

399399
func TestTracesConnectorDetailed(t *testing.T) {

0 commit comments

Comments
 (0)