Skip to content

Commit 7cc0ec1

Browse files
Track go fm package usage and version by env var (#52)
* get env to track go fm package usage and version * update Go FM env var * update
1 parent 41b6064 commit 7cc0ec1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

azureappconfiguration/azureappconfiguration.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,7 @@ func configureTracingOptions(options *Options) tracing.Options {
821821
}
822822

823823
tracingOption.Host = tracing.GetHostType()
824+
tracingOption.FMVersion = tracing.GetFeatureManagementVersion()
824825

825826
if !(options.KeyVaultOptions.SecretResolver == nil && options.KeyVaultOptions.Credential == nil) {
826827
tracingOption.KeyVaultConfigured = true

azureappconfiguration/internal/tracing/tracing.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ const (
4545
LoadBalancingEnabledTag = "LB"
4646

4747
// Feature flag usage tracing
48+
FMGoVerEnv = "MS_FEATURE_MANAGEMENT_GO_VERSION"
49+
FMGoVerKey = "FMGoVer"
4850
FeatureFilterTypeKey = "Filter"
4951
CustomFilterKey = "CSTM"
5052
TimeWindowFilterKey = "TIME"
@@ -76,6 +78,7 @@ type Options struct {
7678
ReplicaCount int
7779
IsLoadBalancingEnabled bool
7880
FeatureFlagTracing *FeatureFlagTracing
81+
FMVersion string
7982
}
8083

8184
func GetHostType() HostType {
@@ -93,6 +96,10 @@ func GetHostType() HostType {
9396
return ""
9497
}
9598

99+
func GetFeatureManagementVersion() string {
100+
return os.Getenv(FMGoVerEnv)
101+
}
102+
96103
func CreateCorrelationContextHeader(ctx context.Context, options Options) http.Header {
97104
header := http.Header{}
98105
output := make([]string, 0)
@@ -141,6 +148,10 @@ func CreateCorrelationContextHeader(ctx context.Context, options Options) http.H
141148
output = append(output, featureStr)
142149
}
143150

151+
if options.FMVersion != "" {
152+
output = append(output, FMGoVerKey+"="+options.FMVersion)
153+
}
154+
144155
if options.FeatureFlagTracing != nil {
145156
if options.FeatureFlagTracing.UsesAnyFeatureFilter() {
146157
output = append(output, FeatureFilterTypeKey+"="+options.FeatureFlagTracing.CreateFeatureFiltersString())

0 commit comments

Comments
 (0)