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
refactor(Telemetry): Ensure to report projectId
for interactive
#10406
Conversation
fbba60c
to
437fd10
Compare
Codecov Report
@@ Coverage Diff @@
## master #10406 +/- ##
==========================================
- Coverage 85.37% 85.37% -0.01%
==========================================
Files 340 340
Lines 14005 14011 +6
==========================================
+ Hits 11957 11962 +5
- Misses 2048 2049 +1
Continue to review full report at Codecov.
|
437fd10
to
dfb9b2d
Compare
scripts/serverless.js
Outdated
@@ -558,6 +559,7 @@ const processSpanPromise = (async () => { | |||
configuration, | |||
commandUsage, | |||
variableSources: variableSourcesInConfig, | |||
interactiveContext, |
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.
Wouldn't it be cleaner to expose serverless
instance on interactive CLI context, and pass it to .generateTelemetryPayload
(having that we probably don't have to make any new changes in generateTelemetryPayload
)?
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.
That's definitely an option and might be a better solution overall 👍
dfb9b2d
to
2d2d8de
Compare
if (serviceName && accountId) { | ||
payload.projectId = crypto | ||
.createHash('sha256') | ||
.update(`${serviceName}-${accountId}`) | ||
.digest('base64'); | ||
} | ||
|
||
payload.didCreateStack = Boolean(serverless && serverless.getProvider('aws').didCreateStack); |
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.
Slightly related: we mentioned the stack deletion as well, and we said "we can look at remove
commands" -> but these don't have the projectId
property in those events. Should we add command === 'remove'
above in the if
too? (or maybe in a separate PR if that's cleaner)
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.
That's a great point - I will add that in a separate PR
scripts/serverless.js
Outdated
@@ -514,6 +514,7 @@ const processSpanPromise = (async () => { | |||
const isStandaloneCommand = notIntegratedCommands.has(command); | |||
|
|||
if (!isHelpRequest && (isInteractiveSetup || isStandaloneCommand)) { | |||
let interactiveContext; |
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.
It'll be nicer to reuse the top level serverless
variable (same as we reuse configuration
one).
2d2d8de
to
7bb89c9
Compare
if (serviceName && accountId) { | ||
payload.projectId = crypto | ||
.createHash('sha256') | ||
.update(`${serviceName}-${accountId}`) | ||
.digest('base64'); | ||
} | ||
|
||
payload.didCreateStack = Boolean(serverless && serverless.getProvider('aws').didCreateStack); |
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.
In platform PR I've suggested that maybe it'll be better to give it a more agnostic name as didCreateService
, so if eventually later we will support non-CF-related deployments, this name stays accurate.
WDYT?
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.
Not sure if that applies to the metric name as well, but for the metric name +1 to have it a bit more generic
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.
Great suggestion @medikoo 👍
7bb89c9
to
ccc214b
Compare
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.
Looks great 👍
Reported internally:
projectId
for interactive flow deployments