-
Notifications
You must be signed in to change notification settings - Fork 13
chore: normalize duration so we don't fail parsing spans into protobuf #998
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
d072de2
feat: debug
astuyve 6dacb06
debug
astuyve d6c4ca9
errrrr
astuyve d4b5d43
dump bytes to string and see if we can debug
astuyve 2d5839e
use rmpv
astuyve f4afb83
v4span debug
astuyve 8780c44
test: guard against negative durations overflow
astuyve 47596f2
fix: also start
astuyve 2a58a0f
fix: match the error to handle the int decoding
astuyve 0f19d84
show error but use 0
astuyve 0b6d9b4
feat: add tracing crate to debug pb issues
astuyve fb0fbf5
clippy
astuyve 501fd27
fix: Move serializers to crate. Extract span attributes so we can use…
astuyve 163c253
feat: remove tracing crate, actually add serializers file
astuyve 93aad6a
feat: clippy/fmt
astuyve dbc9351
license
astuyve cd1529d
Merge branch 'main' into aj/span-links-v05-string-compression-fix
astuyve 5ee309d
fix: still add default for other span fields
astuyve 8085e0a
fix: uppercase ID to make span/trace/parentID work
astuyve 2793895
Merge branch 'main' into aj/span-links-v05-string-compression-fix
astuyve File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
pub mod pb; | ||
pub mod remoteconfig; | ||
mod serde; | ||
mod serializers; | ||
|
||
#[cfg(test)] | ||
mod pb_test; |
This file contains 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
This file contains 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
This file contains 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2023-Present Datadog, Inc. https://www.datadoghq.com/ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
use serde::{Deserialize, Deserializer}; | ||
|
||
pub fn deserialize_null_into_default<'de, D, T>(deserializer: D) -> Result<T, D::Error> | ||
where | ||
T: Default + Deserialize<'de>, | ||
D: Deserializer<'de>, | ||
{ | ||
let opt = Option::deserialize(deserializer)?; | ||
Ok(opt.unwrap_or_default()) | ||
} | ||
|
||
pub fn is_default<T: Default + PartialEq>(t: &T) -> bool { | ||
t == &T::default() | ||
} | ||
|
||
pub fn deserialize_duration<'de, D>(deserializer: D) -> Result<i64, D::Error> | ||
where | ||
D: Deserializer<'de>, | ||
{ | ||
let value: Result<i64, D::Error> = Deserialize::deserialize(deserializer); | ||
match value { | ||
Ok(v) => { | ||
if v < 0 { | ||
return Ok(0); | ||
} | ||
Ok(v) | ||
} | ||
Err(_) => Ok(0), | ||
} | ||
} |
Oops, something went wrong.
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.
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 know we are only targeting duration, does it make sense to then apply it to everything if we weren't doing it before?
Or is this mainly because we might reject when any of these fields are empty?