-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: client identification headers #232
base: main
Are you sure you want to change the base?
Conversation
It's still a draft. I'm working on test coverage. |
@@ -510,6 +513,7 @@ private function fetchFeatures(): array | |||
} else { | |||
$request = $this->requestFactory | |||
->createRequest('GET', (string) Url::appendPath($this->configuration->getUrl(), 'client/features')) | |||
// TODO: remove non-standard headers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe after some time, for example in a next major version
@@ -54,7 +57,7 @@ public function register(iterable $strategyHandlers): bool | |||
'appName' => $this->configuration->getAppName(), | |||
'instanceId' => $this->configuration->getInstanceId(), | |||
'sdkVersion' => $this->sdkName . ':' . $this->sdkVersion, | |||
'strategies' => array_map(fn (StrategyHandler $strategyHandler): string => $strategyHandler->getStrategyName(), $strategyHandlers), | |||
'strategies' => array_map(fn(StrategyHandler $strategyHandler): string => $strategyHandler->getStrategyName(), $strategyHandlers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Linter auto-formatted
@@ -69,6 +70,8 @@ final class UnleashBuilder | |||
|
|||
private ?string $appName = null; | |||
|
|||
private string $connectionId = Uuid::v4(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm open to suggestions of there is a better way of having connectionId
created only during initialization, and reuse it (alongside with SDK name and version) in both registration and getFeatures calls.
Description
Identification headers consistent with other Unleash SDKs.
This PR adds standardized client identification headers to the feature and metrics calls that the client makes to Unleash. The headers are:
x-unleash-appname
: the name of the application that is using the client.UNLEASH-APPNAME
will be deleted in another PR (expand/contract pattern)x-unleash-connection-id
: an internal unique identifier for the current instance of the client generated by the built-in crypto libx-unleash-sdk
: sdk information in the formatunleash-client-<language>:<version>
All the headers are intended for the Unleash team. Changes should be implemented in a way that does not change SDK behavior in a significant way.
The main use cases we have are:
Reference implementation (work in progress): Unleash/unleash-client-node#690
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: