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

Add ability to trigger a flush #32

Merged
merged 2 commits into from
Jun 27, 2023
Merged

Conversation

nickuraltsev
Copy link
Contributor

This PR adds the ability to flush buffered stats. It can be used in Lambda functions to flush all stats after each invocation, in a similar way to how the datadog-lambda-go library flushes all buffered traces.

The implementation is similar to how Flush is implemented in dd-trace-go.

Copy link
Contributor

@promiseofcake promiseofcake left a comment

Choose a reason for hiding this comment

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

Neat

@@ -239,6 +240,9 @@ func (a *aggregator) run(tick <-chan time.Time) {
a.addKafkaOffset(o)
case now := <-tick:
a.sendToAgent(a.flush(now))
case done := <-a.flushRequest:
a.sendToAgent(a.flush(time.Now().Add(bucketDuration * 10)))
done <- struct{}{}
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: can you close done here instead of sending a payload?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated, thank you!

@piochelepiotr piochelepiotr merged commit 7185000 into DataDog:main Jun 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants