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

Telemetry module for Swift #369

Merged
merged 6 commits into from
Nov 14, 2024
Merged

Telemetry module for Swift #369

merged 6 commits into from
Nov 14, 2024

Conversation

MichaelGHSeg
Copy link
Contributor

No description provided.

private var telemetryTimer: Timer?

func start() {
guard enable, !started, sampleRate != 0.0 else { return }
Copy link
Contributor

@didiergarcia didiergarcia Oct 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe sampleRate > 0.0 && sampleRate <= 1.0 ?

Comment on lines 264 to 268
var over = false
telemetryQueue.sync {
over = queue.count < maxQueueSize
}
return over
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think value determined is if you are "under" max queue size. Should that variable be changed to under ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would make more sense. I like the guard clause but the inverted logic got me a bit.

Copy link
Contributor

@didiergarcia didiergarcia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall.

I would add some better protection to the sample rate by given it a bounds like > 0.0 and <= 1.0 if that's the intension.

@MichaelGHSeg MichaelGHSeg merged commit a76bf46 into main Nov 14, 2024
8 of 11 checks passed
@MichaelGHSeg MichaelGHSeg deleted the MichaelGHSeg/Telemetry branch November 14, 2024 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants