Skip to content

Commit 03c8892

Browse files
authored
Add timeout and headers support to Zipkin tracing provider (#58307)
* Add timeout and headers support to Zipkin tracing provider This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * Add timeout and headers support to Zipkin tracing provider This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * This change adds two new optional fields to the ZipkinTracingProvider in MeshConfig: - `timeout`: Configures the HTTP request timeout when sending spans to the Zipkin collector, providing better control over trace export reliability and preventing indefinite waits. - `headers`: Allows including custom HTTP headers in requests to the Zipkin collector for authentication, authorization, and custom metadata use cases. Headers support both direct values and environment variable references for secure credential management. Implementation details: - When timeout or headers are configured, Istio uses Envoy's modern HttpService configuration with full URI support - When neither is configured, Istio uses legacy Envoy fields for backward compatibility - Added comprehensive test coverage for all configuration modes - Updated API documentation with usage examples * Fixing the linitng issues * Making the http service available to all proxies from 1.29
1 parent dadf621 commit 03c8892

File tree

6 files changed

+661
-10
lines changed

6 files changed

+661
-10
lines changed

pilot/pkg/networking/core/tracing.go

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import (
2727
tracing "github.com/envoyproxy/go-control-plane/envoy/type/tracing/v3"
2828
xdstype "github.com/envoyproxy/go-control-plane/envoy/type/v3"
2929
"google.golang.org/protobuf/types/known/anypb"
30+
"google.golang.org/protobuf/types/known/durationpb"
3031
"google.golang.org/protobuf/types/known/wrapperspb"
3132

3233
meshconfig "istio.io/api/mesh/v1alpha1"
@@ -177,7 +178,8 @@ func configureFromProviderConfig(pushCtx *model.PushContext, proxy *model.Proxy,
177178
return nil, fmt.Errorf("could not find cluster for tracing provider %q: %v", provider, err)
178179
}
179180
traceContextOption := convertTraceContextOption(provider.Zipkin.GetTraceContextOption())
180-
return zipkinConfig(hostname, cluster, provider.Zipkin.GetPath(), !provider.Zipkin.GetEnable_64BitTraceId(), traceContextOption, proxy)
181+
return zipkinConfig(hostname, cluster, provider.Zipkin.GetPath(), !provider.Zipkin.GetEnable_64BitTraceId(),
182+
traceContextOption, provider.Zipkin.GetTimeout(), provider.Zipkin.GetHeaders(), proxy)
181183
}
182184
case *meshconfig.MeshConfig_ExtensionProvider_Datadog:
183185
maxTagLength = provider.Datadog.GetMaxTagLength()
@@ -247,20 +249,54 @@ func convertTraceContextOption(
247249

248250
func zipkinConfig(
249251
hostname, cluster, endpoint string, enable128BitTraceID bool, traceContextOption tracingcfg.ZipkinConfig_TraceContextOption,
250-
proxy *model.Proxy,
252+
timeout *durationpb.Duration, headers []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader, proxy *model.Proxy,
251253
) (*anypb.Any, error) {
252254
if endpoint == "" {
253255
endpoint = "/api/v2/spans" // envoy deprecated v1 support
254256
}
257+
258+
// Determine if we should use HttpService (modern approach) or legacy fields
259+
// For newer proxies (Istio 1.29+), always use HttpService as it's the modern approach
260+
// that supports timeout and custom headers. For older proxies, use legacy fields for
261+
// backward compatibility.
262+
useHTTPService := proxy.IstioVersion != nil && proxy.VersionGreaterOrEqual(&model.IstioVersion{Major: 1, Minor: 29})
263+
255264
zc := &tracingcfg.ZipkinConfig{
256-
CollectorCluster: cluster,
257-
CollectorEndpoint: endpoint,
258265
CollectorEndpointVersion: tracingcfg.ZipkinConfig_HTTP_JSON, // use v2 JSON for now
259-
CollectorHostname: hostname, // http host header
260266
TraceId_128Bit: enable128BitTraceID, // istio default enable 128 bit trace id
261267
SharedSpanContext: wrapperspb.Bool(false),
262268
}
263269

270+
if useHTTPService {
271+
// Modern configuration using HttpService
272+
// This is required for timeout and custom headers support
273+
httpService := &core.HttpService{
274+
HttpUri: &core.HttpUri{
275+
Uri: fmt.Sprintf("http://%s%s", hostname, endpoint),
276+
HttpUpstreamType: &core.HttpUri_Cluster{
277+
Cluster: cluster,
278+
},
279+
Timeout: timeout,
280+
},
281+
}
282+
// Add custom headers if provided
283+
if len(headers) > 0 {
284+
httpService.RequestHeadersToAdd = buildHTTPHeaders(headers)
285+
}
286+
zc.CollectorService = httpService
287+
} else {
288+
// Legacy configuration - maintains backward compatibility for older proxies
289+
zc.CollectorCluster = cluster
290+
zc.CollectorEndpoint = endpoint
291+
zc.CollectorHostname = hostname // http host header
292+
293+
// Log when timeout/headers configuration is ignored due to older proxy version
294+
if timeout != nil || len(headers) > 0 {
295+
log.Warnf("Proxy %s (version %v) does not support Zipkin timeout/headers configuration: requires Istio 1.29+. "+
296+
"Configuration will be ignored.", proxy.ID, proxy.IstioVersion)
297+
}
298+
}
299+
264300
// Only set TraceContextOption for proxies that support it to avoid NACK from older proxies
265301
// TraceContextOption support requires a recent Envoy version - using conservative version gating
266302
if proxy.IstioVersion != nil && proxy.VersionGreaterOrEqual(&model.IstioVersion{Major: 1, Minor: 28}) {

pilot/pkg/networking/core/tracing_test.go

Lines changed: 293 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ func TestZipkinConfig(t *testing.T) {
15501550
proxy := &model.Proxy{
15511551
IstioVersion: &model.IstioVersion{Major: 1, Minor: 28, Patch: 0},
15521552
}
1553-
result, err := zipkinConfig(tc.hostname, tc.cluster, tc.endpoint, tc.enable128BitTraceID, tc.traceContextOption, proxy)
1553+
result, err := zipkinConfig(tc.hostname, tc.cluster, tc.endpoint, tc.enable128BitTraceID, tc.traceContextOption, nil, nil, proxy)
15541554
assert.NoError(t, err)
15551555

15561556
// Unmarshal the Any proto to compare the actual ZipkinConfig
@@ -1624,6 +1624,8 @@ func TestZipkinConfigVersionGating(t *testing.T) {
16241624
"/api/v2/spans",
16251625
true,
16261626
tc.traceContextOption,
1627+
nil,
1628+
nil,
16271629
proxy,
16281630
)
16291631
assert.NoError(t, err)
@@ -1651,6 +1653,296 @@ func TestZipkinConfigVersionGating(t *testing.T) {
16511653
}
16521654
}
16531655

1656+
// TestZipkinConfigWithTimeoutAndHeaders tests Zipkin configuration with timeout and custom headers
1657+
func TestZipkinConfigWithTimeoutAndHeaders(t *testing.T) {
1658+
testcases := []struct {
1659+
name string
1660+
hostname string
1661+
cluster string
1662+
endpoint string
1663+
timeout *durationpb.Duration
1664+
headers []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader
1665+
expectedConfig *tracingcfg.ZipkinConfig
1666+
}{
1667+
{
1668+
name: "zipkin with timeout uses HttpService",
1669+
hostname: "zipkin.istio-system.svc.cluster.local",
1670+
cluster: "zipkin-cluster",
1671+
endpoint: "/api/v2/spans",
1672+
timeout: durationpb.New(10000000000), // 10s
1673+
headers: nil,
1674+
expectedConfig: &tracingcfg.ZipkinConfig{
1675+
CollectorEndpointVersion: tracingcfg.ZipkinConfig_HTTP_JSON,
1676+
TraceId_128Bit: true,
1677+
SharedSpanContext: wrapperspb.Bool(false),
1678+
TraceContextOption: tracingcfg.ZipkinConfig_USE_B3,
1679+
CollectorService: &core.HttpService{
1680+
HttpUri: &core.HttpUri{
1681+
Uri: "http://zipkin.istio-system.svc.cluster.local/api/v2/spans",
1682+
HttpUpstreamType: &core.HttpUri_Cluster{
1683+
Cluster: "zipkin-cluster",
1684+
},
1685+
Timeout: durationpb.New(10000000000),
1686+
},
1687+
},
1688+
},
1689+
},
1690+
{
1691+
name: "zipkin with custom headers uses HttpService",
1692+
hostname: "zipkin.istio-system.svc.cluster.local",
1693+
cluster: "zipkin-cluster",
1694+
endpoint: "/api/v2/spans",
1695+
timeout: nil,
1696+
headers: []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader{
1697+
{
1698+
Name: "Authorization",
1699+
HeaderValue: &meshconfig.MeshConfig_ExtensionProvider_HttpHeader_Value{
1700+
Value: "Bearer token123",
1701+
},
1702+
},
1703+
},
1704+
expectedConfig: &tracingcfg.ZipkinConfig{
1705+
CollectorEndpointVersion: tracingcfg.ZipkinConfig_HTTP_JSON,
1706+
TraceId_128Bit: true,
1707+
SharedSpanContext: wrapperspb.Bool(false),
1708+
TraceContextOption: tracingcfg.ZipkinConfig_USE_B3,
1709+
CollectorService: &core.HttpService{
1710+
HttpUri: &core.HttpUri{
1711+
Uri: "http://zipkin.istio-system.svc.cluster.local/api/v2/spans",
1712+
HttpUpstreamType: &core.HttpUri_Cluster{
1713+
Cluster: "zipkin-cluster",
1714+
},
1715+
},
1716+
RequestHeadersToAdd: []*core.HeaderValueOption{
1717+
{
1718+
AppendAction: core.HeaderValueOption_OVERWRITE_IF_EXISTS_OR_ADD,
1719+
Header: &core.HeaderValue{
1720+
Key: "Authorization",
1721+
Value: "Bearer token123",
1722+
},
1723+
},
1724+
},
1725+
},
1726+
},
1727+
},
1728+
{
1729+
name: "zipkin with both timeout and headers",
1730+
hostname: "zipkin.istio-system.svc.cluster.local",
1731+
cluster: "zipkin-cluster",
1732+
endpoint: "/api/v2/spans",
1733+
timeout: durationpb.New(5000000000), // 5s
1734+
headers: []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader{
1735+
{
1736+
Name: "X-Custom-Header",
1737+
HeaderValue: &meshconfig.MeshConfig_ExtensionProvider_HttpHeader_Value{
1738+
Value: "custom-value",
1739+
},
1740+
},
1741+
{
1742+
Name: "X-Tenant-ID",
1743+
HeaderValue: &meshconfig.MeshConfig_ExtensionProvider_HttpHeader_Value{
1744+
Value: "tenant-123",
1745+
},
1746+
},
1747+
},
1748+
expectedConfig: &tracingcfg.ZipkinConfig{
1749+
CollectorEndpointVersion: tracingcfg.ZipkinConfig_HTTP_JSON,
1750+
TraceId_128Bit: true,
1751+
SharedSpanContext: wrapperspb.Bool(false),
1752+
TraceContextOption: tracingcfg.ZipkinConfig_USE_B3,
1753+
CollectorService: &core.HttpService{
1754+
HttpUri: &core.HttpUri{
1755+
Uri: "http://zipkin.istio-system.svc.cluster.local/api/v2/spans",
1756+
HttpUpstreamType: &core.HttpUri_Cluster{
1757+
Cluster: "zipkin-cluster",
1758+
},
1759+
Timeout: durationpb.New(5000000000),
1760+
},
1761+
RequestHeadersToAdd: []*core.HeaderValueOption{
1762+
{
1763+
AppendAction: core.HeaderValueOption_OVERWRITE_IF_EXISTS_OR_ADD,
1764+
Header: &core.HeaderValue{
1765+
Key: "X-Custom-Header",
1766+
Value: "custom-value",
1767+
},
1768+
},
1769+
{
1770+
AppendAction: core.HeaderValueOption_OVERWRITE_IF_EXISTS_OR_ADD,
1771+
Header: &core.HeaderValue{
1772+
Key: "X-Tenant-ID",
1773+
Value: "tenant-123",
1774+
},
1775+
},
1776+
},
1777+
},
1778+
},
1779+
},
1780+
{
1781+
name: "zipkin without timeout and headers uses HttpService (for 1.29+)",
1782+
hostname: "zipkin.istio-system.svc.cluster.local",
1783+
cluster: "zipkin-cluster",
1784+
endpoint: "/api/v2/spans",
1785+
timeout: nil,
1786+
headers: nil,
1787+
expectedConfig: &tracingcfg.ZipkinConfig{
1788+
CollectorEndpointVersion: tracingcfg.ZipkinConfig_HTTP_JSON,
1789+
TraceId_128Bit: true,
1790+
SharedSpanContext: wrapperspb.Bool(false),
1791+
TraceContextOption: tracingcfg.ZipkinConfig_USE_B3,
1792+
CollectorService: &core.HttpService{
1793+
HttpUri: &core.HttpUri{
1794+
Uri: "http://zipkin.istio-system.svc.cluster.local/api/v2/spans",
1795+
HttpUpstreamType: &core.HttpUri_Cluster{
1796+
Cluster: "zipkin-cluster",
1797+
},
1798+
},
1799+
},
1800+
},
1801+
},
1802+
}
1803+
1804+
for _, tc := range testcases {
1805+
t.Run(tc.name, func(t *testing.T) {
1806+
// Use 1.29+ proxy to test timeout/headers support
1807+
proxy := &model.Proxy{
1808+
IstioVersion: &model.IstioVersion{Major: 1, Minor: 29, Patch: 0},
1809+
}
1810+
result, err := zipkinConfig(tc.hostname, tc.cluster, tc.endpoint, true, tracingcfg.ZipkinConfig_USE_B3, tc.timeout, tc.headers, proxy)
1811+
assert.NoError(t, err)
1812+
1813+
var actualConfig tracingcfg.ZipkinConfig
1814+
err = result.UnmarshalTo(&actualConfig)
1815+
assert.NoError(t, err)
1816+
1817+
if diff := cmp.Diff(tc.expectedConfig, &actualConfig, protocmp.Transform()); diff != "" {
1818+
t.Fatalf("zipkinConfig returned unexpected diff (-want +got):\n%s", diff)
1819+
}
1820+
})
1821+
}
1822+
}
1823+
1824+
// TestZipkinConfigTimeoutHeadersVersionGating tests that timeout and headers are only used for proxies that support it
1825+
func TestZipkinConfigTimeoutHeadersVersionGating(t *testing.T) {
1826+
testcases := []struct {
1827+
name string
1828+
proxyVersion *model.IstioVersion
1829+
timeout *durationpb.Duration
1830+
headers []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader
1831+
expectHTTPService bool
1832+
}{
1833+
{
1834+
name: "New proxy (1.29+) with timeout should use HttpService",
1835+
proxyVersion: &model.IstioVersion{Major: 1, Minor: 29, Patch: 0},
1836+
timeout: durationpb.New(10000000000),
1837+
headers: nil,
1838+
expectHTTPService: true,
1839+
},
1840+
{
1841+
name: "New proxy (1.29+) with headers should use HttpService",
1842+
proxyVersion: &model.IstioVersion{Major: 1, Minor: 29, Patch: 0},
1843+
timeout: nil,
1844+
headers: []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader{
1845+
{
1846+
Name: "Authorization",
1847+
HeaderValue: &meshconfig.MeshConfig_ExtensionProvider_HttpHeader_Value{
1848+
Value: "Bearer token",
1849+
},
1850+
},
1851+
},
1852+
expectHTTPService: true,
1853+
},
1854+
{
1855+
name: "Old proxy (1.28) with timeout should NOT use HttpService",
1856+
proxyVersion: &model.IstioVersion{Major: 1, Minor: 28, Patch: 0},
1857+
timeout: durationpb.New(10000000000),
1858+
headers: nil,
1859+
expectHTTPService: false,
1860+
},
1861+
{
1862+
name: "Old proxy (1.28) with headers should NOT use HttpService",
1863+
proxyVersion: &model.IstioVersion{Major: 1, Minor: 28, Patch: 0},
1864+
timeout: nil,
1865+
headers: []*meshconfig.MeshConfig_ExtensionProvider_HttpHeader{
1866+
{
1867+
Name: "Authorization",
1868+
HeaderValue: &meshconfig.MeshConfig_ExtensionProvider_HttpHeader_Value{
1869+
Value: "Bearer token",
1870+
},
1871+
},
1872+
},
1873+
expectHTTPService: false,
1874+
},
1875+
{
1876+
name: "New proxy (1.29+) without timeout/headers should use HttpService",
1877+
proxyVersion: &model.IstioVersion{Major: 1, Minor: 29, Patch: 0},
1878+
timeout: nil,
1879+
headers: nil,
1880+
expectHTTPService: true,
1881+
},
1882+
{
1883+
name: "Old proxy (1.28) without timeout/headers should NOT use HttpService",
1884+
proxyVersion: &model.IstioVersion{Major: 1, Minor: 28, Patch: 0},
1885+
timeout: nil,
1886+
headers: nil,
1887+
expectHTTPService: false,
1888+
},
1889+
{
1890+
name: "Proxy with nil version should NOT use HttpService",
1891+
proxyVersion: nil,
1892+
timeout: durationpb.New(10000000000),
1893+
headers: nil,
1894+
expectHTTPService: false,
1895+
},
1896+
}
1897+
1898+
for _, tc := range testcases {
1899+
t.Run(tc.name, func(t *testing.T) {
1900+
proxy := &model.Proxy{
1901+
IstioVersion: tc.proxyVersion,
1902+
}
1903+
1904+
result, err := zipkinConfig(
1905+
"zipkin.istio-system.svc.cluster.local",
1906+
"outbound|9411||zipkin.istio-system.svc.cluster.local",
1907+
"/api/v2/spans",
1908+
true,
1909+
tracingcfg.ZipkinConfig_USE_B3,
1910+
tc.timeout,
1911+
tc.headers,
1912+
proxy,
1913+
)
1914+
assert.NoError(t, err)
1915+
1916+
var actualConfig tracingcfg.ZipkinConfig
1917+
err = result.UnmarshalTo(&actualConfig)
1918+
assert.NoError(t, err)
1919+
1920+
versionStr := "nil"
1921+
if tc.proxyVersion != nil {
1922+
versionStr = tc.proxyVersion.String()
1923+
}
1924+
1925+
if tc.expectHTTPService {
1926+
// For new proxies, HttpService should be set
1927+
if actualConfig.CollectorService == nil {
1928+
t.Fatalf("CollectorService should be set for proxy version %s", versionStr)
1929+
}
1930+
if actualConfig.CollectorCluster != "" {
1931+
t.Fatalf("CollectorCluster should be empty when using HttpService for proxy version %s, got: %s", versionStr, actualConfig.CollectorCluster)
1932+
}
1933+
} else {
1934+
// For old proxies, legacy fields should be set
1935+
if actualConfig.CollectorService != nil {
1936+
t.Fatalf("CollectorService should NOT be set for proxy version %s", versionStr)
1937+
}
1938+
if actualConfig.CollectorCluster == "" {
1939+
t.Fatalf("CollectorCluster should be set when using legacy config for proxy version %s", versionStr)
1940+
}
1941+
}
1942+
})
1943+
}
1944+
}
1945+
16541946
func TestGetHeaderValue(t *testing.T) {
16551947
t.Setenv("CUSTOM_ENV_NAME", "custom-env-value")
16561948
cases := []struct {

0 commit comments

Comments
 (0)