-
Notifications
You must be signed in to change notification settings - Fork 1k
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
feat(crwa): OpenTelemetry #7455
Conversation
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.
A couple quick comments:
|
||
// Telemetry | ||
if ( | ||
!process.argv.includes('--no-telemetry') && // Must include '--no-telemetry' exactly because we want to do this check before any yargs. TODO: Communicate this on cmd help |
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.
This comment is a little too long to be on the same line as the code:
!process.argv.includes('--no-telemetry') && // Must include '--no-telemetry' exactly because we want to do this check before any yargs. TODO: Communicate this on cmd help | |
// Must include '--no-telemetry' exactly because we want to do this check before any yargs. | |
// TODO: Communicate this on cmd help | |
!process.argv.includes('--no-telemetry') && |
|
||
// Telemetry | ||
if ( | ||
!process.argv.includes('--no-telemetry') && // Must include '--no-telemetry' exactly because we want to do this check before any yargs. TODO: Communicate this on cmd help |
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.
I had the same problem in the CLI's index.js file. I need the value of the cwd
option before I invoke yargs. You should be able to use the same solution I did:
redwood/packages/cli/src/index.js
Line 60 in 8569f5f
let { cwd } = Parser(hideBin(process.argv)) |
So in your case...
import { hideBin, Parser } from 'yargs/helpers'
// ...
const { telemetry } = Parser(hideBin(process.argv))
Then check if telemetry
is false
later, no need to deal with the "no-" prefix, etc.
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.
Excellent I had a suspicion that it might have been a similar issue you'd dealt. I'll try out your solution for sure.
.option('telemetry', { | ||
default: true, | ||
type: 'boolean', | ||
describe: | ||
'Enables sending telemetry events for this create command and all Redwood CLI commands https://telemetry.redwoodjs.com', | ||
}) |
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.
Using the suggestion in another comment, you can leave this here. Solves the documentation problem!
Awesome! |
// TODO: Get a better way of recording what version of CRWA is running because this is just null... | ||
[SemanticResourceAttributes.SERVICE_VERSION]: | ||
info.npmPackages != null | ||
? info.npmPackages['@redwoodjs/core']?.installed | ||
: undefined, |
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.
Any reason you can't just get it from this package's package.json
? Like in create-redwood-app.js
import { name, version } from '../package' |
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.
I'd been using that technique in my earlier experimenting and it worked fine. I only replaced it with a to-do because vscode was yelling at me. I'll happily add it back.
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.
Ah gotcha—yelling at you with red squiggles?
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.
Yeah but it's fine now. I must have been importing it with the extension or something before.
@Josh-Walker-GM could you provide instructions on how you're testing this locally? I'd like to try it out if possible |
Closed as superseded by #8043 |
WIP: This experimental and exploratory might be dropped.
Problem
We are investigating changing up our telemetry setup.
Changes
process.exit(1)
so not many opportunities to hook into process end.Outstanding
Notes