Skip to content

Commit 816b44b

Browse files
committed
fix(telemetry): set sentry.org tag in issue explain and plan commands
The issue explain and issue plan commands never called setOrgProjectContext() after resolving the org, so SeerError events captured to Sentry were missing the sentry.org tag. This made it impossible to filter or group Seer paywall errors by customer org in dashboards. Add setContext([org], []) right after resolveOrgAndIssueId() returns and before the Seer API call that may throw, ensuring the tag is set even when the command fails with a SeerError.
1 parent 88b6f36 commit 816b44b

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/commands/issue/explain.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const explainCommand = buildCommand({
7474
},
7575
async *func(this: SentryContext, flags: ExplainFlags, issueArg: string) {
7676
applyFreshFlag(flags);
77-
const { cwd } = this;
77+
const { cwd, setContext } = this;
7878

7979
// Declare org outside try block so it's accessible in catch for error messages
8080
let resolvedOrg: string | undefined;
@@ -88,6 +88,9 @@ export const explainCommand = buildCommand({
8888
});
8989
resolvedOrg = org;
9090

91+
// Set telemetry context so SeerError events carry the org tag
92+
setContext([org], []);
93+
9194
// Ensure root cause analysis exists (triggers if needed)
9295
const state = await ensureRootCauseAnalysis({
9396
org,

src/commands/issue/plan.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ export const planCommand = buildCommand({
193193
},
194194
async *func(this: SentryContext, flags: PlanFlags, issueArg: string) {
195195
applyFreshFlag(flags);
196-
const { cwd } = this;
196+
const { cwd, setContext } = this;
197197

198198
// Declare org outside try block so it's accessible in catch for error messages
199199
let resolvedOrg: string | undefined;
@@ -207,6 +207,9 @@ export const planCommand = buildCommand({
207207
});
208208
resolvedOrg = org;
209209

210+
// Set telemetry context so SeerError events carry the org tag
211+
setContext([org], []);
212+
210213
// Ensure root cause analysis exists (runs explain if needed)
211214
const state = await ensureRootCauseAnalysis({
212215
org,

0 commit comments

Comments
 (0)