Skip to content

feat: report event source headers on open #33

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

Merged
merged 3 commits into from
Apr 14, 2025

Conversation

abarker-launchdarkly
Copy link

No description provided.

@abarker-launchdarkly abarker-launchdarkly requested a review from a team as a code owner April 14, 2025 14:55
Copy link
Member

@kinyoklion kinyoklion left a comment

Choose a reason for hiding this comment

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

Code looks good. I think we need to update the readme, specifically the extensions compared to w3c.

@abarker-launchdarkly abarker-launchdarkly merged commit e8539f3 into main Apr 14, 2025
2 checks passed
@abarker-launchdarkly abarker-launchdarkly deleted the abarker/sdk-1149/event-source-headers branch April 14, 2025 19:29
abarker-launchdarkly pushed a commit that referenced this pull request Apr 14, 2025
🤖 I have created a release *beep* *boop*
---


##
[2.1.0](2.0.3...2.1.0)
(2025-04-14)


### Features

* report event source headers on open
([#33](#33))
([e8539f3](e8539f3))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
abarker-launchdarkly added a commit to launchdarkly/js-core that referenced this pull request Apr 16, 2025
**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

**Describe the solution you've provided**

If present, `environmentId` is now passed to the HookRunner in the
evaluation series.

For streaming connections:
- Response headers are now attached to the `open` event
(launchdarkly/js-eventsource#33)
- `StreamingProcessor` passes these headers to the stream listeners via
`processJson`. The listener for the PUT event extracts the
`environmentId` from the headers and passes this as initialization
metadata to the underlying feature store.

For polling connections:
- `PollingProcessor` retrieves the response headers via the underlying
`Requestor` and extracts the `environmentId` from the headers and passes
this as initialization metadata to the underlying feature store.

LDClient will then call `getInitMetaData()` on the underlying feature
store (if the feature store supports it) when executing a hook and pass
`environmentId` in the execution series data.

Currently only `InMemoryFeatureStore` has been modified to support
initialization metadata. This functionality can be added to other
feature stores by modifying `init()` to accept the optional
`initMetadata` parameter and implementing the optional
`getInitMetadata()` method.
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.

2 participants