Skip to content

Commit 22591c8

Browse files
songy23dmathieu
authored andcommitted
[chore][exporter/datadog] fix integration test (open-telemetry#39096)
#### Description open-telemetry/opentelemetry-collector#12756 deprecates telemetry::metrics::address so need to adopt the new configs in test yamls. #### Link to tracking issue open-telemetry#39064
1 parent 38dcd3e commit 22591c8

File tree

4 files changed

+35
-10
lines changed

4 files changed

+35
-10
lines changed

exporter/datadogexporter/integrationtest/integration_test.go

+10-5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"fmt"
1313
"io"
1414
"net/http"
15+
"strconv"
1516
"strings"
1617
"sync"
1718
"testing"
@@ -97,7 +98,9 @@ func testIntegration(t *testing.T) {
9798
server := testutil.DatadogServerMock(apmstatsRec.HandlerFunc, tracesRec.HandlerFunc)
9899
defer server.Close()
99100
t.Setenv("SERVER_URL", server.URL)
100-
t.Setenv("PROM_SERVER", commonTestutil.GetAvailableLocalAddress(t))
101+
promPort := strconv.Itoa(commonTestutil.GetAvailablePort(t))
102+
t.Setenv("PROM_SERVER_PORT", promPort)
103+
t.Setenv("PROM_SERVER", fmt.Sprintf("localhost:%s", promPort))
101104
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
102105
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
103106
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)
@@ -292,7 +295,9 @@ func TestIntegrationComputeTopLevelBySpanKind(t *testing.T) {
292295
server := testutil.DatadogServerMock(apmstatsRec.HandlerFunc, tracesRec.HandlerFunc)
293296
defer server.Close()
294297
t.Setenv("SERVER_URL", server.URL)
295-
t.Setenv("PROM_SERVER", commonTestutil.GetAvailableLocalAddress(t))
298+
promPort := strconv.Itoa(commonTestutil.GetAvailablePort(t))
299+
t.Setenv("PROM_SERVER_PORT", promPort)
300+
t.Setenv("PROM_SERVER", fmt.Sprintf("localhost:%s", promPort))
296301
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
297302
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
298303
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)
@@ -452,7 +457,6 @@ func sendTracesComputeTopLevelBySpanKind(t *testing.T, endpoint string) {
452457
}
453458

454459
func TestIntegrationLogs(t *testing.T) {
455-
t.Skip("skipping test, see https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/39064")
456460
// 1. Set up mock Datadog server
457461
// See also https://github.com/DataDog/datadog-agent/blob/49c16e0d4deab396626238fa1d572b684475a53f/cmd/trace-agent/test/backend.go
458462
seriesRec := &testutil.HTTPRequestRecorderWithChan{Pattern: testutil.MetricV2Endpoint, ReqChan: make(chan []byte)}
@@ -476,9 +480,10 @@ func TestIntegrationLogs(t *testing.T) {
476480
}
477481
})
478482
defer server.Close()
479-
thing := commonTestutil.GetAvailableLocalAddress(t)
480483
t.Setenv("SERVER_URL", server.URL)
481-
t.Setenv("PROM_SERVER", thing)
484+
promPort := strconv.Itoa(commonTestutil.GetAvailablePort(t))
485+
t.Setenv("PROM_SERVER_PORT", promPort)
486+
t.Setenv("PROM_SERVER", fmt.Sprintf("localhost:%s", promPort))
482487
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
483488
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
484489
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)

exporter/datadogexporter/integrationtest/integration_test_internal_metrics_config.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,16 @@ exporters:
3232
service:
3333
telemetry:
3434
metrics:
35-
level: basic
36-
address: ${env:PROM_SERVER}
35+
level: "basic"
36+
readers:
37+
- pull:
38+
exporter:
39+
prometheus:
40+
host: "localhost"
41+
port: ${env:PROM_SERVER_PORT}
42+
without_scope_info: true
43+
without_type_suffix: true
44+
without_units: true
3745
pipelines:
3846
traces:
3947
receivers: [otlp]

exporter/datadogexporter/integrationtest/integration_test_logs_config.yaml

+10-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,16 @@ exporters:
3636
service:
3737
telemetry:
3838
metrics:
39-
level: basic
40-
address: ${env:PROM_SERVER}
39+
level: "basic"
40+
readers:
41+
- pull:
42+
exporter:
43+
prometheus:
44+
host: "localhost"
45+
port: ${env:PROM_SERVER_PORT}
46+
without_scope_info: true
47+
without_type_suffix: true
48+
without_units: true
4149
pipelines:
4250
logs:
4351
receivers: [otlp]

exporter/datadogexporter/integrationtest/no_race_integration_test.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ package integrationtest // import "github.com/open-telemetry/opentelemetry-colle
88
import (
99
"context"
1010
"encoding/json"
11+
"fmt"
1112
"runtime"
13+
"strconv"
1214
"testing"
1315
"time"
1416

@@ -65,7 +67,9 @@ func testIntegrationInternalMetrics(t *testing.T, expectedMetrics map[string]str
6567
server := testutil.DatadogServerMock(seriesRec.HandlerFunc, tracesRec.HandlerFunc)
6668
defer server.Close()
6769
t.Setenv("SERVER_URL", server.URL)
68-
t.Setenv("PROM_SERVER", commonTestutil.GetAvailableLocalAddress(t))
70+
promPort := strconv.Itoa(commonTestutil.GetAvailablePort(t))
71+
t.Setenv("PROM_SERVER_PORT", promPort)
72+
t.Setenv("PROM_SERVER", fmt.Sprintf("localhost:%s", promPort))
6973
t.Setenv("OTLP_HTTP_SERVER", commonTestutil.GetAvailableLocalAddress(t))
7074
otlpGRPCEndpoint := commonTestutil.GetAvailableLocalAddress(t)
7175
t.Setenv("OTLP_GRPC_SERVER", otlpGRPCEndpoint)

0 commit comments

Comments
 (0)