8000 pr comments · coder/coder@a4c4683 · GitHub
[go: up one dir, main page]

Skip to content

Commit a4c4683

Browse files
committed
pr comments
1 parent 2cb35aa commit a4c4683

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

cli/server.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ func server() *cobra.Command {
120120
_ = tracerProvider.Shutdown(ctx)
121121
}()
122122

123-
sqlDriver, err = tracing.PostgresDriver(tracerProvider, "coderd.database")
123+
d, err := tracing.PostgresDriver(tracerProvider, "coderd.database")
124124
if err != nil {
125125
logger.Warn(cmd.Context(), "failed to start postgres tracing driver", slog.Error(err))
126+
} else {
127+
sqlDriver = d
126128
}
127129
}
128130
}

coderd/tracing/postgres.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ func formatPostgresSpan(ctx context.Context, op string) string {
3737
return strings.ToUpper(op)
3838
}
3939

40-
s := strings.Split(strings.TrimPrefix(q, qPrefix), " ")[0]
40+
// Remove the qPrefix and then grab the method name.
41+
// We expect the first line of the query to be in
42+
// the format "-- name: GetAPIKeyByID :one".
43+
s := strings.SplitN(strings.TrimPrefix(q, qPrefix), " ", 2)[0]
4144
return fmt.Sprintf("%s %s", strings.ToUpper(op), s)
4245
}

0 commit comments

Comments
 (0)
0