Skip to content

Commit

Permalink
Merge branch 'main' into feat/export-telemetrygen-funcs-for-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Erog38 authored Jan 23, 2025
2 parents d5ad86b + 4542bbf commit b2b10fa
Show file tree
Hide file tree
Showing 64 changed files with 1,956 additions and 54 deletions.
27 changes: 27 additions & 0 deletions .chloggen/anvoy-als-receiver.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: new_component

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add a new receiver for the Envoy ALS (Access Log Service).

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

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Add config `logs_dynamic_id` to dynamically set the document ID of log records using log record attribute `elasticsearch.document_id`

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

# (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/expo-histogram-fix-downscaling.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: bug_fix

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

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: In order to cap number of histogram buckets take the min of desired scale across negative and positive buckets instead of the max

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

# (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: []
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ exporter/sapmexporter/ @open-telemetry
exporter/sentryexporter/ @open-telemetry/collector-contrib-approvers @AbhiPrasad
exporter/signalfxexporter/ @open-telemetry/collector-contrib-approvers @dmitryax @crobert-1
exporter/splunkhecexporter/ @open-telemetry/collector-contrib-approvers @atoulme @dmitryax
exporter/stefexporter/ @open-telemetry/collector-contrib-approvers @tigrannajaryan @dmitryax
exporter/sumologicexporter/ @open-telemetry/collector-contrib-approvers @rnishtala-sumo @chan-tim-sumo
exporter/syslogexporter/ @open-telemetry/collector-contrib-approvers @kasia-kujawa @rnishtala-sumo @andrzej-stencel
exporter/tencentcloudlogserviceexporter/ @open-telemetry/collector-contrib-approvers @wgliang
Expand Down Expand Up @@ -221,6 +222,7 @@ receiver/couchdbreceiver/ @open-telemetry
receiver/datadogreceiver/ @open-telemetry/collector-contrib-approvers @boostchicken @gouthamve @MovieStoreGuy
receiver/dockerstatsreceiver/ @open-telemetry/collector-contrib-approvers @jamesmoessis
receiver/elasticsearchreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski
receiver/envoyalsreceiver/ @open-telemetry/collector-contrib-approvers @evan-bradley
receiver/expvarreceiver/ @open-telemetry/collector-contrib-approvers @jamesmoessis @MovieStoreGuy
receiver/filelogreceiver/ @open-telemetry/collector-contrib-approvers @djaglowski
receiver/filestatsreceiver/ @open-telemetry/collector-contrib-approvers @atoulme
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ body:
- exporter/sentry
- exporter/signalfx
- exporter/splunkhec
- exporter/stef
- exporter/sumologic
- exporter/syslog
- exporter/tencentcloudlogservice
Expand Down Expand Up @@ -219,6 +220,7 @@ body:
- receiver/datadog
- receiver/dockerstats
- receiver/elasticsearch
- receiver/envoyals
- receiver/expvar
- receiver/filelog
- receiver/filestats
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ body:
- exporter/sentry
- exporter/signalfx
- exporter/splunkhec
- exporter/stef
- exporter/sumologic
- exporter/syslog
- exporter/tencentcloudlogservice
Expand Down Expand Up @@ -213,6 +214,7 @@ body:
- receiver/datadog
- receiver/dockerstats
- receiver/elasticsearch
- receiver/envoyals
- receiver/expvar
- receiver/filelog
- receiver/filestats
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/other.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ body:
- exporter/sentry
- exporter/signalfx
- exporter/splunkhec
- exporter/stef
- exporter/sumologic
- exporter/syslog
- exporter/tencentcloudlogservice
Expand Down Expand Up @@ -213,6 +214,7 @@ body:
- receiver/datadog
- receiver/dockerstats
- receiver/elasticsearch
- receiver/envoyals
- receiver/expvar
- receiver/filelog
- receiver/filestats
Expand Down
2 changes: 2 additions & 0 deletions .github/ISSUE_TEMPLATE/unmaintained.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ body:
- exporter/sentry
- exporter/signalfx
- exporter/splunkhec
- exporter/stef
- exporter/sumologic
- exporter/syslog
- exporter/tencentcloudlogservice
Expand Down Expand Up @@ -218,6 +219,7 @@ body:
- receiver/datadog
- receiver/dockerstats
- receiver/elasticsearch
- receiver/envoyals
- receiver/expvar
- receiver/filelog
- receiver/filestats
Expand Down
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ update-otel:$(MULTIMOD)
$(MAKE) genoteltestbedcol
$(MAKE) generate
$(MAKE) crosslink
# Tidy again after generating code
$(MAKE) gotidy
$(MAKE) remove-toolchain
git add . && git commit -s -m "[chore] mod and toolchain tidy" ; \

