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: extract key fields from rules config #1327

Merged
merged 3 commits into from
Sep 16, 2024
Merged

Conversation

VinozzZ
Copy link
Contributor

@VinozzZ VinozzZ commented Sep 12, 2024

Which problem is this PR solving?

Extract sampling fields from config so that we can use it to construct key fields only spans

fixes: #1325

Short description of the changes

  • add GetSamplingFielder interface to sampler config
  • add GetKeyFields to all samplers

@VinozzZ VinozzZ added the type: enhancement New feature or request label Sep 12, 2024
@VinozzZ VinozzZ added this to the v2.9 milestone Sep 12, 2024
@VinozzZ VinozzZ self-assigned this Sep 12, 2024
@VinozzZ VinozzZ requested a review from a team as a code owner September 12, 2024 22:43
Copy link
Contributor

@MikeGoldsmith MikeGoldsmith left a comment

Choose a reason for hiding this comment

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

Overall looks good - left some feedback for the new interface and how we extract the sampler fields.

@@ -149,10 +149,22 @@ type V2SamplerConfig struct {
Samplers map[string]*V2SamplerChoice `json:"samplers" yaml:"Samplers,omitempty" validate:"required"`
}

type GetSamplingFielder interface {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we call this interface SamplerConfig instead as it's implemented by all sampler configs? If we need to introduce other shared functionality in the future, it enables us to add more shared logic without adding more interfaces.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason why I chose this name is bc it's easy to know the intend of this interface. If in the future we find ourselves needing to implement more common method for SamplerConfigs, we can have a name reflect those methods. SamplerConfig in a bit too generic to know what exactly the interface is trying to achieve from my perspective

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, it's an internal interface so isn't that important if have to change it in the future. I guess it depends on which side of generic vs specific interface you. As a generic interface that all sample implementations will need to implement, I prefer SamplerConfig. If it were only going to be implemented on a subset of samplers, a more discrete name is better.

Either way, happy to continue with it's current name and we can change later if we need to 😄

@VinozzZ VinozzZ merged commit 45874a2 into main Sep 16, 2024
5 checks passed
@VinozzZ VinozzZ deleted the yingrong.keyfield_sampler branch September 16, 2024 15:33
TylerHelmuth pushed a commit that referenced this pull request Oct 16, 2024
## Which problem is this PR solving?

Extract sampling fields from config so that we can use it to construct
key fields only spans

fixes: #1325 

## Short description of the changes

- add `GetSamplingFielder` interface to sampler config
- add `GetKeyFields` to all samplers
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Abstract unique sampling fields from config
2 participants