Skip to content

Commit 3b28f9d

Browse files
authored
Merge branch 'main' into main
2 parents eab1dd4 + 75b85b6 commit 3b28f9d

32 files changed

+1399
-512
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: metricstransformprocessor
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Fix aggregation of exponential histograms in metricstransform processor.
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [39143]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: Fix a panic when the number of populated buckets varies, and fix summing of counts for the Zero bucket.
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

.chloggen/fix-servicegraph-bug.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: bug_fix
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
7+
component: servicegraphconnector
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: Fix collectClientLatencyMetrics method bug
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [39184]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: [user]

.github/auto_assign.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ useAssigneeGroups: true
1111
assigneeGroups:
1212
approvers_maintainers:
1313
# Approvers
14-
# - ChrsMark on leave
14+
- ArthurSens
15+
- ChrsMark
1516
- crobert-1
1617
# - dashpole on leave
1718
- dehaansa
1819
- edmocosta
1920
- mwear
20-
- songy23
2121
- fatsheep9146
2222
# Maintainers
2323
- andrzej-stencel
@@ -30,6 +30,7 @@ assigneeGroups:
3030
- jpkrohling
3131
- MovieStoreGuy
3232
- mx-psi
33+
- songy23
3334
- TylerHelmuth
3435

3536
# A number of assignees added to the pull request

