Skip to content
This repository was archived by the owner on Jul 31, 2023. It is now read-only.

Commit 64567d5

Browse files
authored
ProbabilitySampler: avoid copying trace_id. (#397)
1 parent 40c8361 commit 64567d5

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

opencensus/trace/internal/sampler.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ uint64_t CalculateThreshold(double probability) {
3939
}
4040

4141
uint64_t CalculateThresholdFromBuffer(const TraceId& trace_id) {
42-
uint8_t buf[TraceId::kSize];
43-
trace_id.CopyTo(buf);
42+
const uint8_t* buf = reinterpret_cast<const uint8_t*>(trace_id.Value());
4443
uint64_t res = 0;
4544
// We only use the first 8 bytes of TraceId.
4645
for (int i = 0; i < 8; ++i) {

0 commit comments

Comments
 (0)