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

pkg/trace/api: limit simultaneous otlp requests, do not drop payloads #23085

Merged
merged 6 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions comp/otelcol/otlp/map_provider_config_not_serverless.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ exporters:
tls:
insecure: true
compression: none
sending_queue:
enabled: false

service:
telemetry:
Expand Down
36 changes: 36 additions & 0 deletions comp/otelcol/otlp/map_provider_not_serverless_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
},
"service": map[string]interface{}{
Expand Down Expand Up @@ -111,6 +114,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -184,6 +190,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -244,6 +253,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
},
"service": map[string]interface{}{
Expand Down Expand Up @@ -345,6 +357,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"logging": map[string]interface{}{
"loglevel": "info",
Expand Down Expand Up @@ -465,6 +480,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -525,6 +543,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"logsagent": interface{}(nil),
},
Expand Down Expand Up @@ -593,6 +614,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -673,6 +697,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -745,6 +772,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"logsagent": interface{}(nil),
},
Expand Down Expand Up @@ -865,6 +895,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"logging": map[string]interface{}{
"loglevel": "info",
Expand Down Expand Up @@ -999,6 +1032,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down
18 changes: 18 additions & 0 deletions comp/otelcol/otlp/map_provider_serverless_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
},
"service": map[string]interface{}{
Expand Down Expand Up @@ -102,6 +105,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -169,6 +175,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down Expand Up @@ -228,6 +237,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
},
"service": map[string]interface{}{
Expand Down Expand Up @@ -323,6 +335,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"logging": map[string]interface{}{
"loglevel": "info",
Expand Down Expand Up @@ -432,6 +447,9 @@ func TestNewMap(t *testing.T) {
},
"compression": "none",
"endpoint": "localhost:5003",
"sending_queue": map[string]interface{}{
"enabled": false,
},
},
"serializer": map[string]interface{}{
"metrics": map[string]interface{}{
Expand Down
13 changes: 6 additions & 7 deletions pkg/trace/api/otlp.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,10 @@ func (o *OTLPReceiver) Start() {
if err != nil {
log.Criticalf("Error starting OpenTelemetry gRPC server: %v", err)
} else {
o.grpcsrv = grpc.NewServer(grpc.MaxRecvMsgSize(10 * 1024 * 1024))
o.grpcsrv = grpc.NewServer(
grpc.MaxRecvMsgSize(10*1024*1024),
grpc.MaxConcurrentStreams(1), // Each payload must be sent to processing stage before we decode the next.
)
ptraceotlp.RegisterGRPCServer(o.grpcsrv, o)
o.wg.Add(1)
go func() {
Expand Down Expand Up @@ -307,12 +310,8 @@ func (o *OTLPReceiver) ReceiveResourceSpans(ctx context.Context, rspans ptrace.R
tagContainersTags: payloadTags.String(),
}
}
select {
case o.out <- &p:
// success
default:
log.Warn("Payload in channel full. Dropped 1 payload.")
}

o.out <- &p
return src
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Each section from every release note are combined when the
# CHANGELOG.rst is rendered. So the text needs to be worded so that
# it does not depend on any information only available in another
# section. This may mean repeating some details, but each section
# must be readable independently of the other.
#
# Each section note must be formatted as reStructuredText.
---
fixes:
- |
APM: Stop dropping incoming otel payloads when the processing channel is full
and eliminate OOM issues in the trace agent and collector component in high
load scenarios, making the OTel pipeline more reliable.
dineshg13 marked this conversation as resolved.
Show resolved Hide resolved
Loading