cmd/telemetrygen/pkg/logs/logs.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -153,27 +153,27 @@ func parseSeverity(severityText string, severityNumber int32) (string, log.Sever
153153
// severity number should match well-known severityText
154154
switch severityText {
155155
case plog.SeverityNumberTrace.String():
156-
if !(severityNumber >= 1 && severityNumber <= 4) {
156+
if severityNumber < 1 || severityNumber > 4 {
157157
return "", 0, fmt.Errorf("severity text %q does not match severity number %d, the valid range is [1,4]", severityText, severityNumber)
158158
}
159159
case plog.SeverityNumberDebug.String():
160-
if !(severityNumber >= 5 && severityNumber <= 8) {
160+
if severityNumber < 5 || severityNumber > 8 {
161161
return "", 0, fmt.Errorf("severity text %q does not match severity number %d, the valid range is [5,8]", severityText, severityNumber)
162162
}
163163
case plog.SeverityNumberInfo.String():
164-
if !(severityNumber >= 9 && severityNumber <= 12) {
164+
if severityNumber < 9 || severityNumber > 12 {
165165
return "", 0, fmt.Errorf("severity text %q does not match severity number %d, the valid range is [9,12]", severityText, severityNumber)
166166
}
167167
case plog.SeverityNumberWarn.String():
168-
if !(severityNumber >= 13 && severityNumber <= 16) {
168+
if severityNumber < 13 || severityNumber > 16 {
169169
return "", 0, fmt.Errorf("severity text %q does not match severity number %d, the valid range is [13,16]", severityText, severityNumber)
170170
}
171171
case plog.SeverityNumberError.String():
172-
if !(severityNumber >= 17 && severityNumber <= 20) {
172+
if severityNumber < 17 || severityNumber > 20 {
173173
return "", 0, fmt.Errorf("severity text %q does not match severity number %d, the valid range is [17,20]", severityText, severityNumber)
174174
}
175175
case plog.SeverityNumberFatal.String():
176-
if !(severityNumber >= 21 && severityNumber <= 24) {
176+
if severityNumber < 21 || severityNumber > 24 {
177177
return "", 0, fmt.Errorf("severity text %q does not match severity number %d, the valid range is [21,24]", severityText, severityNumber)
178178
}
179179
}

connector/servicegraphconnector/connector.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ func (p *serviceGraphConnector) collectLatencyMetrics(ilm pmetric.ScopeMetrics)
546546
}
547547

548548
func (p *serviceGraphConnector) collectClientLatencyMetrics(ilm pmetric.ScopeMetrics) error {
549-
if len(p.reqServerDurationSecondsCount) > 0 {
549+
if len(p.reqClientDurationSecondsCount) > 0 {
550550
mDuration := ilm.Metrics().AppendEmpty()
551551
mDuration.SetName("traces_service_graph_request_client")
552552
mDuration.SetUnit(secondsUnit)
@@ -557,7 +557,7 @@ func (p *serviceGraphConnector) collectClientLatencyMetrics(ilm pmetric.ScopeMet
557557
mDuration.SetEmptyHistogram().SetAggregationTemporality(pmetric.AggregationTemporalityCumulative)
558558
timestamp := pcommon.NewTimestampFromTime(time.Now())
559559

560-
for key := range p.reqServerDurationSecondsCount {
560+
for key := range p.reqClientDurationSecondsCount {
561561
dpDuration := mDuration.Histogram().DataPoints().AppendEmpty()
562562
dpDuration.SetStartTimestamp(pcommon.NewTimestampFromTime(p.startTime))
563563
dpDuration.SetTimestamp(timestamp)

exporter/datadogexporter/factory.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func (f *factory) createMetricsExporter(
319319
// Start the hostmetadata pusher once.
320320
// It sends the hostmetadata for the host where the collector is running.
321321
if cfg.HostMetadata.Enabled {
322-
if cfg.HostMetadata.HostnameSource == datadogconfig.HostnameSourceFirstResource { //nolint:staticcheck
322+
if cfg.HostMetadata.HostnameSource == datadogconfig.HostnameSourceFirstResource {
323323
set.Logger.Warn("first_resource has no effect when serializer exporter is used for exporting metrics")
324324
}
325325
f.onceMetadata.Do(func() {

exporter/datadogexporter/hostmetadata.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func newMetadataConfigfromConfig(cfg *datadogconfig.Config) hostmetadata.PusherC
1515
ConfigTags: cfg.HostMetadata.Tags,
1616
MetricsEndpoint: cfg.Metrics.Endpoint,
1717
APIKey: string(cfg.API.Key),
18-
UseResourceMetadata: cfg.HostMetadata.HostnameSource == datadogconfig.HostnameSourceFirstResource, //nolint:staticcheck
18+
UseResourceMetadata: cfg.HostMetadata.HostnameSource == datadogconfig.HostnameSourceFirstResource,
1919
InsecureSkipVerify: cfg.TLSSetting.InsecureSkipVerify,
2020
ClientConfig: cfg.ClientConfig,
2121
RetrySettings: cfg.BackOffConfig,

internal/coreinternal/aggregateutil/aggregate.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,31 @@ func mergeExponentialHistogramDataPoints(dpsMap map[string]pmetric.ExponentialHi
296296
}
297297
dp.SetCount(dp.Count() + dps.At(i).Count())
298298
dp.SetSum(dp.Sum() + dps.At(i).Sum())
299+
dp.SetZeroCount(dp.ZeroCount() + dps.At(i).ZeroCount())
299300
if dp.HasMin() && dp.Min() > dps.At(i).Min() {
300301
dp.SetMin(dps.At(i).Min())
301302
}
302303
if dp.HasMax() && dp.Max() < dps.At(i).Max() {
303304
dp.SetMax(dps.At(i).Max())
304305
}
306+
// Merge bucket counts.
307+
// Note that groupExponentialHistogramDataPoints() has already ensured that we only try
308+
// to merge exponential histograms with matching Scale and Positive/Negative Offsets,
309+
// so the corresponding array items in BucketCounts have the same bucket boundaries.
310+
// However, the number of buckets may differ depending on what values have been observed.
305311
for b := 0; b < dps.At(i).Negative().BucketCounts().Len(); b++ {
306-
negatives.SetAt(b, negatives.At(b)+dps.At(i).Negative().BucketCounts().At(b))
312+
if b < negatives.Len() {
313+
negatives.SetAt(b, negatives.At(b)+dps.At(i).Negative().BucketCounts().At(b))
314+
} else {
315+
negatives.Append(dps.At(i).Negative().BucketCounts().At(b))
316+
}
307317
}
308318
for b := 0; b < dps.At(i).Positive().BucketCounts().Len(); b++ {
309-
positives.SetAt(b, positives.At(b)+dps.At(i).Positive().BucketCounts().At(b))
319+
if b < positives.Len() {
320+
positives.SetAt(b, positives.At(b)+dps.At(i).Positive().BucketCounts().At(b))
321+
} else {
322+
positives.Append(dps.At(i).Positive().BucketCounts().At(b))
323+
}
310324
}
311325
dps.At(i).Exemplars().MoveAndAppendTo(dp.Exemplars())
312326
if dps.At(i).StartTimestamp() < dp.StartTimestamp() {

internal/coreinternal/aggregateutil/aggregate_test.go

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,10 @@ func Test_GroupDataPoints(t *testing.T) {
365365
d := s.DataPoints().AppendEmpty()
366366
d.SetTimestamp(pcommon.NewTimestampFromTime(time.Time{}))
367367
d.Attributes().PutStr("attr1", "val1")
368-
d.SetCount(1)
368+
d.SetCount(9)
369+
d.SetZeroCount(2)
370+
d.Positive().BucketCounts().Append(0, 1, 2, 3)
371+
d.Negative().BucketCounts().Append(0, 1)
369372
return m
370373
},
371374
want: AggGroups{
@@ -483,8 +486,11 @@ func Test_MergeDataPoints(t *testing.T) {
483486
s := m.SetEmptyExponentialHistogram()
484487
d := s.DataPoints().AppendEmpty()
485488
d.Attributes().PutStr("attr1", "val1")
486-
d.SetCount(3)
489+
d.SetCount(16)
487490
d.SetSum(0)
491+
d.SetZeroCount(3)
492+
d.Positive().BucketCounts().Append(0, 2, 4, 3)
493+
d.Negative().BucketCounts().Append(0, 2, 2)
488494
return m
489495
},
490496
in: func() pmetric.Metric {
@@ -547,18 +553,34 @@ func testDataExpHistogram() pmetric.ExponentialHistogramDataPointSlice {
547553
data := pmetric.NewExponentialHistogramDataPointSlice()
548554
d := data.AppendEmpty()
549555
d.Attributes().PutStr("attr1", "val1")
550-
d.SetCount(2)
556+
d.SetCount(7)
557+
d.SetZeroCount(1)
558+
d.Positive().BucketCounts().Append(0, 1, 2)
559+
d.Negative().BucketCounts().Append(0, 1, 2)
551560
return data
552561
}
553562

554563
func testDataExpHistogramDouble() pmetric.ExponentialHistogramDataPointSlice {
555564
dataWant := pmetric.NewExponentialHistogramDataPointSlice()
565+
556566
dWant := dataWant.AppendEmpty()
557567
dWant.Attributes().PutStr("attr1", "val1")
558-
dWant.SetCount(2)
568+
dWant.SetCount(7)
569+
dWant.SetZeroCount(1)
570+
dWant.Positive().BucketCounts().Append(0, 1, 2)
571+
dWant.Negative().BucketCounts().Append(0, 1, 2)
572+
559573
dWant2 := dataWant.AppendEmpty()
560574
dWant2.SetTimestamp(pcommon.NewTimestampFromTime(time.Time{}))
561575
dWant2.Attributes().PutStr("attr1", "val1")
562-
dWant2.SetCount(1)
576+
dWant2.SetCount(9)
577+
dWant2.SetZeroCount(2)
578+
// Use a larger number of buckets than above to check that we expand the
579+
// destination array as needed while merging.
580+
dWant2.Positive().BucketCounts().Append(0, 1, 2, 3)
581+
// Use a smaller number of buckets than above to check that we merge values
582+
// into the correct, existing buckets.
583+
dWant2.Negative().BucketCounts().Append(0, 1)
584+
563585
return dataWant
564586
}

pkg/datadog/config/host.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ import (
1313
type HostnameSource string
1414

1515
const (
16-
// Deprecated: [v0.124.0] opt in to https://docs.datadoghq.com/opentelemetry/mapping/host_metadata/ instead
17-
//
1816
// HostnameSourceFirstResource picks the host metadata hostname from the resource
1917
// attributes on the first OTLP payload that gets to the exporter. If it is lacking any
2018
// hostname-like attributes, it will fallback to 'config_or_system' behavior (see below).

pkg/translator/azurelogs/go.mod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ go 1.23.0
44

55
require (
66
github.com/json-iterator/go v1.1.12
7+
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/golden v0.123.0
78
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatatest v0.123.0
89
github.com/relvacode/iso8601 v1.6.0
910
github.com/stretchr/testify v1.10.0

0 commit comments

Comments
 (0)