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

Mackjmr/merge main to prod staging #4951

Merged
merged 68 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
812d799
[receiver/collectd] Move to use HTTPServerSettings with collectdrecei…
atoulme Oct 31, 2023
39ace36
[chore][exporter/datadog] Re-enable TestTraceExporter (#28827)
songy23 Oct 31, 2023
faada96
[chore][receiver/hostmetrics] Skip process user error (un)muted test …
pjanotti Oct 31, 2023
1c63ac9
[receiver/hostmetricsreceiver] Add support for cpu frequency metric (…
ChrsMark Oct 31, 2023
7efdf16
[encoding/zipkinencodingextension] add default case (#28689)
VihasMakwana Nov 1, 2023
7e06d30
[chore] Upgrade cloud.google.com/go (#28840)
dmitryax Nov 1, 2023
fe06dee
[connector/exceptions] Add trace id and span id to generated logs (#2…
marctc Nov 1, 2023
7647d4c
[chore][exporter/loadbalancing] use headless service with DNS mode in…
Liubey Nov 1, 2023
64a787d
Update README.md (#28844)
datsabk Nov 1, 2023
5c69f33
exporter/datadog: disable APM stats via feature flag (#28616)
gbbr Nov 1, 2023
9edd6a9
[receiver/zipkin] follow receiver contract (#28627)
VihasMakwana Nov 1, 2023
f530bc4
[chore][exporter/sumologicexporter] use errors.Join instead of go.ube…
bagmeg Nov 1, 2023
1b8ccde
[receiver/wavefront] wrap metrics receiver under carbon receiver inst…
sakulali Nov 1, 2023
fddc10d
[processor/k8sattributes] Fix node/ns labels/annotations extraction (…
dmitryax Nov 1, 2023
b88690a
[processor/remoteobserver] rename to remotetapprocessor (#27874)
atoulme Nov 1, 2023
ad35b39
[Spanmetrics] - Add exemplars to Sum metrics (#28671)
aishyandapalli Nov 1, 2023
59cfbe7
[chore] fix codeowners (#28855)
atoulme Nov 2, 2023
f509060
feat(alertmanager): Add exporter factory and config (#27836)
mcube8 Nov 2, 2023
ae6d36b
Adds duration sampler distinct from latency in supplying two bounds (…
garry-cairns Nov 2, 2023
8913b95
[googlemanagedprometheusexporter] Clarify support status of this expo…
punya Nov 2, 2023
59506f6
[filelogreceiver]: Add ability to sort by mtime (#28850)
BinaryFissionGames Nov 2, 2023
327de9f
[pkg/traslator] move skywalking_to_traces into pkg/translator (#28814)
JaredTan95 Nov 2, 2023
4f5952a
[chore][pkg/stanza] Adjust length of knownFiles based on number of ma…
djaglowski Nov 2, 2023
3e0a21c
[chore][exporter/datadog] Add a section about how to switch to Zorkia…
songy23 Nov 2, 2023
9edf138
[cmd/telemetrygen] Use exporter per worker for better metrics through…
marcelbirkner Nov 2, 2023
0e13821
[scraper/processscraper] Fix TestScrapeMetrics_MuteErrorFlags failure…
michalpristas Nov 2, 2023
61c12ca
[chore][testbed] Do not use export function `carbonreceiver.New` (#28…
sakulali Nov 2, 2023
197a47c
[chore] Run make gendependabot (#28868)
dmitryax Nov 2, 2023
bfb780f
[chore] update codeowners (#28869)
atoulme Nov 2, 2023
b39f83d
[receiver/sshcheck] Change keyfile -> key_file in e.g. config and doc…
nslaughter Nov 2, 2023
040426f
[chore] [extension/jaegerremotesampling] Avoid port conflict in tests…
dmitryax Nov 3, 2023
4abb732
[exporter/azuremonitor] Add Connection String Support to Azure Monito…
rajkumar-rangaraj Nov 3, 2023
9dd2258
[exporter/awsxray] Add aws sdk http error events to x-ray subsegment …
pxaws Nov 3, 2023
f7f856e
[receiver/carbon] do not expose method (#28872)
sakulali Nov 3, 2023
af09177
[chore] update testbed to embed jaeger exporter (#28880)
Nov 3, 2023
3b84eae
Make replication stats return whole number (#28824)
michalpristas Nov 3, 2023
1bfbb18
Retract googlecloud exporter releases that don't have logging (#28884)
dashpole Nov 3, 2023
ad6fa27
[chore] move collectdreceiver shared code to an internal package (#28…
atoulme Nov 6, 2023
6696f7e
[chore] Increase Cache Go step timeout to 25min on Windows (#28859)
pjanotti Nov 6, 2023
1955509
[exporter/datadog] fix(docs): typo with especially (#28996)
karmingc Nov 6, 2023
c53db30
Bump github.com/google/cadvisor from 0.47.3 to 0.48.1 in /receiver/aw…
crobert-1 Nov 7, 2023
dbfa694
[receiver/kafkametrics] Using unique container networks and container…
sakulali Nov 7, 2023
902b1a9
[chore][processort/tailsamplingprocessor] Limit concurrency for certa…
pjanotti Nov 8, 2023
c26444b
Codesmon/exporter/azuremonitor/persistent queue (#26258)
codesmon Nov 8, 2023
cec3e59
[chore] update affiliation (#29019)
Nov 8, 2023
a80edda
[receiver/collectd] move collectdreceiver to beta (#28997)
atoulme Nov 8, 2023
22d86de
[chore] dependabot updates Wed Nov 8 16:58:54 UTC 2023 (#29028)
opentelemetrybot Nov 8, 2023
eb320a1
[chore] dependabot updates Wed Nov 8 18:29:02 UTC 2023 (#29052)
opentelemetrybot Nov 8, 2023
c95d613
[chore] dependabot updates Wed Nov 8 21:01:03 UTC 2023 (#29071)
opentelemetrybot Nov 8, 2023
b595986
[exporter/influxdb] Remove //nolint indent-error-flow (#29073)
yukinakanaka Nov 8, 2023
65b745f
hostmetricsreceiver: remove unused function (#29075)
braydonk Nov 8, 2023
330ff0a
[chore] bump go versions in workflows to 1.20.11 and 1.21.4 (#29080)
adrielp Nov 9, 2023
f4c4485
[all][chore] Moved from interface{} to any for all go code (#29072)
lucasoskorep Nov 9, 2023
57b5dcc
[receiver/dockerstats] rename struct and function to keep expected re…
sakulali Nov 9, 2023
320eff4
[receiver/mongodbatlasreceiver] add provider resource attributes (#28…
JonathanWamsley Nov 9, 2023
b716a4d
[exporter/syslog] Enable component (#28902)
kasia-kujawa Nov 9, 2023
e8116e6
[chore][pkg/stanza]: when found duplicate, continue from outer loop (…
VihasMakwana Nov 10, 2023
bf5a3f8
udp-receiver async - fix data corruption (with buffer pools) (#28898)
hovavza Nov 10, 2023
55a7d9d
[chore][receiver/windowseventlog] remove duplicate function NewFactor…
sakulali Nov 10, 2023
21469b1
[chore][pkg/stanza][exporter/signalfx] One more interface{} -> any an…
songy23 Nov 10, 2023
361b070
[chore][CONTRIBUTING.md] Add triage process link (#29092)
crobert-1 Nov 10, 2023
cd0ffe1
fix(processor/k8sattributes): README was misleading/had typoes (#29108)
lizthegrey Nov 11, 2023
61ba7fd
[processor/k8sattributes] fix(docs): typo for kubernetes label (#29110)
karmingc Nov 11, 2023
1d4cf91
Update doc.go of filelogreceiver (#29100)
Nov 12, 2023
c9f1f25
[connector/datadog] Set MutatesData to true (#29114)
songy23 Nov 13, 2023
770f1c0
cmd/telemetrygen: add HTTP export for logs (#29078)
axw Nov 13, 2023
a573f50
Merge remote-tracking branch 'upstream/main'
mackjmr Nov 13, 2023
c9ab41e
Merge branch 'main' into mackjmr/merge-main-to-prod-staging
mackjmr Nov 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Adds duration sampler distinct from latency in supplying two bounds (o…
…pen-telemetry#26115)

**Description:** Adds a bounded duration sampling processor, distinct
from the existing latency one in that it has both lower and upper bounds

Apologies for this appearing as a pull request out of nothing, my intent
had actually been to create a review area against my own fork and raise
an issue asking if you'd accept the PR. I think the need here is pretty
obvious from the context, though I think it's easy to imagine preferring
this to be a change to the existing processor. I raised as a new one as
I thought it might make existing behavior cleaner to retain.

**Link to tracking Issue:** As above this is a bit of a premature PR
since I intended to raise as an issue, and thus there isn't one, but I
think it's easy enough to deal with here so leaving open for now and
have learned GitHub's ways for the future (I rarely use github).

**Testing:** New module so associated tests are added showing all
relevant behavior, and passing.

**Documentation:** Updated README and example config

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
garry-cairns and dependabot[bot] authored Nov 2, 2023
commit ae6d36bc4001f539433e6b03fcff365d9489bf4d
27 changes: 27 additions & 0 deletions .chloggen/bounded_duration_sampler.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: processor/tailsampling

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: adds optional upper bound duration for sampling

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [26115]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,4 @@ integration-coverage.html

go.work*

/result
4 changes: 2 additions & 2 deletions processor/tailsamplingprocessor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The following configuration options are required:

Multiple policies exist today and it is straight forward to add more. These include:
- `always_sample`: Sample all traces
- `latency`: Sample based on the duration of the trace. The duration is determined by looking at the earliest start time and latest end time, without taking into consideration what happened in between.
- `latency`: Sample based on the duration of the trace. The duration is determined by looking at the earliest start time and latest end time, without taking into consideration what happened in between. Supplying no upper bound will result in a policy sampling anything greater than `threshold_ms`.
- `numeric_attribute`: Sample based on number attributes (resource and record)
- `probabilistic`: Sample a percentage of traces. Read [a comparison with the Probabilistic Sampling Processor](#probabilistic-sampling-processor-compared-to-the-tail-sampling-processor-with-the-probabilistic-policy).
- `status_code`: Sample based upon the status code (`OK`, `ERROR` or `UNSET`)
Expand Down Expand Up @@ -77,7 +77,7 @@ processors:
{
name: test-policy-2,
type: latency,
latency: {threshold_ms: 5000}
latency: {threshold_ms: 5000, upper_threshold_ms: 10000}
},
{
name: test-policy-3,
Expand Down
2 changes: 1 addition & 1 deletion processor/tailsamplingprocessor/and_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestAndHelper(t *testing.T) {
require.NoError(t, err)

expected := sampling.NewAnd(zap.NewNop(), []sampling.PolicyEvaluator{
sampling.NewLatency(componenttest.NewNopTelemetrySettings(), 100),
sampling.NewLatency(componenttest.NewNopTelemetrySettings(), 100, 0),
})
assert.Equal(t, expected, actual)
})
Expand Down
4 changes: 2 additions & 2 deletions processor/tailsamplingprocessor/composite_helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ func TestCompositeHelper(t *testing.T) {

expected := sampling.NewComposite(zap.NewNop(), 1000, []sampling.SubPolicyEvalParams{
{
Evaluator: sampling.NewLatency(componenttest.NewNopTelemetrySettings(), 100),
Evaluator: sampling.NewLatency(componenttest.NewNopTelemetrySettings(), 100, 0),
MaxSpansPerSecond: 250,
},
{
Evaluator: sampling.NewLatency(componenttest.NewNopTelemetrySettings(), 200),
Evaluator: sampling.NewLatency(componenttest.NewNopTelemetrySettings(), 200, 0),
MaxSpansPerSecond: 500,
},
}, sampling.MonotonicClock{})
Expand Down
6 changes: 5 additions & 1 deletion processor/tailsamplingprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,15 @@ type AndSubPolicyCfg struct {
sharedPolicyCfg `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
}

// TraceStateCfg holds the common configuration for trace states.
type TraceStateCfg struct {
// Tag that the filter is going to be matching against.
Key string `mapstructure:"key"`
// Values indicate the set of values to use when matching against trace_state values.
Values []string `mapstructure:"values"`
}

// AndCfg holds the common configuration to all and policies.
type AndCfg struct {
SubPolicyCfg []AndSubPolicyCfg `mapstructure:"and_sub_policy"`
}
Expand Down Expand Up @@ -126,8 +128,10 @@ type PolicyCfg struct {
// LatencyCfg holds the configurable settings to create a latency filter sampling policy
// evaluator
type LatencyCfg struct {
// ThresholdMs in milliseconds.
// Lower bound in milliseconds. Retaining original name for compatibility
ThresholdMs int64 `mapstructure:"threshold_ms"`
// Upper bound in milliseconds.
UpperThresholdmsMs int64 `mapstructure:"upper_threshold_ms"`
}

// NumericAttributeCfg holds the configurable settings to create a numeric attribute filter
Expand Down
17 changes: 11 additions & 6 deletions processor/tailsamplingprocessor/internal/sampling/latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ import (
)

type latency struct {
logger *zap.Logger
thresholdMs int64
logger *zap.Logger
thresholdMs int64
upperThresholdMs int64
}

var _ PolicyEvaluator = (*latency)(nil)

// NewLatency creates a policy evaluator sampling traces with a duration higher than a configured threshold
func NewLatency(settings component.TelemetrySettings, thresholdMs int64) PolicyEvaluator {
func NewLatency(settings component.TelemetrySettings, thresholdMs int64, upperThresholdMs int64) PolicyEvaluator {
return &latency{
logger: settings.Logger,
thresholdMs: thresholdMs,
logger: settings.Logger,
thresholdMs: thresholdMs,
upperThresholdMs: upperThresholdMs,
}
}

Expand All @@ -47,6 +49,9 @@ func (l *latency) Evaluate(_ context.Context, _ pcommon.TraceID, traceData *Trac
}

duration := maxTime.AsTime().Sub(minTime.AsTime())
return duration.Milliseconds() >= l.thresholdMs
if l.upperThresholdMs == 0 {
return duration.Milliseconds() >= l.thresholdMs
}
return (l.thresholdMs < duration.Milliseconds() && duration.Milliseconds() <= l.upperThresholdMs)
}), nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func TestEvaluate_Latency(t *testing.T) {
filter := NewLatency(componenttest.NewNopTelemetrySettings(), 5000)
filter := NewLatency(componenttest.NewNopTelemetrySettings(), 5000, 0)

traceID := pcommon.TraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})
now := time.Now()
Expand Down Expand Up @@ -71,6 +71,93 @@ func TestEvaluate_Latency(t *testing.T) {
}
}

func TestEvaluate_Bounded_Latency(t *testing.T) {
filter := NewLatency(componenttest.NewNopTelemetrySettings(), 5000, 10000)

traceID := pcommon.TraceID([16]byte{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16})
now := time.Now()

cases := []struct {
Desc string
Spans []spanWithTimeAndDuration
Decision Decision
}{
{
"trace duration shorter than lower bound",
[]spanWithTimeAndDuration{
{
StartTime: now,
Duration: 4500 * time.Millisecond,
},
},
NotSampled,
},
{
"trace duration is equal to lower bound",
[]spanWithTimeAndDuration{
{
StartTime: now,
Duration: 5000 * time.Millisecond,
},
},
NotSampled,
},
{
"trace duration is within lower and upper bounds",
[]spanWithTimeAndDuration{
{
StartTime: now,
Duration: 5001 * time.Millisecond,
},
},
Sampled,
},
{
"trace duration is above upper bound",
[]spanWithTimeAndDuration{
{
StartTime: now,
Duration: 10001 * time.Millisecond,
},
},
NotSampled,
},
{
"trace duration equals upper bound",
[]spanWithTimeAndDuration{
{
StartTime: now,
Duration: 10000 * time.Millisecond,
},
},
Sampled,
},
{
"total trace duration is longer than threshold but every single span is shorter",
[]spanWithTimeAndDuration{
{
StartTime: now,
Duration: 3000 * time.Millisecond,
},
{
StartTime: now.Add(2500 * time.Millisecond),
Duration: 3000 * time.Millisecond,
},
},
Sampled,
},
}

for _, c := range cases {
t.Run(c.Desc, func(t *testing.T) {
decision, err := filter.Evaluate(context.Background(), traceID, newTraceWithSpans(c.Spans))

assert.NoError(t, err)
assert.Equal(t, decision, c.Decision)
})
}
}

type spanWithTimeAndDuration struct {
StartTime time.Time
Duration time.Duration
Expand Down
2 changes: 1 addition & 1 deletion processor/tailsamplingprocessor/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func getSharedPolicyEvaluator(settings component.TelemetrySettings, cfg *sharedP
return sampling.NewAlwaysSample(settings), nil
case Latency:
lfCfg := cfg.LatencyCfg
return sampling.NewLatency(settings, lfCfg.ThresholdMs), nil
return sampling.NewLatency(settings, lfCfg.ThresholdMs, lfCfg.UpperThresholdmsMs), nil
case NumericAttribute:
nafCfg := cfg.NumericAttributeCfg
return sampling.NewNumericAttributeFilter(settings, nafCfg.Key, nafCfg.MinValue, nafCfg.MaxValue, nafCfg.InvertMatch), nil
Expand Down