benchmark: add micro-benchmarks for TraceID hex formatting and parsing#311
Open
AneesPatel wants to merge 2 commits intoDataDog:mainfrom
Open
benchmark: add micro-benchmarks for TraceID hex formatting and parsing#311AneesPatel wants to merge 2 commits intoDataDog:mainfrom
AneesPatel wants to merge 2 commits intoDataDog:mainfrom
Conversation
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.
Description
Adds
benchmark/trace_id_bench.cppto introduce targeted Google Benchmark coverage for the 128-bit and 64-bit TraceID formatting paths. Also updatesbenchmark/CMakeLists.txtto include the new benchmark executable.Baseline Metrics (Ubuntu 22.04 / GCC 11.4):
BM_TraceID_HexPaddedstd::stringallocations and concatenation.BM_TraceID_ParseHex_128bittraceparentextraction path.BM_TraceID_ParseHex_64bitBM_HexPadded_uint64to_chars+std::stringalloc.BM_Hex_uint64Motivation
TraceID::hex_padded()is called on every outgoing W3Ctraceparentheader injection, andTraceID::parse_hex()on every incoming extraction. Because these functions sit in the hottest path of distributed tracing, their latency and allocation overhead multiply across millions of spans.Currently, the underlying
hex_padded<uint64_t>()andhex<uint64_t>()functions utilize a stack-buffer-to-std::stringpattern. While the existingBM_TraceTinyCCSourcebenchmark provides excellent end-to-end throughput data, it cannot isolate micro-regressions in these specific serialization operations.This baseline provides the data needed to safely prevent future regressions and evaluate allocation-reduction strategies in the critical path.
Jira ticket
N/A
Additional Notes
How to run