Skip to content

Commit 9d571e2

Browse files
committed
[nfc] slight tracing simplifications
1 parent ef5c68b commit 9d571e2

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

src/workerd/io/trace.c++

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ InvocationSpanContext InvocationSpanContext::newForInvocation(
200200
kj::Maybe<kj::EntropySource&> entropySource) {
201201
kj::Maybe<const InvocationSpanContext&> parent;
202202
auto traceId = triggerContext
203-
.map([&](auto& ctx) mutable -> TraceId {
203+
.map([&](auto& ctx) mutable {
204204
parent = ctx;
205205
return ctx.traceId;
206206
}).orDefault([&] { return TraceId::fromEntropy(entropySource); });
@@ -470,16 +470,12 @@ EmailEventInfo EmailEventInfo::clone() const {
470470
namespace {
471471
kj::Vector<TraceEventInfo::TraceItem> getTraceItemsFromTraces(
472472
kj::ArrayPtr<const kj::Own<Trace>> traces) {
473-
return KJ_MAP(t, traces) -> TraceEventInfo::TraceItem {
474-
return TraceEventInfo::TraceItem(mapCopyString(t->scriptName));
475-
};
473+
return KJ_MAP(t, traces) { return TraceEventInfo::TraceItem(mapCopyString(t->scriptName)); };
476474
}
477475

478476
kj::Vector<TraceEventInfo::TraceItem> getTraceItemsFromReader(
479477
rpc::Trace::TraceEventInfo::Reader reader) {
480-
return KJ_MAP(r,
481-
reader
482-
.getTraces()) -> TraceEventInfo::TraceItem { return TraceEventInfo::TraceItem(r); };
478+
return KJ_MAP(r, reader.getTraces()) { return TraceEventInfo::TraceItem(r); };
483479
}
484480
} // namespace
485481

src/workerd/io/tracer.c++

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,22 @@ void TailStreamWriter::report(
3939
auto& s = KJ_UNWRAP_OR_RETURN(state);
4040

4141
// The onset event must be first and must only happen once.
42-
if (event.is<tracing::Onset>()) {
42+
if (event.is<Onset>()) {
4343
KJ_ASSERT(!onsetSeen, "Tail stream onset already provided");
4444
onsetSeen = true;
4545
} else {
4646
KJ_ASSERT(onsetSeen, "Tail stream onset was not reported");
47-
if (event.is<tracing::Outcome>()) {
47+
if (event.is<Outcome>()) {
4848
outcomeSeen = true;
4949
}
5050
}
5151

5252
// A zero spanId at the TailEvent level signifies that no spanId should be provided to the tail
5353
// worker (for Onset events). We go to great lengths to rule out getting an all-zero spanId by
5454
// chance (see SpanId::fromEntropy()), so this should be safe.
55-
tracing::TailEvent tailEvent(context.getTraceId(), context.getInvocationId(),
56-
context.getSpanId() == tracing::SpanId::nullId ? kj::none : kj::Maybe(context.getSpanId()),
57-
timestamp, s.sequence++, kj::mv(event));
55+
TailEvent tailEvent(context.getTraceId(), context.getInvocationId(),
56+
context.getSpanId() == SpanId::nullId ? kj::none : kj::Maybe(context.getSpanId()), timestamp,
57+
s.sequence++, kj::mv(event));
5858

5959
// If the reporter returns false, then we will treat it as a close signal.
6060
if (!s.reporter(kj::mv(tailEvent))) state = kj::none;

0 commit comments

Comments
 (0)