Expand Down
1 change: 1 addition & 0 deletions cmd/otelcontribcol/builder-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ replaces:
- github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil => ../../internal/aws/ecsutil
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/rabbitmqreceiver => ../../receiver/rabbitmqreceiver
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/elasticsearchreceiver => ../../receiver/elasticsearchreceiver
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/envoyalsreceiver => ../../receiver/envoyalsreceiver
- github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricsgenerationprocessor => ../../processor/metricsgenerationprocessor
- github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor => ../../processor/attributesprocessor
- github.com/open-telemetry/opentelemetry-collector-contrib/receiver/sqlqueryreceiver => ../../receiver/sqlqueryreceiver
Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/integrationtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/DataDog/datadog-agent/pkg/proto v0.63.0-devel
github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor v0.118.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.118.0
github.com/stretchr/testify v1.10.0
Expand Down Expand Up @@ -254,7 +255,6 @@ require (
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.118.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.118.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.118.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.118.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.118.0 // indirect
Expand Down
32 changes: 23 additions & 9 deletions exporter/datadogexporter/integrationtest/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (

"github.com/open-telemetry/opentelemetry-collector-contrib/connector/datadogconnector"
"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/datadogexporter"
commonTestutil "github.com/open-telemetry/opentelemetry-collector-contrib/internal/common/testutil"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/tailsamplingprocessor"
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver"
)
Expand Down Expand Up @@ -92,6 +93,10 @@ func testIntegration(t *testing.T) {
server := testutil.DatadogServerMock(apmstatsRec.HandlerFunc, tracesRec.HandlerFunc)
defer server.Close()
t.Setenv("SERVER_URL", server.URL)
t.Setenv("PROM_SERVER", commonTestutil.GetAvailableLocalAddress(t))
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)

// 2. Start in-process collector
factories := getIntegrationTestComponents(t)
Expand All @@ -104,7 +109,7 @@ func testIntegration(t *testing.T) {
waitForReadiness(app)

// 3. Generate and send traces
sendTraces(t)
sendTraces(t, otlpGRPCEndpoint)

// 4. Validate traces and APM stats from the mock server
var spans []*pb.Span
Expand Down Expand Up @@ -223,11 +228,11 @@ func waitForReadiness(app *otelcol.Collector) {
}
}

func sendTraces(t *testing.T) {
func sendTraces(t *testing.T, endpoint string) {
ctx := context.Background()

// Set up OTel-Go SDK and exporter
traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure())
traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure(), otlptracegrpc.WithEndpoint(endpoint))
require.NoError(t, err)
bsp := sdktrace.NewBatchSpanProcessor(traceExporter)
r1, _ := resource.New(ctx, resource.WithAttributes(attribute.String("k8s.node.name", "aaaa")))
Expand Down Expand Up @@ -284,6 +289,10 @@ func TestIntegrationComputeTopLevelBySpanKind(t *testing.T) {
server := testutil.DatadogServerMock(apmstatsRec.HandlerFunc, tracesRec.HandlerFunc)
defer server.Close()
t.Setenv("SERVER_URL", server.URL)
t.Setenv("PROM_SERVER", commonTestutil.GetAvailableLocalAddress(t))
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)

// 2. Start in-process collector
factories := getIntegrationTestComponents(t)
Expand All @@ -296,7 +305,7 @@ func TestIntegrationComputeTopLevelBySpanKind(t *testing.T) {
waitForReadiness(app)

// 3. Generate and send traces
sendTracesComputeTopLevelBySpanKind(t)
sendTracesComputeTopLevelBySpanKind(t, otlpGRPCEndpoint)

// 4. Validate traces and APM stats from the mock server
var spans []*pb.Span
Expand Down Expand Up @@ -384,11 +393,11 @@ func TestIntegrationComputeTopLevelBySpanKind(t *testing.T) {
}
}

func sendTracesComputeTopLevelBySpanKind(t *testing.T) {
func sendTracesComputeTopLevelBySpanKind(t *testing.T, endpoint string) {
ctx := context.Background()

// Set up OTel-Go SDK and exporter
traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure())
traceExporter, err := otlptracegrpc.New(ctx, otlptracegrpc.WithInsecure(), otlptracegrpc.WithEndpoint(endpoint))
require.NoError(t, err)
bsp := sdktrace.NewBatchSpanProcessor(traceExporter)
r1, _ := resource.New(ctx, resource.WithAttributes(attribute.String("k8s.node.name", "aaaa")))
Expand Down Expand Up @@ -463,7 +472,12 @@ func TestIntegrationLogs(t *testing.T) {
}
})
defer server.Close()
thing := commonTestutil.GetAvailableLocalAddress(t)
t.Setenv("SERVER_URL", server.URL)
t.Setenv("PROM_SERVER", thing)
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)

