Skip to content

Commit 157fb54

Browse files
Merge pull request #113 from Azure/release/v2.2.4
Merge release/v2.2.4 to main
2 parents b00c164 + cf65d4c commit 157fb54

File tree

8 files changed

+423
-46
lines changed

8 files changed

+423
-46
lines changed

go.mod

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ require (
77
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.1
88
github.com/golang/mock v1.6.0
99
github.com/onsi/gomega v1.36.1
10-
golang.org/x/crypto v0.37.0
11-
golang.org/x/sync v0.13.0
10+
golang.org/x/crypto v0.38.0
11+
golang.org/x/sync v0.14.0
1212
k8s.io/apimachinery v0.32.3
1313
k8s.io/client-go v0.32.3
1414
sigs.k8s.io/controller-runtime v0.20.4
@@ -43,7 +43,7 @@ require (
4343

4444
require (
4545
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0
46-
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v1.2.0-beta.1
46+
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v1.2.0
4747
github.com/beorn7/perks v1.0.1 // indirect
4848
github.com/cespare/xxhash/v2 v2.3.0 // indirect
4949
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@@ -72,9 +72,9 @@ require (
7272
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0
7373
golang.org/x/net v0.39.0 // indirect
7474
golang.org/x/oauth2 v0.29.0 // indirect
75-
golang.org/x/sys v0.32.0 // indirect
76-
golang.org/x/term v0.31.0 // indirect
77-
golang.org/x/text v0.24.0 // indirect
75+
golang.org/x/sys v0.33.0 // indirect
76+
golang.org/x/term v0.32.0 // indirect
77+
golang.org/x/text v0.25.0 // indirect
7878
golang.org/x/time v0.11.0 // indirect
7979
gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect
8080
google.golang.org/protobuf v1.36.6 // indirect

go.sum

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0 h1:OVoM452qUFBrX+URdH3Vp
44
github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.9.0/go.mod h1:kUjrAo8bgEwLeZ/CmHqNl3Z/kPm7y6FKfxxK0izYUg4=
55
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY=
66
github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8=
7-
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v1.2.0-beta.1 h1:wSwUNd/Tbq0e0zZjWuRQL4tsBxoZ0tYIJe+rBZZQApY=
8-
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v1.2.0-beta.1/go.mod h1:0uyyPvSFLlPiPzoTTLXN6wR9sFFqL6iPVd4FAugCooo=
7+
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v1.2.0 h1:uU4FujKFQAz31AbWOO3INV9qfIanHeIUSsGhRlcJJmg=
8+
github.com/Azure/azure-sdk-for-go/sdk/data/azappconfig v1.2.0/go.mod h1:qr3M3Oy6V98VR0c5tCHKUpaeJTRQh6KYzJewRtFWqfc=
99
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 h1:FPKJS1T+clwv+OLGt13a8UjqeRuh0O4SJ3lUriThc+4=
1010
github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1/go.mod h1:j2chePtV91HrC22tGoRX3sGY42uF13WzmmV80/OdVAA=
1111
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.1 h1:mrkDCdkMsD4l9wjFGhofFHFrV43Y3c53RSLKOCJ5+Ow=
@@ -138,8 +138,8 @@ go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E=
138138
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
139139
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
140140
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
141-
golang.org/x/crypto v0.37.0 h1:kJNSjF/Xp7kU0iB2Z+9viTPMW4EqqsrywMXLJOOsXSE=
142-
golang.org/x/crypto v0.37.0/go.mod h1:vg+k43peMZ0pUMhYmVAWysMK35e6ioLh3wB8ZCAfbVc=
141+
golang.org/x/crypto v0.38.0 h1:jt+WWG8IZlBnVbomuhg2Mdq0+BBQaHbtqHEFEigjUV8=
142+
golang.org/x/crypto v0.38.0/go.mod h1:MvrbAqul58NNYPKnOra203SB9vpuZW0e+RRZV+Ggqjw=
143143
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0 h1:R84qjqJb5nVJMxqWYb3np9L5ZsaDtB+a39EqjV0JSUM=
144144
golang.org/x/exp v0.0.0-20250408133849-7e4ce0ab07d0/go.mod h1:S9Xr4PYopiDyqSyp5NjCrhFrqg6A5zA2E/iPHPhqnS8=
145145
golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
@@ -158,24 +158,24 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ
158158
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
159159
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
160160
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
161-
golang.org/x/sync v0.13.0 h1:AauUjRAJ9OSnvULf/ARrrVywoJDy0YS2AwQ98I37610=
162-
golang.org/x/sync v0.13.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
161+
golang.org/x/sync v0.14.0 h1:woo0S4Yywslg6hp4eUFjTVOyKt0RookbpAHG4c1HmhQ=
162+
golang.org/x/sync v0.14.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
163163
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
164164
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
165165
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
166166
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
167167
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
168168
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
169169
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
170-
golang.org/x/sys v0.32.0 h1:s77OFDvIQeibCmezSnk/q6iAfkdiQaJi4VzroCFrN20=
171-
golang.org/x/sys v0.32.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
170+
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
171+
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
172172
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
173-
golang.org/x/term v0.31.0 h1:erwDkOK1Msy6offm1mOgvspSkslFnIGsFnxOKoufg3o=
174-
golang.org/x/term v0.31.0/go.mod h1:R4BeIy7D95HzImkxGkTW1UQTtP54tio2RyHz7PwK0aw=
173+
golang.org/x/term v0.32.0 h1:DR4lr0TjUs3epypdhTOkMmuF5CDFJ/8pOnbzMZPQ7bg=
174+
golang.org/x/term v0.32.0/go.mod h1:uZG1FhGx848Sqfsq4/DlJr3xGGsYMu/L5GW4abiaEPQ=
175175
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
176176
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
177-
golang.org/x/text v0.24.0 h1:dd5Bzh4yt5KYA8f9CJHCP4FB4D51c2c6JvN37xJJkJ0=
178-
golang.org/x/text v0.24.0/go.mod h1:L8rBsPeo2pSS+xqN0d5u2ikmjtmoJbDBT1b7nHvFCdU=
177+
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
178+
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
179179
golang.org/x/time v0.11.0 h1:/bpjEDfN9tkoN/ryeYHnv5hcMlc8ncjMcM4XBk5NWV0=
180180
golang.org/x/time v0.11.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
181181
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

internal/loader/configuration_setting_loader.go

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@ import (
3737

3838
type ConfigurationSettingLoader struct {
3939
acpv1.AzureAppConfigurationProvider
40-
ClientManager ClientManager
41-
SettingsClient SettingsClient
40+
ClientManager ClientManager
41+
SettingsClient SettingsClient
42+
TracingFeatures TracingFeatures
4243
}
4344

4445
type TargetKeyValueSettings struct {
@@ -100,20 +101,12 @@ const (
100101
RequestTracingEnabled string = "REQUEST_TRACING_ENABLED"
101102
)
102103

103-
// Feature flag telemetry
104-
const (
105-
TelemetryKey string = "telemetry"
106-
EnabledKey string = "enabled"
107-
MetadataKey string = "metadata"
108-
ETagKey string = "ETag"
109-
FeatureFlagReferenceKey string = "FeatureFlagReference"
110-
)
111-
112104
func NewConfigurationSettingLoader(provider acpv1.AzureAppConfigurationProvider, clientManager ClientManager, settingsClient SettingsClient) (*ConfigurationSettingLoader, error) {
113105
return &ConfigurationSettingLoader{
114106
AzureAppConfigurationProvider: provider,
115107
ClientManager: clientManager,
116108
SettingsClient: settingsClient,
109+
TracingFeatures: TracingFeatures{},
117110
}, nil
118111
}
119112

@@ -238,7 +231,8 @@ func (csl *ConfigurationSettingLoader) CreateKeyValueSettings(ctx context.Contex
238231
}
239232

240233
resolver := secretReferenceResolver
241-
234+
useAIConfiguration := false
235+
useAIChatCompletionConfiguration := false
242236
for _, setting := range settingsResponse.Settings {
243237
trimmedKey := trimPrefix(*setting.Key, csl.Spec.Configuration.TrimKeyPrefixes)
244238
if len(trimmedKey) == 0 {
@@ -251,7 +245,7 @@ func (csl *ConfigurationSettingLoader) CreateKeyValueSettings(ctx context.Contex
251245
rawSettings.IsJsonContentTypeMap[trimmedKey] = false
252246
continue
253247
}
254-
switch *setting.ContentType {
248+
switch strings.TrimSpace(strings.ToLower(*setting.ContentType)) {
255249
case FeatureFlagContentType:
256250
continue // ignore feature flag while getting key value settings
257251
case SecretReferenceContentType:
@@ -302,9 +296,21 @@ func (csl *ConfigurationSettingLoader) CreateKeyValueSettings(ctx context.Contex
302296
default:
303297
rawSettings.KeyValueSettings[trimmedKey] = setting.Value
304298
rawSettings.IsJsonContentTypeMap[trimmedKey] = isJsonContentType(setting.ContentType)
299+
if !rawSettings.IsJsonContentTypeMap[trimmedKey] {
300+
continue
301+
}
302+
if isAIConfigurationContentType(setting.ContentType) {
303+
useAIConfiguration = true
304+
}
305+
if isAIChatCompletionContentType(setting.ContentType) {
306+
useAIChatCompletionConfiguration = true
307+
}
305308
}
306309
}
307310

311+
csl.TracingFeatures.UseAIConfiguration = useAIConfiguration
312+
csl.TracingFeatures.UseAIChatCompletionConfiguration = useAIChatCompletionConfiguration
313+
308314
// resolve the secret reference settings
309315
if resolvedSecret, err := csl.ResolveSecretReferences(ctx, rawSettings.K8sSecrets, resolver); err != nil {
310316
return nil, err
@@ -554,7 +560,9 @@ func (csl *ConfigurationSettingLoader) ExecuteFailoverPolicy(ctx context.Context
554560
}
555561
for _, clientWrapper := range clients {
556562
if tracingEnabled {
557-
ctx = policy.WithHTTPHeader(ctx, createCorrelationContextHeader(ctx, csl.AzureAppConfigurationProvider, csl.ClientManager, isFailoverRequest))
563+
csl.TracingFeatures.IsFailoverRequest = isFailoverRequest
564+
csl.TracingFeatures.ReplicaCount = len(manager.DynamicClientWrappers)
565+
ctx = policy.WithHTTPHeader(ctx, createCorrelationContextHeader(ctx, csl.AzureAppConfigurationProvider, csl.TracingFeatures))
558566
}
559567
settingsResponse, err := settingsClient.GetSettings(ctx, clientWrapper.Client)
560568
successful := true

internal/loader/request_tracing.go

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,38 @@ type RequestTracing struct {
1818
IsStartUp bool
1919
}
2020

21+
type TracingFeatures struct {
22+
ReplicaCount int
23+
IsFailoverRequest bool
24+
UseAIConfiguration bool
25+
UseAIChatCompletionConfiguration bool
26+
}
27+
28+
// Feature flag telemetry
29+
const (
30+
TelemetryKey string = "telemetry"
31+
EnabledKey string = "enabled"
32+
MetadataKey string = "metadata"
33+
ETagKey string = "ETag"
34+
FeatureFlagReferenceKey string = "FeatureFlagReference"
35+
)
36+
37+
// AI Configuration telemetry
38+
const (
39+
AIMimeProfileKey string = "https://azconfig.io/mime-profiles/ai"
40+
AIChatCompletionMimeProfileKey string = "https://azconfig.io/mime-profiles/ai/chat-completion"
41+
)
42+
2143
const (
22-
RequestTracingKey TracingKey = TracingKey("tracing")
23-
AzureExtensionContext string = "AZURE_EXTENSION_CONTEXT"
44+
RequestTracingKey TracingKey = TracingKey("tracing")
45+
AzureExtensionContext string = "AZURE_EXTENSION_CONTEXT"
46+
TracingFeatureDelimiterKey string = "+"
47+
LoadBalancingKey string = "LB"
48+
AIConfigurationKey string = "AI"
49+
AIChatCompletionKey string = "AICC"
2450
)
2551

26-
func createCorrelationContextHeader(ctx context.Context, provider acpv1.AzureAppConfigurationProvider, clientManager ClientManager, isFailoverRequest bool) http.Header {
52+
func createCorrelationContextHeader(ctx context.Context, provider acpv1.AzureAppConfigurationProvider, tracingFeatures TracingFeatures) http.Header {
2753
header := http.Header{}
2854
output := make([]string, 0)
2955

@@ -51,22 +77,29 @@ func createCorrelationContextHeader(ctx context.Context, provider acpv1.AzureApp
5177
}
5278

5379
if provider.Spec.ReplicaDiscoveryEnabled {
54-
if manager, ok := clientManager.(*ConfigurationClientManager); ok {
55-
replicaCount := 0
56-
if manager.DynamicClientWrappers != nil {
57-
replicaCount = len(manager.DynamicClientWrappers)
58-
}
80+
output = append(output, fmt.Sprintf("ReplicaCount=%d", tracingFeatures.ReplicaCount))
5981

60-
output = append(output, fmt.Sprintf("ReplicaCount=%d", replicaCount))
61-
}
62-
63-
if isFailoverRequest {
82+
if tracingFeatures.IsFailoverRequest {
6483
output = append(output, "FailoverRequest")
6584
}
6685
}
6786

87+
features := make([]string, 0)
6888
if provider.Spec.LoadBalancingEnabled {
69-
output = append(output, "Features=LB")
89+
features = append(features, LoadBalancingKey)
90+
}
91+
92+
if tracingFeatures.UseAIConfiguration {
93+
features = append(features, AIConfigurationKey)
94+
}
95+
96+
if tracingFeatures.UseAIChatCompletionConfiguration {
97+
features = append(features, AIChatCompletionKey)
98+
}
99+
100+
if len(features) > 0 {
101+
featureStr := "Features=" + strings.Join(features, TracingFeatureDelimiterKey)
102+
output = append(output, featureStr)
70103
}
71104

72105
if _, ok := os.LookupEnv(AzureExtensionContext); ok {

0 commit comments

Comments
 (0)