Skip to content

Commit

Permalink
Merge branch 'main' into tsp-codeowner-portertech
Browse files Browse the repository at this point in the history
  • Loading branch information
portertech authored Jan 17, 2025
2 parents a2ac252 + 20ecaff commit 0769b0b
Show file tree
Hide file tree
Showing 23 changed files with 352 additions and 48 deletions.
27 changes: 27 additions & 0 deletions .chloggen/awss3exporter-sending-queue.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: awss3exporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Implement sending queue for S3 exporter

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

# (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]
28 changes: 28 additions & 0 deletions .chloggen/deprecate_githubgen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Use this changelog template to create an entry for release notes.

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Deprecate githubgen in this repository

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

# (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: |
githubgen has moved to opentelemetry-go-build-tools. Please change your scripts to use this new location.
# 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: []
27 changes: 27 additions & 0 deletions .chloggen/ibraheem_add-gate-for-operation-name-v2.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: 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.EnableOperationAndResourceNameV2. Enabling this gate modifies the logic for computing operation and resource names from OTLP spans to produce shorter, more readable names and improve alignment with OpenTelemetry specifications."

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

# (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: []
1 change: 0 additions & 1 deletion .github/ALLOWLIST
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,3 @@ exporter/kineticaexporter/
exporter/opensearchexporter/
extension/observer/ecstaskobserver/
extension/storage/filestorage/
receiver/jmxreceiver/
8 changes: 4 additions & 4 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ receiver/huaweicloudcesreceiver/ @open-telemetry
receiver/iisreceiver/ @open-telemetry/collector-contrib-approvers @Mrod1598 @pjanotti
receiver/influxdbreceiver/ @open-telemetry/collector-contrib-approvers @jacobmarble
receiver/jaegerreceiver/ @open-telemetry/collector-contrib-approvers @yurishkuro
receiver/jmxreceiver/ @open-telemetry/collector-contrib-approvers @atoulme
receiver/journaldreceiver/ @open-telemetry/collector-contrib-approvers @sumo-drosiek @djaglowski
receiver/k8sclusterreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax @TylerHelmuth @povilasv @ChrsMark
receiver/k8seventsreceiver/ @open-telemetry/collector-contrib-approvers @dmitryax @TylerHelmuth @ChrsMark
Expand Down Expand Up @@ -317,15 +318,14 @@ testbed/mockdatasenders/mockdatadogagentexporter/ @open-telemetry
# List of distribution maintainers for OpenTelemetry Collector Contrib
#
#####################################################
reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers
reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers
reports/distributions/k8s.yaml @open-telemetry/collector-contrib-approvers

reports/distributions/core.yaml @open-telemetry/collector-contrib-approvers
reports/distributions/contrib.yaml @open-telemetry/collector-contrib-approvers
reports/distributions/k8s.yaml @open-telemetry/collector-contrib-approvers

## UNMAINTAINED components

exporter/kineticaexporter/ @open-telemetry/collector-contrib-approvers
exporter/opensearchexporter/ @open-telemetry/collector-contrib-approvers
extension/observer/ecstaskobserver/ @open-telemetry/collector-contrib-approvers
extension/storage/filestorage/ @open-telemetry/collector-contrib-approvers
receiver/jmxreceiver/ @open-telemetry/collector-contrib-approvers
4 changes: 4 additions & 0 deletions cmd/githubgen/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
:warn: This executable has moved to [opentelemetry-go-build-tools](Deprecated: use https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/githubgen).

This code is deprecated and will be removed soon. See https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/37294.

# githubgen

