Skip to content

Commit

Permalink
[SVLS-5268] Disable flush ticker for AWS Lambda (#28601)
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanLovesCoffee authored Aug 21, 2024
1 parent 19f4609 commit 381e420
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion comp/logs/agent/agentimpl/agent_serverless_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,13 @@ func (a *logAgent) SetupPipeline(

// buildEndpoints builds endpoints for the logs agent
func buildEndpoints(coreConfig pkgConfig.Reader) (*config.Endpoints, error) {
return config.BuildServerlessEndpoints(coreConfig, intakeTrackType, config.DefaultIntakeProtocol)
config, err := config.BuildServerlessEndpoints(coreConfig, intakeTrackType, config.DefaultIntakeProtocol)
if err != nil {
return nil, err
}
if pkgConfig.IsServerless() {
// in AWS Lambda, we never want the batch strategy to flush with a tick
config.BatchWait = 365 * 24 * time.Hour
}
return config, nil
}
2 changes: 2 additions & 0 deletions comp/logs/agent/agentimpl/agent_serverless_init_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ package agentimpl

import (
"testing"
"time"

"github.com/stretchr/testify/assert"
"go.uber.org/fx"
Expand All @@ -26,4 +27,5 @@ func TestBuildServerlessEndpoints(t *testing.T) {
assert.Nil(t, err)
assert.Equal(t, "http-intake.logs.datadoghq.com", endpoints.Main.Host)
assert.Equal(t, "lambda-extension", string(endpoints.Main.Origin))
assert.True(t, endpoints.Main.BatchWait > config.BatchWait*time.Second)
}

0 comments on commit 381e420

Please sign in to comment.