Skip to content

Commit 2149606

Browse files
committed
[server] Fix tracing for some test scenarios
1 parent 2e2833a commit 2149606

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

components/gitpod-db/src/traced-db.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ export class DBWithTracing<T> {
2525
return async (...args: any[]) => {
2626
// do not try and trace calls with an empty trace context - the callers intention most likely was to omit the trace
2727
// so as to not spam the trace logs
28-
if (!ctx.span) {
28+
// Also, opentracing makes some assumptions about the Span object, so this might fail under some circumstances
29+
function isEmptyObject(obj: object): boolean {
30+
return Object.keys(obj).length === 0;
31+
}
32+
if (!ctx.span || isEmptyObject(ctx.span)) {
2933
return await f.bind(_target)(...args);
3034
}
3135

components/gitpod-protocol/src/util/tracing.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import { log, LogContext } from "./logging";
1313

1414
export interface TraceContext {
1515
span?: opentracing.Span;
16+
// TODO(gpl) We are missing this method, but won't add right now because of different focus, and it's unclear how we want to use tracing going forward
17+
isDebugIDContainerOnly?: () => boolean;
1618
}
1719
export type TraceContextWithSpan = TraceContext & {
1820
span: opentracing.Span;

0 commit comments

Comments
 (0)