Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

feat/enterpriseportal: implement GetCodyGatewayUsage RPC#63555

Merged
bobheadxi merged 3 commits intomainfrom
06-28-feat_enterpriseportal_implement_getcodygatewayusage_rpc
Jul 2, 2024
Merged

feat/enterpriseportal: implement GetCodyGatewayUsage RPC#63555
bobheadxi merged 3 commits intomainfrom
06-28-feat_enterpriseportal_implement_getcodygatewayusage_rpc

Conversation

@bobheadxi
Copy link
Member

@bobheadxi bobheadxi commented Jun 28, 2024

Uses the refactors from #63528 and the new RPC proposed in #63531 to implement the existing GraphQL query for getting Cody Gateway usage stats using Enterprise Portal. Also adds some basic instrumentation on codygatewayevents.Service.

Closes https://linear.app/sourcegraph/issue/CORE-201
Requires https://github.com/sourcegraph/managed-services/pull/1685

Test plan

Without setting any new vars:

$ sg run enterprise-portal
# ...
[enterprise-...l] WARN service.codygatewayevents service/codygatewayevents.go:11 CodyGatewayEvents service is not configured

Add to sg.config.overwrite.yaml:

  enterprise-portal:
    env:
      CODY_GATEWAY_EVENTS_PROJECT_ID: telligentsourcegraph

The client auths by default credentials, so if you have access to the dataset everything will "just work". Request S2 data by subscription ID at :6081/debug/grpcui/:

Screenshot 2024-06-28 at 1 55 49 PM

@cla-bot cla-bot bot added the cla-signed label Jun 28, 2024
Copy link
Member Author

bobheadxi commented Jun 28, 2024

@bobheadxi bobheadxi requested review from a team and eseliger June 28, 2024 21:17
@bobheadxi bobheadxi marked this pull request as ready for review June 28, 2024 21:17
Copy link
Member

Choose a reason for hiding this comment

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

Q: Should this be a panic case? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer it not to be, as if anything goes terribly borked I'd like to retain the option to just disable it

Copy link
Member

Choose a reason for hiding this comment

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

could we have a constant for "codyaccess" too? That way I could hover over it and see a docstring to understand what this does :D

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I opened a PR upstream: sourcegraph/sourcegraph-accounts-sdk-go#49

I'll circle back and update the existing callsites in a follow-up :)

Copy link
Member

Choose a reason for hiding this comment

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

cool pattern :)

@bobheadxi bobheadxi force-pushed the rp-cody-gateway-usage-rpc branch from 3dfb7af to 9ef8c09 Compare July 2, 2024 16:01
@bobheadxi bobheadxi force-pushed the 06-28-feat_enterpriseportal_implement_getcodygatewayusage_rpc branch 2 times, most recently from 367babb to 2b96db1 Compare July 2, 2024 16:14
@bobheadxi bobheadxi changed the base branch from rp-cody-gateway-usage-rpc to graphite-base/63555 July 2, 2024 16:25
@graphite-app graphite-app bot changed the base branch from graphite-base/63555 to main July 2, 2024 16:25
@bobheadxi bobheadxi force-pushed the 06-28-feat_enterpriseportal_implement_getcodygatewayusage_rpc branch from 2b96db1 to 9a9cf36 Compare July 2, 2024 16:25
@bobheadxi bobheadxi merged commit 99c4320 into main Jul 2, 2024
Copy link
Member Author

Merge activity

@bobheadxi bobheadxi deleted the 06-28-feat_enterpriseportal_implement_getcodygatewayusage_rpc branch July 2, 2024 16:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants