Skip to content

Commit

Permalink
Add legacy formats into the tests
Browse files Browse the repository at this point in the history
Signed-off-by: joeyyy09 <[email protected]>
  • Loading branch information
joeyyy09 committed Aug 4, 2024
1 parent 2c4aa39 commit f665c96
Show file tree
Hide file tree
Showing 3 changed files with 131 additions and 34 deletions.
33 changes: 33 additions & 0 deletions cmd/jaeger/collector-with-jaeger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
service:
pipelines:
traces:
receivers: [otlp, jaeger]
processors: [batch]
exporters: [kafka]
telemetry:
resource:
service.name: jaeger_collector
metrics:
level: detailed

receivers:
otlp:
protocols:
grpc:
http:
jaeger:
protocols:
grpc:
thrift_binary:
thrift_compact:
thrift_http:

processors:
batch:

exporters:
kafka:
brokers:
- localhost:9092
topic: "jaeger-spans"
encoding: jaeger_json
37 changes: 37 additions & 0 deletions cmd/jaeger/ingester-with-jaeger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
service:
extensions: [jaeger_storage, jaeger_query]
pipelines:
traces:
receivers: [kafka]
processors: [batch]
exporters: [jaeger_storage_exporter]
telemetry:
metrics:
address: 0.0.0.0:8889
logs:
level: debug

extensions:
jaeger_query:
trace_storage: some_storage

jaeger_storage:
backends:
some_storage:
memory:
max_traces: 100000

receivers:
kafka:
brokers:
- localhost:9092
topic: "jaeger-spans"
encoding: jaeger_json
initial_offset: earliest

processors:
batch:

exporters:
jaeger_storage_exporter:
trace_storage: some_storage
95 changes: 61 additions & 34 deletions cmd/jaeger/internal/integration/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,65 @@ import (
func TestKafkaStorage(t *testing.T) {
integration.SkipUnlessEnv(t, "kafka")

// TODO these config files use topic: "jaeger-spans",
// but for integration tests we want to use random topic in each run.
// https://github.com/jaegertracing/jaeger/blob/ed5cc2981c34158d0650cb96cb2fafcb753bea70/plugin/storage/integration/kafka_test.go#L50-L51
// Once OTEL Collector supports default values for env vars
// (https://github.com/open-telemetry/opentelemetry-collector/issues/5228)
// we can change the config to use topic: "${KAFKA_TOPIC:-jaeger-spans}"
// and export a KAFKA_TOPIC var with random topic name in the tests.

collectorConfig := "../../collector-with-kafka.yaml"
ingesterConfig := "../../ingester-remote-storage.yaml"

collector := &E2EStorageIntegration{
SkipStorageCleaner: true,
ConfigFile: collectorConfig,
HealthCheckEndpoint: "http://localhost:8888/metrics",
}

// Initialize and start the collector
collector.e2eInitialize(t, "kafka")

ingester := &E2EStorageIntegration{
ConfigFile: ingesterConfig,
StorageIntegration: integration.StorageIntegration{
CleanUp: purge,
GetDependenciesReturnsSource: true,
SkipArchiveTest: true,
},
}

// Initialize and start the ingester
ingester.e2eInitialize(t, "kafka")

// Run the span store tests
ingester.RunSpanStoreTests(t)
// OTLP config files
otlpCollectorConfig := "../../collector-with-kafka.yaml"
otlpIngesterConfig := "../../ingester-remote-storage.yaml"

// Legacy Jaeger config files
legacyCollectorConfig := "../../collector-with-jaeger.yaml"
legacyIngesterConfig := "../../ingester-with-kafka.yaml"

// Test OTLP formats
t.Run("OTLPFormats", func(t *testing.T) {
collector := &E2EStorageIntegration{
SkipStorageCleaner: true,
ConfigFile: otlpCollectorConfig,
HealthCheckEndpoint: "http://localhost:8888/metrics",
}

// Initialize and start the OTLP collector
collector.e2eInitialize(t, "kafka")

ingester := &E2EStorageIntegration{
ConfigFile: otlpIngesterConfig,
StorageIntegration: integration.StorageIntegration{
CleanUp: purge,
GetDependenciesReturnsSource: true,
SkipArchiveTest: true,
},
}

// Initialize and start the OTLP ingester
ingester.e2eInitialize(t, "kafka")

// Run the span store tests for OTLP formats
ingester.RunSpanStoreTests(t)
})

// Test legacy Jaeger formats
t.Run("LegacyJaegerFormats", func(t *testing.T) {
collector := &E2EStorageIntegration{
SkipStorageCleaner: true,
ConfigFile: legacyCollectorConfig,
HealthCheckEndpoint: "http://localhost:8888/metrics",
}

// Initialize and start the Jaeger collector
collector.e2eInitialize(t, "kafka")

ingester := &E2EStorageIntegration{
ConfigFile: legacyIngesterConfig,
StorageIntegration: integration.StorageIntegration{
CleanUp: purge,
GetDependenciesReturnsSource: true,
SkipArchiveTest: true,
},
}

// Initialize and start the Jaeger ingester
ingester.e2eInitialize(t, "kafka")

// Run the span store tests for legacy Jaeger formats
ingester.RunSpanStoreTests(t)
})
}

0 comments on commit f665c96

Please sign in to comment.