| 347 | } |
| 348 | |
| 349 | bool LogPushData::writeTransactionInfo(int location, uint32_t subseq) { |
| 350 | if (!FLOW_KNOBS->WRITE_TRACING_ENABLED || logSystem->getTLogVersion() < TLogVersion::V6 || |
| 351 | writtenLocations.count(location) != 0) { |
| 352 | return false; |
| 353 | } |
| 354 | |
| 355 | CODE_PROBE(true, "Wrote SpanContextMessage to a transaction log"); |
| 356 | writtenLocations.insert(location); |
| 357 | |
| 358 | BinaryWriter& wr = messagesWriter[location]; |
| 359 | int offset = wr.getLength(); |
| 360 | wr << uint32_t(0) << subseq << uint16_t(prev_tags.size()); |
| 361 | for (auto& tag : prev_tags) |
| 362 | wr << tag; |
| 363 | if (logSystem->getTLogVersion() >= TLogVersion::V7) { |
| 364 | OTELSpanContextMessage contextMessage(spanContext); |
| 365 | wr << contextMessage; |
| 366 | } else { |
| 367 | // When we're on a TLog version below 7, but the front end of the system (i.e. proxy, sequencer, resolver) |
| 368 | // is using OpenTelemetry tracing (i.e on or above 7.2), we need to convert the OpenTelemetry Span data model |
| 369 | // i.e. 16 bytes for traceId, 8 bytes for spanId, to the OpenTracing spec, which is 8 bytes for traceId |
| 370 | // and 8 bytes for spanId. That means we need to drop some data. |
| 371 | // |
| 372 | // As a workaround for this special case we've decided to drop is the 8 bytes |
| 373 | // for spanId. Therefore we're passing along the full 16 byte traceId to the storage server with 0 for spanID. |
| 374 | // This will result in a follows from relationship for the storage span within the trace rather than a |
| 375 | // parent->child. |
| 376 | SpanContextMessage contextMessage; |
| 377 | if (spanContext.isSampled()) { |
| 378 | CODE_PROBE(true, "Converting OTELSpanContextMessage to traced SpanContextMessage"); |
| 379 | contextMessage = SpanContextMessage(UID(spanContext.traceID.first(), spanContext.traceID.second())); |
| 380 | } else { |
| 381 | CODE_PROBE(true, "Converting OTELSpanContextMessage to untraced SpanContextMessage"); |
| 382 | contextMessage = SpanContextMessage(UID(0, 0)); |
| 383 | } |
| 384 | wr << contextMessage; |
| 385 | } |
| 386 | int length = wr.getLength() - offset; |
| 387 | *(uint32_t*)((uint8_t*)wr.getData() + offset) = length - sizeof(uint32_t); |
| 388 | return true; |
| 389 | } |
| 390 | |
| 391 | void LogPushData::setMutations(uint32_t totalMutations, VectorRef<StringRef> mutations) { |
| 392 | ASSERT_EQ(subsequence, 1); |
nothing calls this directly
no test coverage detected