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

feat: add sample rate to logs if set #275

Merged
merged 7 commits into from
Sep 23, 2024
Merged

Conversation

JamieDanielson
Copy link
Contributor

@JamieDanielson JamieDanielson commented Sep 19, 2024

Which problem is this PR solving?

Short description of the changes

  • move sample rate logic that was in traces to common, including test cases
  • add sampleRate to log events
  • make sampleRate key name case-insensitive
  • fall back to default rate of 1 when given negative values
  • round and coerce floats into ints

It would be nice to have an error if an invalid sampleRateKey is found. Right now we just return empty string.

@JamieDanielson JamieDanielson requested a review from a team as a code owner September 19, 2024 19:39
@JamieDanielson JamieDanielson self-assigned this Sep 19, 2024
@JamieDanielson JamieDanielson added version: bump minor A PR that adds behavior, but is backwards-compatible. type: enhancement New feature or request labels Sep 19, 2024
otlp/common.go Outdated Show resolved Hide resolved
otlp/common.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

I have some questions, but I trust however you want to handle them.

otlp/common.go Show resolved Hide resolved
otlp/common.go Show resolved Hide resolved
otlp/common.go Outdated Show resolved Hide resolved
otlp/common.go Outdated Show resolved Hide resolved
otlp/common_test.go Show resolved Hide resolved
@JamieDanielson
Copy link
Contributor Author

I have some questions, but I trust however you want to handle them.

I know you approved with suggestions but I wouldn't mind an extra check here. I made all the changes you suggested.

Copy link
Contributor

@kentquirk kentquirk left a comment

Choose a reason for hiding this comment

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

Looks great! One minor suggestion...

otlp/common.go Outdated Show resolved Hide resolved
Co-authored-by: Kent Quirk <[email protected]>
@JamieDanielson JamieDanielson merged commit 02036d4 into main Sep 23, 2024
6 checks passed
@JamieDanielson JamieDanielson deleted the jamie.add-logs-sample-rate branch September 23, 2024 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request version: bump minor A PR that adds behavior, but is backwards-compatible.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set SampleRate for OTLP Logs
3 participants