// 2. Start in-process collector
factories := getIntegrationTestComponents(t)
Expand All @@ -476,7 +490,7 @@ func TestIntegrationLogs(t *testing.T) {
waitForReadiness(app)

// 3. Generate and send logs
sendLogs(t, 5)
sendLogs(t, 5, otlpGRPCEndpoint)

// 4. Validate logs and metrics from the mock server
// Wait until `doneChannel` is closed and prometheus metrics are received.
Expand Down Expand Up @@ -520,9 +534,9 @@ func TestIntegrationLogs(t *testing.T) {
assert.Equal(t, 2, numSentLogRecords)
}

func sendLogs(t *testing.T, numLogs int) {
func sendLogs(t *testing.T, numLogs int, endpoint string) {
ctx := context.Background()
logExporter, err := otlploggrpc.New(ctx, otlploggrpc.WithInsecure())
logExporter, err := otlploggrpc.New(ctx, otlploggrpc.WithInsecure(), otlploggrpc.WithEndpoint(endpoint))
assert.NoError(t, err)
lr := make([]log.Record, numLogs)
assert.NoError(t, logExporter.Export(ctx, lr))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ receivers:
otlp:
protocols:
http:
endpoint: "localhost:4318"
endpoint: ${env:OTLP_HTTP_SERVER}
grpc:
endpoint: "localhost:4317"
endpoint: ${env:OTLP_GRPC_SERVER}

processors:
tail_sampling:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ receivers:
otlp:
protocols:
http:
endpoint: "localhost:4318"
endpoint: ${env:OTLP_HTTP_SERVER}
grpc:
endpoint: "localhost:4317"
endpoint: ${env:OTLP_GRPC_SERVER}
prometheus:
config:
scrape_configs:
- job_name: 'otelcol'
scrape_interval: 1s
static_configs:
- targets: [ 'localhost:8888' ]
- targets: [ '${env:PROM_SERVER}' ]

exporters:
datadog:
Expand All @@ -33,7 +33,7 @@ service:
telemetry:
metrics:
level: basic
address: "localhost:8888"
address: ${env:PROM_SERVER}
pipelines:
traces:
receivers: [otlp]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ receivers:
otlp:
protocols:
http:
endpoint: "localhost:4318"
endpoint: ${env:OTLP_HTTP_SERVER}
grpc:
endpoint: "localhost:4317"
endpoint: ${env:OTLP_GRPC_SERVER}
prometheus:
config:
scrape_configs:
- job_name: 'otelcol'
scrape_interval: 1s
static_configs:
- targets: [ 'localhost:8888' ]
- targets: [ '${env:PROM_SERVER}' ]
metric_relabel_configs:
- source_labels: [ __name__ ]
regex: "(otelcol_receiver_accepted_log_records|otelcol_exporter_sent_log_records)"
Expand All @@ -37,7 +37,7 @@ service:
telemetry:
metrics:
level: basic
address: "localhost:8888"
address: ${env:PROM_SERVER}
pipelines:
logs:
receivers: [otlp]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ receivers:
otlp:
protocols:
http:
endpoint: "localhost:4318"
endpoint: ${env:OTLP_HTTP_SERVER}
grpc:
endpoint: "localhost:4317"
endpoint: ${env:OTLP_GRPC_SERVER}

connectors:
datadog/connector:
Expand Down
Loading

0 comments on commit b2b10fa

Please sign in to comment.