Skip to content

Feature flag tracing#31

Merged
linglingye001 merged 3 commits intolinglingye/fffrom
linglingye/ffTrace
Jun 25, 2025
Merged

Feature flag tracing#31
linglingye001 merged 3 commits intolinglingye/fffrom
linglingye/ffTrace

Conversation

@linglingye001
Copy link
Member

No description provided.

@linglingye001 linglingye001 requested a review from Copilot June 12, 2025 07:38
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds feature flag telemetry and tracing support by introducing a FeatureFlagTracing type, updating the correlation context header to include feature flag usage details, and modifying the feature-flag loading logic to populate telemetry metadata and update tracing metrics.

  • Introduces FeatureFlagTracing with methods to track filters, feature usage, and variant counts
  • Extends CreateCorrelationContextHeader to append feature-flag tracing entries
  • Updates loadFeatureFlags to call populateTelemetryMetadata and updateFeatureFlagTracing, and adds tests for the new functionality

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
azureappconfiguration/internal/tracing/tracing.go Added FeatureFlagTracing to header options and included logic to append its data to the correlation context header
azureappconfiguration/internal/tracing/featureflag_tracing.go New implementation of FeatureFlagTracing methods
azureappconfiguration/internal/tracing/tracing_test.go Unit tests for FeatureFlagTracing and header updates
azureappconfiguration/constants.go Added constants for feature-flag keys and tags
azureappconfiguration/azureappconfiguration.go Updated feature-flag loading to populate telemetry metadata, update tracing, and generate reference URLs; added endpoint field
azureappconfiguration/azureappconfiguration_test.go New tests for telemetry-enabled flags and tracing updates
Comments suppressed due to low confidence (4)

azureappconfiguration/internal/tracing/tracing.go:138

  • Use header.Set here instead of header.Add to ensure the correlation context header is not duplicated if invoked multiple times.
header.Add(CorrelationContextHeader, strings.Join(output, DelimiterComma))

azureappconfiguration/internal/tracing/featureflag_tracing.go:6

  • [nitpick] Add GoDoc comments for FeatureFlagTracing and its exported methods to explain their purpose and usage.
type FeatureFlagTracing struct {

azureappconfiguration/azureappconfiguration.go:809

  • [nitpick] Consider adding unit tests for populateTelemetryMetadata to verify that telemetry metadata (ETag and reference URL) is correctly populated when telemetry is enabled.
func populateTelemetryMetadata(featureFlag map[string]interface{}, setting azappconfig.Setting, endpoint string) {

azureappconfiguration/azureappconfiguration.go:761

  • The fmt.Sprintf call requires the fmt package but I don't see it imported. Please add import \"fmt\" at the top of the file.
featureFlagReference := fmt.Sprintf("%s/kv/%s", endpoint, *setting.Key)

@linglingye001 linglingye001 changed the title Feature flag telemetry Feature flag tracing Jun 24, 2025
@RichardChen820
Copy link
Member

LGTM

@linglingye001 linglingye001 merged commit 106dc99 into linglingye/ff Jun 25, 2025
1 check passed
@linglingye001 linglingye001 deleted the linglingye/ffTrace branch June 25, 2025 05:46
linglingye001 added a commit that referenced this pull request Jul 1, 2025
* load feature flags

* return feature flag bytes

* add test

* feature flag refresh (#30)

* Feature flag tracing (#31)

* feature flag tracing and telemetry

* update

* not populate telemetry data

* fix feature flag refresh

* update test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants