googleads / google-ads-dotnet

This project hosts the .NET client library for the Google Ads API.

Home Page:https://developers.google.com/google-ads/api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I add my own GRPC interceptors?

wub opened this issue · comments

We want to use something like Lunar to help with rate limiting, specifically the Agentless mode.

Is it possible (or recommended) to attach my own GRPC client interceptor to modify all outgoing requests to be compatible with Lunar?

We want to change the hostname for all requests to the IP of the Lunar proxy, and add a custom Host header that points to the original hostname.

I am able to create a basic interceptor, but I'm not sure how to attach it to the correct channel. Do I have to fetch the channel on a per-service basis? (If so, how would I do that?)

Or, is there a better approach?

Thanks!

@wub This would definitely require a code change. The grpc interceptors are wired here:

The class is internal, so any change would require enhancement.

Could you download the library, manually modify and make sure the Lunar functionality works as expected? If so, let us know, we can add a callback hook so you can add the necessary interceptor at the runtime.