Skip to content
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

Fix telemetry async submission #6414

Closed
wants to merge 1 commit into from

Conversation

nicholaspcr
Copy link
Contributor

Summary

References #6403, the lack of a message sent to the channel implies in the telemetry always timing out.

Changes

  • Add telemetrySubmission <- struct{}{}

Testing

Manual tests, also confirmed that the CLI interacts with the telemetry collector properly and that it shows on the Grafana dashboard.

Notes for Reviewers

I noticed that when deleting the telemetry's cache file I got a timeout even with a second delay, I believe its due to the initial creation of the telemetry cache file and the yaml parsing involved in that:

// Write telemetry state into the provided path.
func (cst *cliStateTelemetry) Write(p string) error {
	b, err := yaml.Marshal(cst)
	if err != nil {
		return err
	}

	// Creates the file since it does not exist.
	if err := os.WriteFile(p, b, 0o644); err != nil { //nolint:gas
		return err
	}
	return nil
}

All subsequent send operations are within the time window (1s) regardless if its on a SSD or a normal hard drive, which shouldn't make a difference since the time window is so large. I'm thinking that the parsing is the main culprit for the slowdown, even if the data is quite small.

Checklist

  • Scope: The referenced issue is addressed, there are no unrelated changes.
  • Compatibility: The changes are backwards compatible with existing API, storage, configuration and CLI, according to the compatibility commitments in README.md for the chosen target branch.
  • Documentation: Relevant documentation is added or updated.
  • Changelog: Significant features, behavior changes, deprecations and fixes are added to CHANGELOG.md.
  • Commits: Commit messages follow guidelines in CONTRIBUTING.md, there are no fixup commits left.

@nicholaspcr nicholaspcr added this to the v3.27.1 milestone Aug 1, 2023
@nicholaspcr nicholaspcr self-assigned this Aug 1, 2023
@github-actions github-actions bot added the ui/cli This is related to ttn-lw-cli label Aug 1, 2023
@nicholaspcr
Copy link
Contributor Author

Never mind, my mistake. Fooled myself while testing the CLI

@nicholaspcr nicholaspcr closed this Aug 1, 2023
@nicholaspcr nicholaspcr deleted the fix/cli-telemetry-async-submission branch August 1, 2023 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ui/cli This is related to ttn-lw-cli
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant