-
Notifications
You must be signed in to change notification settings - Fork 52
chore(cli): telemetry sink #585
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
Conversation
|
exempt integ test because this PR only adds new classes, it does not use them anywhere besides unit tests |
| fs.appendFileSync(this.logFilePath, output); | ||
| } catch (e: any) { | ||
| // Never throw errors, just log them via ioHost | ||
| await this.ioHelper.defaults.warn(`Failed to add telemetry event: ${e.message}`); |
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.
test that this sends a trace msg but does not throw
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.
Approving in spite of comments to start creating smaller PRs. Looks good overall and all comments can be addressed in a quick follow.
| */ | ||
| export class EndpointTelemetrySink implements ITelemetrySink { | ||
| private events: TelemetrySchema[] = []; | ||
| private endpoint: UrlWithStringQuery; |
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.
Should accept a string and parse internally. It would avoid exposing nodejs types in the props interface. Also - external callers are not the ones who want to parse, its this class that needs it, so it should do it.
Follow up to #585 --- By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license
Introduces a generic telemetry sink to the cli. it is tested but not used anywhere.
There are 3 base types of telemetry sinks:
FileSink-> gathers events and writes them to a fileIoHostSink-> gathers events and sends them to the IoHost (for writing to stdout/err)EndpointSink-> gathers events and sends them to an external endpoint, batching at intervals of 30 seconds.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license