|
3 | 3 | // https://opensource.org/licenses/Apache-2.0
|
4 | 4 |
|
5 | 5 | #include <workerd/io/tracer.h>
|
| 6 | +#include <workerd/util/sentry.h> |
6 | 7 | #include <workerd/util/thread-scopes.h>
|
7 | 8 |
|
8 | 9 | #include <capnp/message.h> // for capnp::clone()
|
@@ -167,6 +168,10 @@ void WorkerTracer::addLog(const tracing::InvocationSpanContext& context,
|
167 | 168 | // available. If the given worker stage is only tailed by a streaming tail worker, adding the log
|
168 | 169 | // to the legacy trace object is not needed; this will be addressed in a future refactor.
|
169 | 170 | KJ_IF_SOME(writer, maybeTailStreamWriter) {
|
| 171 | + // TODO(felix): Used for debug logging, remove after a few days. |
| 172 | + if (topLevelInvocationSpanContext == kj::none) { |
| 173 | + LOG_NOSENTRY(WARNING, "tried to send log before onset event", trace->entrypoint, isJsRpc); |
| 174 | + } |
170 | 175 | // If message is too big on its own, truncate it.
|
171 | 176 | writer->report(context,
|
172 | 177 | {(tracing::Log(timestamp, logLevel,
|
@@ -220,7 +225,8 @@ void WorkerTracer::addSpan(CompleteSpan&& span) {
|
220 | 225 | // TODO(o11y): Provide correct nested spans
|
221 | 226 | // TODO(o11y): Propagate span context when context entropy is not available for RPC-based worker
|
222 | 227 | // invocations as indicated by isTrigger
|
223 |
| - auto& topLevelContext = KJ_ASSERT_NONNULL(topLevelInvocationSpanContext, span); |
| 228 | + auto& topLevelContext = |
| 229 | + KJ_ASSERT_NONNULL(topLevelInvocationSpanContext, span, trace->entrypoint, isJsRpc); |
224 | 230 | tracing::InvocationSpanContext context = [&]() {
|
225 | 231 | if (topLevelContext.isTrigger()) {
|
226 | 232 | return topLevelContext.clone();
|
@@ -453,4 +459,8 @@ SpanParent WorkerTracer::getUserRequestSpan() {
|
453 | 459 | return userRequestSpan.addRef();
|
454 | 460 | }
|
455 | 461 |
|
| 462 | +void BaseTracer::setIsJsRpc() { |
| 463 | + isJsRpc = true; |
| 464 | +} |
| 465 | + |
456 | 466 | } // namespace workerd
|
0 commit comments