Skip to content
This repository has been archived by the owner on Aug 30, 2019. It is now read-only.

cmd/trace-agent: force sampling of transactions with priority 2 #463

Merged
merged 2 commits into from
Aug 3, 2018

Conversation

bmermet
Copy link

@bmermet bmermet commented Jul 25, 2018

This PR makes sure that when a span from a trace with a sampling priority of 2 matches the criteria to be analyzed it is kept even if the rate based sampling policy would discard it.

Since these traces have been flagged as being of particular interest by the user, it makes sense to ensure the transactions too are always kept.

@bmermet bmermet requested review from gbbr and LotharSee July 25, 2018 15:52
@@ -22,7 +22,8 @@ import (
)

const (
samplingPriorityKey = "_sampling_priority_v1"
// SamplingPriorityKey is the key of the sampling priority value in the metrics dictionnary of the root span
SamplingPriorityKey = "_sampling_priority_v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -22,7 +22,8 @@ import (
)

const (
samplingPriorityKey = "_sampling_priority_v1"
// SamplingPriorityKey is the key of the sampling priority value in the metrics dictionnary of the root span
Copy link
Contributor

Choose a reason for hiding this comment

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

s/dictionnary/map

Dictionary is more of a Python term :-)

if pt.Root == nil {
return 0, false
}
priorityFloat, hasPriority := pt.Root.Metrics[sampler.SamplingPriorityKey]
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess the general way is to use ok for the second arg. So maybe you'd wanna use something like p, ok.

@gbbr gbbr changed the title Force sampling of transactions with priority 2 cmd/trace-agent: force sampling of transactions with priority 2 Jul 26, 2018
@gbbr
Copy link
Contributor

gbbr commented Jul 26, 2018

Can you please prefix your commit with the affected package name? E.g: when merging, just squash and use the PR title, I've updated it for you.

@gbbr gbbr added this to the 6.4.0 milestone Jul 26, 2018
@gbbr gbbr added the core label Jul 26, 2018
@gbbr gbbr modified the milestones: 6.4.0, next Jul 26, 2018
bmermet added 2 commits July 27, 2018 18:51
Makes sure that when a span from a trace with a sampling priority of 2
matches the critera to be analyzed it is kept even if the rate based
sampling policy would discard it.
@bmermet bmermet force-pushed the bmermet/force-transaction-sampling-p2 branch from 90abcc8 to f903d5f Compare July 27, 2018 16:51
Copy link
Contributor

@gbbr gbbr left a comment

Choose a reason for hiding this comment

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

@bmermet should I merge this?

@@ -22,7 +22,8 @@ import (
)

const (
samplingPriorityKey = "_sampling_priority_v1"
// SamplingPriorityKey is the key of the sampling priority value in the metrics map of the root span
SamplingPriorityKey = "_sampling_priority_v1"
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be better to use KeySamplingPriority? We could make it a convention for constants representing keys. It would be in the same style as the standard library http package constants (link)

Copy link
Author

Choose a reason for hiding this comment

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

I don't know how much of a common practice it is in go. If you think it is the idiomatic way to do it, let's do that.

@bmermet bmermet merged commit 78c7f4a into master Aug 3, 2018
@bmermet bmermet deleted the bmermet/force-transaction-sampling-p2 branch August 3, 2018 12:58
@gbbr gbbr modified the milestones: next, 6.5.0 Sep 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants