Skip to content
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: egress client - ucanto integration #123

Merged
merged 19 commits into from
Nov 13, 2024
Merged

Conversation

fforbeck
Copy link
Member

@fforbeck fforbeck commented Oct 31, 2024

Egress Client - UCanto Integration

Context

This PR introduces EgressClient to the application context, enabling capability invocations such as Space.egressRecord for logging egress directly to the UCanto Server (Upload API). With this integration, the previous Accounting Service is now replaced by a method in EgressClient for egress logging.

Key Changes

  • Middleware Integration: Added withEgressClient middleware to simplify capability invocations across the application.

  • EgressClient Creation: Introduced a create function to instantiate UCantoClient, establishing a secure connection to the UCanto Server based on environment configurations.

  • Egress Recording: Refactored EgressClient.record function to use the Space.egressRecord capability, allowing for efficient egress byte tracking in our infrastructure.

  • Connection Management: Added a connect function to handle connection setup with the UCanto Server.

  • Environment Variables: Updated the environment variables, including service Web DIDs and service URLs.

  • Enhanced Context: Added the delegationProofs to the application context, so we can use that information to invoke the egressRecord capabilities. Also added the GatewayIdentity to the application context.

  • Accounting Service: There is no Accounting Service anymore. Instead, we use the EgressClient to record the egress event.

  • Wrangler: Updated the configs for all environments and the wrangler lib to the latest version.

  • Telemetry: Added a feature flag for Open Telemetry - if enabled, the Egress Record call will fail to execute the this.fetch function call. See Fix opentelemetry issue caused in the execution of the invocation project-tracking#176 for more details.

@fforbeck fforbeck changed the title feat/ucanto integration feat: ucanto integration Oct 31, 2024
@fforbeck fforbeck force-pushed the feat/ucanto-integration branch from 4a43520 to 95f0331 Compare October 31, 2024 14:12
@fforbeck fforbeck requested review from Peeja, travis and alanshaw October 31, 2024 14:21
@fforbeck fforbeck marked this pull request as ready for review October 31, 2024 14:21
Copy link
Member

@Peeja Peeja left a comment

Choose a reason for hiding this comment

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

🫵🥫➡️❗

Looks great! One suggestion:

src/middleware/withUcantoClient.js Outdated Show resolved Hide resolved
Copy link
Member

@travis travis left a comment

Choose a reason for hiding this comment

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

lgtm! agree with Petra but happy to see this ship with or without the change

@fforbeck fforbeck force-pushed the feat/ucanto-integration branch from 5488285 to 5136925 Compare November 6, 2024 18:20
@fforbeck fforbeck changed the title feat: ucanto integration feat: egress client - ucanto integration Nov 7, 2024
Copy link
Member

@Peeja Peeja left a comment

Choose a reason for hiding this comment

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

Looking good! Suggestions and thoughts below. Looks like this needs some type love and some npm run lint:fixing too.

src/index.js Outdated Show resolved Hide resolved
src/middleware/index.js Outdated Show resolved Hide resolved
src/middleware/withAuthorizedSpace.js Outdated Show resolved Hide resolved
src/middleware/withAuthorizedSpace.types.ts Outdated Show resolved Hide resolved
src/middleware/withAuthorizedSpace.js Show resolved Hide resolved
src/middleware/withAuthorizedSpace.types.ts Show resolved Hide resolved
src/middleware/withEgressClient.js Outdated Show resolved Hide resolved
src/middleware/withEgressClient.js Outdated Show resolved Hide resolved
test/helpers/builder.js Show resolved Hide resolved
@fforbeck fforbeck force-pushed the feat/ucanto-integration branch from 010162b to a15f8a6 Compare November 13, 2024 17:01
@fforbeck fforbeck self-assigned this Nov 13, 2024
@fforbeck fforbeck merged commit 22bed68 into main Nov 13, 2024
1 check passed
@fforbeck fforbeck deleted the feat/ucanto-integration branch November 13, 2024 19:03
fforbeck pushed a commit that referenced this pull request Dec 19, 2024
🤖 I have created a release *beep* *boop*
---


##
[2.22.0](v2.21.0...v2.22.0)
(2024-12-19)


### Features

* egress client - ucanto integration
([#123](#123))
([22bed68](22bed68))
* enable egress tracking in production env
([#135](#135))
([ad43b62](ad43b62))
* **indexer:** probabilistic feature flag
([#136](#136))
([dca2b35](dca2b35))
* ucan invocation handler
([#133](#133))
([b199bfa](b199bfa))
* Use Indexing Service when feature flag is present
([#132](#132))
([fa3f480](fa3f480))


### Bug Fixes

* **config:** staging kv bidding
([#134](#134))
([7a523d5](7a523d5))
* **egress-client:** set nonce, expire and fix servedAt
([#130](#130))
([b135643](b135643))
* enable open telemetry for all envs
([#131](#131))
([c822465](c822465))

---
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>
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