This executable is used to generate the `.github/CODEOWNERS` and `.github/ALLOWLIST` files.
Expand Down
10 changes: 8 additions & 2 deletions cmd/githubgen/codeowners.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ LOOP:
for stability := range m.Status.Stability {
if stability == unmaintainedStatus {
unmaintainedList += key + "/\n"
unmaintainedCodeowners += fmt.Sprintf("%s/%s @open-telemetry/collector-contrib-approvers \n", key, strings.Repeat(" ", data.maxLength-len(key)))
unmaintainedCodeowners += fmt.Sprintf("%s/%s @open-telemetry/collector-contrib-approvers\n", key, strings.Repeat(" ", data.maxLength-len(key)))
continue LOOP
}
if stability == "deprecated" && (m.Status.Codeowners == nil || len(m.Status.Codeowners.Active) == 0) {
Expand Down Expand Up @@ -176,7 +176,13 @@ LOOP:
for _, m := range dist.Maintainers {
maintainers = append(maintainers, fmt.Sprintf("@%s", m))
}
codeowners += fmt.Sprintf("reports/distributions/%s.yaml%s @open-telemetry/collector-contrib-approvers %s\n", dist.Name, strings.Repeat(" ", longestName-len(dist.Name)), strings.Join(maintainers, " "))

distribution := fmt.Sprintf("\nreports/distributions/%s.yaml%s @open-telemetry/collector-contrib-approvers", dist.Name, strings.Repeat(" ", longestName-len(dist.Name)))
if len(maintainers) > 0 {
distribution += fmt.Sprintf(" %s", strings.Join(maintainers, " "))
}

codeowners += distribution
}

err = os.WriteFile(filepath.Join(".github", "CODEOWNERS"), []byte(codeowners+unmaintainedCodeowners), 0o600)
Expand Down
1 change: 1 addition & 0 deletions cmd/githubgen/go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// Deprecated: use https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/githubgen
module github.com/open-telemetry/opentelemetry-collector-contrib/cmd/githubgen

go 1.22.0
Expand Down
1 change: 1 addition & 0 deletions cmd/githubgen/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0

// Deprecated: use https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/githubgen
package main

import (
Expand Down
5 changes: 5 additions & 0 deletions connector/datadogconnector/connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,11 @@ func getTraceAgentCfg(logger *zap.Logger, cfg TracesConfig, attributesTranslator
if datadog.ReceiveResourceSpansV2FeatureGate.IsEnabled() {
acfg.Features["enable_receive_resource_spans_v2"] = struct{}{}
}
if datadog.OperationAndResourceNameV2FeatureGate.IsEnabled() {
acfg.Features["enable_operation_and_resource_name_logic_v2"] = struct{}{}
} else {
logger.Info("Please enable feature gate datadog.EnableOperationAndResourceNameV2 for improved operation and resource name logic. This feature will be enabled by default in the future - if you have Datadog monitors or alerts set on operation/resource names, you may need to migrate them to the new convention.")
}
if v := cfg.BucketInterval; v > 0 {
acfg.BucketInterval = v
}
Expand Down
20 changes: 20 additions & 0 deletions connector/datadogconnector/connector_native_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/connector/connectortest"
"go.opentelemetry.io/collector/consumer/consumertest"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/pdata/ptrace"
semconv "go.opentelemetry.io/collector/semconv/v1.27.0"
"go.uber.org/zap"
Expand Down Expand Up @@ -130,6 +131,18 @@ var (
)

func TestMeasuredAndClientKindNative(t *testing.T) {
t.Run("OperationAndResourceNameV1", func(t *testing.T) {
testMeasuredAndClientKindNative(t, false)
})
t.Run("OperationAndResourceNameV2", func(t *testing.T) {
testMeasuredAndClientKindNative(t, true)
})
}

func testMeasuredAndClientKindNative(t *testing.T, enableOperationAndResourceNameV2 bool) {
if err := featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", enableOperationAndResourceNameV2); err != nil {
t.Fatal(err)
}
cfg := NewFactory().CreateDefaultConfig().(*Config)
cfg.Traces.ComputeTopLevelBySpanKind = true
connector, metricsSink := creteConnectorNativeWithCfg(t, cfg)
Expand Down Expand Up @@ -240,6 +253,13 @@ func TestMeasuredAndClientKindNative(t *testing.T) {
IsTraceRoot: pb.Trilean_TRUE,
},
}

if enableOperationAndResourceNameV2 {
expected[0].Name = "Internal"
expected[1].Name = "client.request"
expected[2].Name = "server.request"
}

if diff := cmp.Diff(
cgss,
expected,
Expand Down
60 changes: 60 additions & 0 deletions connector/datadogconnector/connector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,66 @@ func testReceiveResourceSpansV2(t *testing.T, enableReceiveResourceSpansV2 bool)
}
}

func TestOperationAndResourceNameV2(t *testing.T) {
t.Run("OperationAndResourceNameV1", func(t *testing.T) {
testOperationAndResourceNameV2(t, false)
})
t.Run("OperationAndResourceNameV2", func(t *testing.T) {
testOperationAndResourceNameV2(t, true)
})
}

func testOperationAndResourceNameV2(t *testing.T, enableOperationAndResourceNameV2 bool) {
if err := featuregate.GlobalRegistry().Set("datadog.EnableOperationAndResourceNameV2", enableOperationAndResourceNameV2); 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()
rspan := trace.ResourceSpans().At(0)
rspan.Resource().Attributes().PutStr("deployment.environment.name", "new_env")
rspan.ScopeSpans().At(0).Spans().At(0).SetKind(ptrace.SpanKindServer)

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)

gotName := sp.Stats[0].Stats[0].Stats[0].Name
if enableOperationAndResourceNameV2 {
assert.Equal(t, "server.request", gotName)
} else {
assert.Equal(t, "opentelemetry.server", gotName)
}
}

