Repository navigation
feat(logs): Track accepted bytes per individual log item - #4886
Merged
Merged
Conversation
Dav1dde
force-pushed
the
dav1d/count-bytes-logs
branch
from
July 1, 2025 14:00
166184c to
fc8399d
Compare
Dav1dde
force-pushed
the
dav1d/count-bytes-logs
branch
from
July 1, 2025 14:06
fc8399d to
9f98a14
Compare
loewenheim
reviewed
Jul 1, 2025
loewenheim
approved these changes
Jul 2, 2025
k-fish
reviewed
Jul 2, 2025
Comment on lines
+264
to
+298
| r#"{ | ||
| "timestamp": 946684800.0, | ||
| "trace_id": "5b8efff798038103d269b633813fc60c", | ||
| "level": "warn", | ||
| "body": "7 bytes", | ||
| "some other": "fields that do not exist", | ||
| "attributes": { | ||
| "k1": { | ||
| "value": "string value", | ||
| "type": "string" | ||
| }, | ||
| "k2": { | ||
| "value": 18446744073709551615, | ||
| "type": "integer" | ||
| }, | ||
| "k3": { | ||
| "value": 42.01234567891234567899, | ||
| "type": "double" | ||
| }, | ||
| "k4": { | ||
| "value": false, | ||
| "type": "boolean" | ||
| }, | ||
| "k5": { | ||
| "value": { | ||
| "nested": { | ||
| "array": [1.0, 2, -12, "7 bytes", false] | ||
| } | ||
| }, | ||
| "type": "not yet supported" | ||
| } | ||
| } | ||
| }"# | ||
| ); | ||
| } |
Member
There was a problem hiding this comment.
With sizing you've written it looks like we will be calculating this as 89 bytes.
I want to point out that naively saving this in a file with whitespace, "raw", is 647 bytes. If you trim whitespace etc. this would still be at least 300-400 bytes.
Contributor
There was a problem hiding this comment.
Are you saying that the size calculation is too far off from the actual number of bytes that are sent?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calculates the ingested bytes when deserializing individual log items, materializes it on the log and uses it for all outcomes which are to be emitted.
There are quite a bit of follow ups related to this:
See the tracking issue #4824 for details on the chosen algorithm to calculate the ingested bytes.
Additionally, this PR does implement proper counting for any data structure sent as an attribute value, this includes mixed arrays and objects. Relay will drop these attributes later on as they are not yet supported. This is generally the theme, Relay counts before making any modifications. That could be because of size limits, PII, inconsistencies etc.
This is inline with the approach we wanted to take with counting received bytes. In practice this should not be a large issue, as people are inclined to only send valid data, as the invalid data would not make it to the product and SDKs are safeguarding against invalid usage as well.
Closes: RELAY-111
Closes: #4824