-
Notifications
You must be signed in to change notification settings - Fork 377
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
[SDTEST-409] Send telemetry events in batches #3749
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3749 +/- ##
=======================================
Coverage 98.11% 98.11%
=======================================
Files 1235 1235
Lines 73749 73788 +39
Branches 3560 3562 +2
=======================================
+ Hits 72357 72398 +41
+ Misses 1392 1390 -2 ☔ View full report in Codecov by Sentry. |
lib/datadog/core/telemetry/event.rb
Outdated
@events.map do |event| | ||
{ | ||
request_type: event.type, | ||
payload: event.payload(seq_id), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK that seq id is the same for all of the events?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great question, I need to look it up in the spec.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The spec says nothing about it and also it does not mention that seq_id
should be part of telemetry events payloads at all (it is supposed to be part of common headers)! I will investigate why our payload generation code even depends on seq_id...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found where this seq_id is defined in specs: https://github.com/DataDog/instrumentation-telemetry-api-docs/blob/main/GeneratedDocumentation/ApiDocs/v2/SchemaDocumentation/Schemas/conf_key_value.md
This field should incremented each time a new configuration key-value pair is applied in order to track the > active set of configurations. It can be a global value across all configurations keys or local to each key..
This seq_id is in fact different from the seq_id that is used for events:
https://github.com/DataDog/instrumentation-telemetry-api-docs/blob/main/GeneratedDocumentation/ApiDocs/v2/development.md#required-top-level-json-keys
Counter that should be auto incremented every time an API call is being made (our pipeline may not always work in a sequential order.This field will help us identify situations where some messages were being lost. seq_id should start at 1 so that the go backend can detect between non set fields.
I will see how to decouple them from each other in our implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solved this by introducing another sequence in Core::Telemetry::Event class for the configuration changes
What does this PR do?
Optimises telemetry events sending by sending them in batches using
message-batch
event type.Motivation:
I expect the number of telemetry events to grow as soon as products start using metrics. We can save time by batching the list of events into a single event.
How to test the change?
System tests pass for telemetry events.
Logs from rails app with DD_TRACE_DEBUG=1: