Add VarEncodingHelper for use in Data Streams Monitoring#3129
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bouwkast
left a comment
There was a problem hiding this comment.
Looks good to me, I have a few nits though on what I think are doc comment copy/paste errors
Also, I see in the Java/Go versions there is a version that uses double do we need that too?
| #endif | ||
|
|
||
| /// <summary> | ||
| /// Serializes 64-bit signed integers using zig-zag encoding, |
There was a problem hiding this comment.
nit, but I think this should say Serializes 32-bit signed integers
| => WriteVarLongZigZag(bytes, offset, value); | ||
|
|
||
| /// <summary> | ||
| /// Serializes 64-bit signed integers using zig-zag encoding, |
There was a problem hiding this comment.
nit, but I think this should say Serializes 32-bit signed integers
|
|
||
| #if NETCOREAPP3_1_OR_GREATER | ||
| /// <summary> | ||
| /// Serializes 64-bit signed integers using zig-zag encoding, |
There was a problem hiding this comment.
nit, but I think this should say Serializes 32-bit signed integers
| #endif | ||
|
|
||
| /// <summary> | ||
| /// Deserializes 64-bit unsigned integers that have been encoded using |
There was a problem hiding this comment.
nit, but I think should be Deserializes 32-bit unsigned integers?
|
|
||
| #if NETCOREAPP3_1_OR_GREATER | ||
| /// <summary> | ||
| /// Deserializes 64-bit unsigned integers that have been encoded using |
There was a problem hiding this comment.
nit, but I think should be Deserializes 32-bit unsigned integers?
| /// <param name="offset">The offset within the array to start writing</param> | ||
| /// <param name="bytesRead">The number of bytes read when successfully decoded</param> | ||
| /// <returns>The decoded value, or null if decoding failed</returns> | ||
| public static long? ReadVarIntZigZag(byte[] bytes, int offset, out int bytesRead) |
There was a problem hiding this comment.
Is this supposed to be a long? Seems like it should be an int if it gets casted to an int, unsure though if I'm missing something about this though.
Same question as the Span version of this as well.
There was a problem hiding this comment.
Yep, you're right, good 👀, thanks!
Based on the version in go and Java dd-sketch libraries. We can move this to the dd-sketch-dotnet library, but for now it's easier to add it in here
b0f35f8 to
706d135
Compare
Benchmarks Report 🐌Benchmarks for #3129 compared to master:
The following thresholds were used for comparing the benchmark speeds:
Allocation changes below 0.5% are ignored. Benchmark detailsBenchmarks.Trace.AgentWriterBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AppSecBodyBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.AspNetCoreBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.DbCommandBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ElasticsearchBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.GraphQLBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.HttpClientBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.ILoggerBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.Log4netBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.NLogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.RedisBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SerilogBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.SpanBenchmark - Same speed ✔️ Same allocations ✔️Raw results
Benchmarks.Trace.TraceAnnotationsBenchmark - Same speed ✔️ Same allocations ✔️Raw results
|
Code Coverage Report 📊✔️ Merging #3129 into master will not change line coverage
View the full report for further details: Datadog.Trace Breakdown ✔️
The following classes have significant coverage changes.
The following classes were added in #3129:
View the full reports for further details: |
Summary of changes
VarEncodingHelperfor use in Data Streams MonitoringReason for change
This is a prerequisite for the ongoing data streams monitoring work. This implementation (and the tests) are based on the version in sketches-go and sketches-java libraries. We can potentially move this to the sketches-dotnet library and re-vendor, but as it's unused in there, seemed it's easier to add it in here for now
Implementation details
Copied the java implementation mostly, reused the existing
NumberOfLeadingZerosLong()implementation added to sketches-dotnet by @kevingosseTest coverage
Copy-pasted from java/go to ensure we're compatible
Other details
This is a prerequisite for data streams monitoring