Commit 4290b8a
feat: Report provider name and version to LaunchDarkly (#51)
The provider now identifies itself as the wrapper, so requests it makes
are attributed to the OpenFeature provider rather than to the Python
SDK.
- Sets `wrapper_name` to `open-feature-python-server` and
`wrapper_version` to the provider version
- Uses `Config.with_wrapper_information`, released in
launchdarkly-server-sdk 9.17.0
- Raises the SDK floor to `>=9.17.0`
- Adds `ld_openfeature/version.py`, kept current by release-please
**Requirements**
- [x] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [x] I have validated my changes against all supported platform
versions
<details>
<summary>Implementation details</summary>
**Describe the solution you've provided**
```python
self.__client = LDClient(config.with_wrapper_information(WRAPPER_NAME, VERSION))
```
This matches the Java and .NET providers, which derive a config from the
application-supplied one:
```java
new LDClient(sdkKey, LDConfig.Builder.fromConfig(config)
.wrapper(Components.wrapperInfo()
.wrapperName("open-feature-java-server")
.wrapperVersion(Version.SDK_VERSION)).build());
```
The provider version comes from a new `ld_openfeature/version.py`, added
to `extra-files` in `release-please-config.json` so the constant is
bumped with each release the same way `docs/conf.py` already is.
**Describe alternatives you've considered**
An earlier revision of this PR copied the `Config` and assigned its
name-mangled private wrapper fields, because wrapper information could
only be supplied to the constructor. That depends on SDK internals,
hence the SDK change instead
([python-server-sdk#501](launchdarkly/python-server-sdk#501)).
**Testing**
`test_provider_identifies_itself_as_the_wrapper` asserts the client's
config carries the provider's name and version, and that the config
passed in by the caller is unchanged. Against the released 9.17.0: 80
tests pass, mypy clean.
</details>
Link to Devin session:
https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Open in Devin Desktop:
https://app.devin.ai/desktop/session/0c452d209ec54b068ba120b4c92b8f6c?variant=devin
Requested by: @kinyoklion
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Overview**
> LaunchDarkly traffic from this provider is now attributed to the
OpenFeature integration instead of looking like plain Python SDK usage.
>
> `LaunchDarklyProvider` builds the underlying `LDClient` from
`config.with_wrapper_information("open-feature-python-server", VERSION)`
so wrapper name and version are set on the client config without
mutating the caller’s `Config`. The version lives in new
`ld_openfeature/version.py`, wired into release-please alongside
`docs/conf.py`.
>
> The minimum `launchdarkly-server-sdk` dependency is raised to
**>=9.17.0** for `with_wrapper_information`. A test asserts the client
carries the expected wrapper fields and that the original config’s
`wrapper_name` stays unset.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8f3861b. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Devin AI <devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>1 parent 9395775 commit 4290b8a
5 files changed
Lines changed: 15 additions & 3 deletions
File tree
- ld_openfeature
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
19 | 23 | | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | | - | |
| 30 | + | |
27 | 31 | | |
28 | 32 | | |
29 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| |||
0 commit comments