Skip to content

Commit

Permalink
Merge branch 'main' into internal-to-pkg-idutils
Browse files Browse the repository at this point in the history
  • Loading branch information
odubajDT authored Jan 16, 2025
2 parents 2d59986 + 0788185 commit f1da8ae
Show file tree
Hide file tree
Showing 52 changed files with 1,556 additions and 817 deletions.
14 changes: 14 additions & 0 deletions .chloggen/add-feature-flag-for-updated-datadog-span-receiver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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: datadogexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: "Add a feature gate datadog.EnableReceiveResourceSpansV2. Enabling this gate uses a refactored implementation of OTLP->Datadog Span translation in datadogexporter and datadogconnector which improves performance by 10%, and deprecates the following functionality:
- No longer checks for resource-related values (container, env, hostname) in span attributes. This previous behavior did not follow the OTel spec."

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [37171]
27 changes: 27 additions & 0 deletions .chloggen/eks_cloud_account_id.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: resourcedetectionprocessor

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: This enhancement detects AWS EKS cloud account ID

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

# (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]
27 changes: 27 additions & 0 deletions .chloggen/elasticsearchexporter_optimized-json-encoding.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: elasticsearchexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: More efficient JSON encoding for OTel mode

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

# (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: Increases throughput for metrics by 2x and for logs and traces by 3x

# 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]
27 changes: 27 additions & 0 deletions .chloggen/fg_filelog_stable.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: breaking

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Move `filelog.container.removeOriginalTimeField` feature gate to stable

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

# (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]
6 changes: 3 additions & 3 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ confmap/provider/s3provider/ @open-telemetry/collector-cont
confmap/provider/secretsmanagerprovider/ @open-telemetry/collector-contrib-approvers @driverpt @atoulme

connector/countconnector/ @open-telemetry/collector-contrib-approvers @djaglowski @jpkrohling
connector/datadogconnector/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @ankitpatel96 @jade-guiton-dd
connector/datadogconnector/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @ankitpatel96 @jade-guiton-dd @IbraheemA
connector/exceptionsconnector/ @open-telemetry/collector-contrib-approvers @marctc
connector/failoverconnector/ @open-telemetry/collector-contrib-approvers @akats7 @fatsheep9146
connector/grafanacloudconnector/ @open-telemetry/collector-contrib-approvers @rlankfo @jcreixell
Expand Down Expand Up @@ -54,7 +54,7 @@ exporter/carbonexporter/ @open-telemetry/collector-cont
exporter/cassandraexporter/ @open-telemetry/collector-contrib-approvers @atoulme @emreyalvac
exporter/clickhouseexporter/ @open-telemetry/collector-contrib-approvers @hanjm @dmitryax @Frapschen @SpencerTorres
exporter/coralogixexporter/ @open-telemetry/collector-contrib-approvers @povilasv
exporter/datadogexporter/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd
exporter/datadogexporter/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd @IbraheemA
exporter/datasetexporter/ @open-telemetry/collector-contrib-approvers @atoulme @martin-majlis-s1 @zdaratom-s1 @tomaz-s1
exporter/dorisexporter/ @open-telemetry/collector-contrib-approvers @atoulme @joker-star-l
exporter/elasticsearchexporter/ @open-telemetry/collector-contrib-approvers @JaredTan95 @carsonip @lahsivjar
Expand Down Expand Up @@ -147,7 +147,7 @@ internal/tools/ @open-telemetry/collector-cont
pkg/batchperresourceattr/ @open-telemetry/collector-contrib-approvers @atoulme @dmitryax
pkg/batchpersignal/ @open-telemetry/collector-contrib-approvers @jpkrohling
pkg/core/xidutils/ @open-telemetry/collector-contrib-approvers @odubajDT
pkg/datadog/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd
pkg/datadog/ @open-telemetry/collector-contrib-approvers @mx-psi @dineshg13 @liustanley @songy23 @mackjmr @ankitpatel96 @jade-guiton-dd @IbraheemA
pkg/experimentalmetricmetadata/ @open-telemetry/collector-contrib-approvers @dmitryax
pkg/golden/ @open-telemetry/collector-contrib-approvers @djaglowski @atoulme
pkg/kafka/topic/ @open-telemetry/collector-contrib-approvers @pavolloffay @MovieStoreGuy
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/check-merge-freeze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Merge freeze

on:
pull_request:
types:
- opened
- ready_for_review
- synchronize
- reopened
- labeled
- unlabeled
- enqueued
branches: [main]
merge_group:
types: [checks_requested]

permissions: read-all

