-
Notifications
You must be signed in to change notification settings - Fork 238
Add more Cirrus error logging info #5483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
6e67c86
39a3a29
8c23f7b
cdb32cf
1412e7c
173744c
43e82de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,12 @@ export function getExperimentationId( | |
// If the user is logged in, use the Subscriber ID. | ||
const namespace = process.env.NIMBUS_UUID_NAMESPACE; | ||
if (!namespace) { | ||
logger.error( | ||
"NIMBUS_UUID_NAMESPACE environment variable is missing. Cannot generate experimentationId.", | ||
{ | ||
accountId, | ||
}, | ||
); | ||
throw new Error( | ||
"NIMBUS_UUID_NAMESPACE not set, cannot create experimentationId", | ||
); | ||
|
@@ -47,6 +53,9 @@ export function getExperimentationId( | |
); | ||
return "guest-no-experimentation-id-set-by-monitor-middleware"; | ||
} | ||
logger.info("Using experimentationId from header for guest user", { | ||
experimentationId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Likewise here, let's just lot that this is being set without logging the ID. |
||
}); | ||
return experimentationId as ExperimentationId; | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,6 +50,12 @@ export async function getExperiments(params: { | |
serverUrl.searchParams.set("nimbus_preview", "true"); | ||
} | ||
|
||
logger.info("Sending request to Cirrus", { | ||
serverUrl: serverUrl.toString(), | ||
previewMode: params.previewMode, | ||
client_id: params.experimentationId, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not log the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 1412e7c |
||
}); | ||
|
||
const response = await fetch(serverUrl, { | ||
headers: { | ||
"Content-Type": "application/json", | ||
|
@@ -65,6 +71,14 @@ export async function getExperiments(params: { | |
}), | ||
}); | ||
|
||
if (!response.ok) { | ||
logger.error("Cirrus request failed", { | ||
status: response.status, | ||
url: serverUrl.toString(), | ||
}); | ||
throw new Error(`Cirrus request failed: ${response.statusText}`); | ||
} | ||
|
||
const json = await response.json(); | ||
|
||
let experimentData; | ||
|
@@ -76,7 +90,12 @@ export async function getExperiments(params: { | |
|
||
return (experimentData as ExperimentData) ?? defaultExperimentData; | ||
} catch (ex) { | ||
logger.error("Could not connect to Cirrus", { serverUrl, ex }); | ||
logger.error("Could not connect to Cirrus", { | ||
serverUrl, | ||
ex, | ||
flags, | ||
params, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think in this case it's OK (since we could be sending invalid params) |
||
}); | ||
captureException(ex); | ||
return defaultExperimentData; | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,14 +43,6 @@ export function middleware(request: NextRequest) { | |
}, | ||
}); | ||
|
||
if (!existingExperimentationId) { | ||
response.cookies.set({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why remove this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the point of setting the cookie is for users that are not authenticated, so there's no way to keep track of which experiments or roll-outs they are enrolled in otherwise. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, I was just supposed to remove the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in 8c23f7b |
||
name: "experimentationId", | ||
value: experimentationId, | ||
path: "/", | ||
}); | ||
} | ||
|
||
return response; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's avoid logging the
accountId
, any problem here is unlikely to be related to the user (more likely the variable we need is not set)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in cdb32cf