feat: add X-LaunchDarkly-Instance-Id header (SDK-2351)#258
Open
keelerm84 wants to merge 2 commits into
Open
Conversation
Generate a v4 UUID once per SDK instance in HttpConfigurationBuilder.Build and stamp it on the default headers. Because those headers are shared by the stream, poll, and event clients, every outbound request carries the same stable per-instance identifier without per-channel plumbing. The instance id is applied before user-supplied custom headers so custom headers can override it, matching the convention used for the User-Agent and Authorization headers (and the other LaunchDarkly SDKs). Registers the "instance-id" capability with the contract test service so the cross-SDK harness can verify the header on stream, poll, and event requests.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default mode and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 528b9e0. Configure here.
Generate the X-LaunchDarkly-Instance-Id GUID once at builder construction instead of regenerating it on each MakeHttpProperties call, so that Build() and DescribeConfiguration() (both invoked per SDK instance) see the same value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds the
X-LaunchDarkly-Instance-Idheader to every outbound polling, streaming, and event request. Value is a v4 UUID generated once per SDK instance (viaGuid.NewGuid()) and stable for that instance's lifetime.The GUID is attached via the immutable
HttpPropertiesbuilder before the user-custom-header aggregation, matching the User-Agent / Authorization override convention.Test plan
Note
Medium Risk
Adds a new default HTTP header on all SDK network requests, which could affect downstream proxies/gateways and request deduping/observability expectations. Logic is straightforward but touches shared request configuration used across polling/streaming/events.
Overview
Adds a new default
X-LaunchDarkly-Instance-Idheader to SDK HTTP configuration, generated once as a UUIDv4 perHttpConfigurationBuilderinstance and applied to the underlyingHttpProperties.Ensures custom headers can override this header (consistent with existing override behavior), adds unit tests covering presence/UUIDv4 format/uniqueness vs. stability, and registers the
instance-idcapability in the contract testTestService.Reviewed by Cursor Bugbot for commit ea77df6. Bugbot is set up for automated code reviews on this repo. Configure here.