jobs:
check-merge-freeze:
name: Check
# This condition is to avoid blocking the PR causing the freeze in the first place.
if: |
(!startsWith(github.event.pull_request.title || github.event.merge_group.head_commit.message, '[chore] Prepare release')) ||
(!(github.event.pull_request.user.login == 'opentelemetrybot' || github.event.merge_group.head_commit.author.name == 'OpenTelemetry Bot'))
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
sparse-checkout: .github/workflows/scripts
- run: ./.github/workflows/scripts/check-merge-freeze.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO: open-telemetry/opentelemetry-collector-contrib
11 changes: 11 additions & 0 deletions .github/workflows/scripts/check-merge-freeze.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash -e
#
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

BLOCKERS=$( gh pr list -A opentelemetrybot -S "[chore] Prepare release" --json url -q '.[].url' -R "${REPO}" )
if [ "${BLOCKERS}" != "" ]; then
echo "Merging in main is frozen, as there are open \"Prepare release\" PRs: ${BLOCKERS}"
echo "If you believe this is no longer true, re-run this job to unblock your PR."
exit 1
fi
2 changes: 2 additions & 0 deletions cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -510,3 +510,5 @@ replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/pkg/status => ../../pkg/status
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awss3receiver => ../../receiver/awss3receiver
- github.com/open-telemetry/opentelemetry-collector-contrib/exporter/dorisexporter => ../../exporter/dorisexporter
- github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage/redisstorageextension => ../../extension/storage/redisstorageextension
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/huaweicloudcesreceiver => ../../receiver/huaweicloudcesreceiver
2 changes: 1 addition & 1 deletion connector/datadogconnector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
| ------------- |-----------|
| Distributions | [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aconnector%2Fdatadog%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aconnector%2Fdatadog) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aconnector%2Fdatadog%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aconnector%2Fdatadog) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd), [@IbraheemA](https://www.github.com/IbraheemA) |
| Emeritus | [@gbbr](https://www.github.com/gbbr) |

[beta]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#beta
Expand Down
5 changes: 5 additions & 0 deletions connector/datadogconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import (
semconv "go.opentelemetry.io/collector/semconv/v1.27.0"
"go.opentelemetry.io/otel/metric/noop"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog"
)

// traceToMetricConnector is the schema for connector
Expand Down Expand Up @@ -117,6 +119,9 @@ func getTraceAgentCfg(logger *zap.Logger, cfg TracesConfig, attributesTranslator
logger.Info("traces::compute_top_level_by_span_kind needs to be enabled in both the Datadog connector and Datadog exporter configs if both components are being used")
acfg.Features["enable_otlp_compute_top_level_by_span_kind"] = struct{}{}
}
if datadog.ReceiveResourceSpansV2FeatureGate.IsEnabled() {
acfg.Features["enable_receive_resource_spans_v2"] = struct{}{}
}
if v := cfg.BucketInterval; v > 0 {
acfg.BucketInterval = v
}
Expand Down
61 changes: 61 additions & 0 deletions connector/datadogconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,67 @@ func TestContainerTags(t *testing.T) {
assert.ElementsMatch(t, []string{"region:my-region", "zone:my-zone", "az:my-az"}, tags)
}

func TestReceiveResourceSpansV2(t *testing.T) {
t.Run("ReceiveResourceSpansV1", func(t *testing.T) {
testReceiveResourceSpansV2(t, false)
})
t.Run("ReceiveResourceSpansV2", func(t *testing.T) {
testReceiveResourceSpansV2(t, true)
})
}

func testReceiveResourceSpansV2(t *testing.T, enableReceiveResourceSpansV2 bool) {
if enableReceiveResourceSpansV2 {
if err := featuregate.GlobalRegistry().Set("datadog.EnableReceiveResourceSpansV2", true); err != nil {
t.Fatal(err)
}
}
connector, metricsSink := creteConnector(t)
err := connector.Start(context.Background(), componenttest.NewNopHost())
if err != nil {
t.Errorf("Error starting connector: %v", err)
return
}
defer func() {
_ = connector.Shutdown(context.Background())
}()

trace := generateTrace()
sattr := trace.ResourceSpans().At(0).ScopeSpans().At(0).Spans().At(0).Attributes()

sattr.PutStr("deployment.environment.name", "do-not-use")

err = connector.ConsumeTraces(context.Background(), trace)
assert.NoError(t, err)

for {
if len(metricsSink.AllMetrics()) > 0 {
break
}
time.Sleep(100 * time.Millisecond)
}

// check if the container tags are added to the metrics
metrics := metricsSink.AllMetrics()
assert.Len(t, metrics, 1)

ch := make(chan []byte, 100)
tr := newTranslatorWithStatsChannel(t, zap.NewNop(), ch)
_, err = tr.MapMetrics(context.Background(), metrics[0], nil)
require.NoError(t, err)
msg := <-ch
sp := &pb.StatsPayload{}

err = proto.Unmarshal(msg, sp)
require.NoError(t, err)

if enableReceiveResourceSpansV2 {
assert.Equal(t, "none", sp.Stats[0].Env)
} else {
assert.Equal(t, "do-not-use", sp.Stats[0].Env)
}
}

func newTranslatorWithStatsChannel(t *testing.T, logger *zap.Logger, ch chan []byte) *otlpmetrics.Translator {
options := []otlpmetrics.TranslatorOption{
otlpmetrics.WithHistogramMode(otlpmetrics.HistogramModeDistributions),
Expand Down
4 changes: 2 additions & 2 deletions connector/datadogconnector/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ status:
beta: [traces_to_metrics, traces_to_traces]
distributions: [contrib]
codeowners:
active: [mx-psi, dineshg13, ankitpatel96, jade-guiton-dd]
active: [mx-psi, dineshg13, ankitpatel96, jade-guiton-dd, IbraheemA]
emeritus: [gbbr]

tests:
goleak:
skip: true
skip: true
2 changes: 1 addition & 1 deletion exporter/datadogexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
| Stability | [beta]: traces, metrics, logs |
| Distributions | [contrib] |
| Issues | [![Open issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aopen%20label%3Aexporter%2Fdatadog%20&label=open&color=orange&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aopen+is%3Aissue+label%3Aexporter%2Fdatadog) [![Closed issues](https://img.shields.io/github/issues-search/open-telemetry/opentelemetry-collector-contrib?query=is%3Aissue%20is%3Aclosed%20label%3Aexporter%2Fdatadog%20&label=closed&color=blue&logo=opentelemetry)](https://github.com/open-telemetry/opentelemetry-collector-contrib/issues?q=is%3Aclosed+is%3Aissue+label%3Aexporter%2Fdatadog) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@liustanley](https://www.github.com/liustanley), [@songy23](https://www.github.com/songy23), [@mackjmr](https://www.github.com/mackjmr), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd) |
| [Code Owners](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/CONTRIBUTING.md#becoming-a-code-owner) | [@mx-psi](https://www.github.com/mx-psi), [@dineshg13](https://www.github.com/dineshg13), [@liustanley](https://www.github.com/liustanley), [@songy23](https://www.github.com/songy23), [@mackjmr](https://www.github.com/mackjmr), [@ankitpatel96](https://www.github.com/ankitpatel96), [@jade-guiton-dd](https://www.github.com/jade-guiton-dd), [@IbraheemA](https://www.github.com/IbraheemA) |
| Emeritus | [@gbbr](https://www.github.com/gbbr) |

[beta]: https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/component-stability.md#beta
Expand Down
4 changes: 2 additions & 2 deletions exporter/datadogexporter/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ status:
beta: [traces, metrics, logs]
distributions: [contrib]
codeowners:
active: [mx-psi, dineshg13, liustanley, songy23, mackjmr, ankitpatel96, jade-guiton-dd]
active: [mx-psi, dineshg13, liustanley, songy23, mackjmr, ankitpatel96, jade-guiton-dd, IbraheemA]
emeritus: [gbbr]

tests:
Expand All @@ -22,4 +22,4 @@ tests:
expect_consumer_error: true
goleak:
setup: "setupTestMain(m)"
skip: true
skip: true
4 changes: 4 additions & 0 deletions exporter/datadogexporter/traces_exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/hostmetadata"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/metrics"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter/internal/scrub"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/datadog"
)

var traceCustomHTTPFeatureGate = featuregate.GlobalRegistry().MustRegister(
Expand Down Expand Up @@ -238,6 +239,9 @@ func newTraceAgentConfig(ctx context.Context, params exporter.Settings, cfg *Con
if cfg.Traces.ComputeTopLevelBySpanKind {
acfg.Features["enable_otlp_compute_top_level_by_span_kind"] = struct{}{}
}
if datadog.ReceiveResourceSpansV2FeatureGate.IsEnabled() {
acfg.Features["enable_receive_resource_spans_v2"] = struct{}{}
}
tracelog.SetLogger(&zaplogger{params.Logger}) // TODO: This shouldn't be a singleton
return acfg, nil
}
Loading

0 comments on commit f1da8ae

Please sign in to comment.