func newTranslatorWithStatsChannel(t *testing.T, logger *zap.Logger, ch chan []byte) *otlpmetrics.Translator {
options := []otlpmetrics.TranslatorOption{
otlpmetrics.WithHistogramMode(otlpmetrics.HistogramModeDistributions),
Expand Down
35 changes: 21 additions & 14 deletions exporter/awss3exporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,22 @@ This exporter targets to support proto/json format.

The following exporter configuration parameters are supported.

| Name | Description | Default |
|:----------------------|:-------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| `region` | AWS region. | "us-east-1" |
| `s3_bucket` | S3 bucket | |
| `s3_prefix` | prefix for the S3 key (root directory inside bucket). | |
| `s3_partition` | time granularity of S3 key: hour or minute | "minute" |
| `role_arn` | the Role ARN to be assumed | |
| `file_prefix` | file prefix defined by user | |
| `marshaler` | marshaler used to produce output data | `otlp_json` |
| `encoding` | Encoding extension to use to marshal data. Overrides the `marshaler` configuration option if set. | |
| Name | Description | Default |
|:--------------------------|:-------------------------------------------------------------------------------------------------------------------------------------------|-------------|
| `region` | AWS region. | "us-east-1" |
| `s3_bucket` | S3 bucket | |
| `s3_prefix` | prefix for the S3 key (root directory inside bucket). | |
| `s3_partition` | time granularity of S3 key: hour or minute | "minute" |
| `role_arn` | the Role ARN to be assumed | |
| `file_prefix` | file prefix defined by user | |
| `marshaler` | marshaler used to produce output data | `otlp_json` |
| `encoding` | Encoding extension to use to marshal data. Overrides the `marshaler` configuration option if set. | |
| `encoding_file_extension` | file format extension suffix when using the `encoding` configuration option. May be left empty for no suffix to be appended. | |
| `endpoint` | (REST API endpoint) overrides the endpoint used by the exporter instead of constructing it from `region` and `s3_bucket` | |
| `s3_force_path_style` | [set this to `true` to force the request to use path-style addressing](http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html) | false |
| `disable_ssl` | set this to `true` to disable SSL when sending requests | false |
| `compression` | should the file be compressed | none |
| `endpoint` | (REST API endpoint) overrides the endpoint used by the exporter instead of constructing it from `region` and `s3_bucket` | |
| `s3_force_path_style` | [set this to `true` to force the request to use path-style addressing](http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html) | false |
| `disable_ssl` | set this to `true` to disable SSL when sending requests | false |
| `compression` | should the file be compressed | none |
| `sending_queue` | [exporters common queuing](https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/exporterhelper/README.md) | disabled |

### Marshaler

Expand Down Expand Up @@ -68,6 +69,12 @@ exporters:
s3_bucket: 'databucket'
s3_prefix: 'metric'
s3_partition: 'minute'

# Optional (disabled by default)
sending_queue:
enabled: true
num_consumers: 10
queue_size: 100
```
Logs and traces will be stored inside 'databucket' in the following path format.
Expand Down
3 changes: 3 additions & 0 deletions exporter/awss3exporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (

"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configcompression"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.uber.org/multierr"
)

Expand Down Expand Up @@ -49,6 +50,8 @@ const (

// Config contains the main configuration options for the s3 exporter
type Config struct {
QueueSettings exporterhelper.QueueConfig `mapstructure:"sending_queue"`

S3Uploader S3UploaderConfig `mapstructure:"s3uploader"`
MarshalerName MarshalerType `mapstructure:"marshaler"`

Expand Down
Loading

0 comments on commit 0769b0b

Please sign in to comment.