router icon indicating copy to clipboard operation
router copied to clipboard

Studio Operation Usage Reporting: ability to exclude specific requests

Open abernix opened this issue 3 years ago • 10 comments

Is your feature request related to a problem? Please describe. In some use cases, particular requests are less valuable to transmit to Studio — for example, particular testing or bot traffic.

Describe the solution you'd like Today, in Apollo Server, there is an includeRequest function (see documentation) that can be used to exclude particular requests. This is specified as a function/closure that receives the request context and returns a boolean: (includeRequest: (requestContext): boolean).

A common case scenario is to check for a particular header, though for other cases, custom logic may be desirable.

cc @garypen

abernix avatar Jan 27 '22 10:01 abernix

This feels like it may be nice to implement using our upcoming extension functionality. I could imagine a service which processes each request and updates the request context to include/exclude from studio usage reporting. I'll look at this when the extension functionality lands in main.

garypen avatar Feb 08 '22 14:02 garypen

Following discussion with the team, this is going to be implemented within the apollo telemetry implementation.

garypen avatar Feb 11 '22 14:02 garypen

I've renamed the title of this issue to include a more specific name, given the introduction of other Studio functionality and to reduce the potential ambiguity.

abernix avatar Apr 29 '22 07:04 abernix

Marked as in progress because in #898 we check for the presence of a field in the request.context, but we still need to add yml configuration with an excludeList of operationNames for example

o0Ignition0o avatar May 05 '22 16:05 o0Ignition0o

I think we should avoid yaml config and rely on Rhai for this one.

BrynCooke avatar May 05 '22 16:05 BrynCooke

Sgtm!

o0Ignition0o avatar May 05 '22 16:05 o0Ignition0o

Closing this ticket since it is closed on the project board.

nateql avatar May 09 '22 14:05 nateql

Just FYI, I have some feedback on https://github.com/apollographql/router/pull/898/files related to this unfinished feature — search my comments for STUDIO_EXCLUDE.

glasser avatar May 11 '22 00:05 glasser

This issue wasn't meant to be closed — the work isn't done.

abernix avatar Aug 16 '22 06:08 abernix

Worth noting that we also have https://github.com/apollographql/router/issues/1359 which touches on tracing aspects of this.

abernix avatar Aug 16 '22 06:08 abernix

This is implemented already. Users can insert apollo_telemetry::studio::exclude into context to disable metrics for a particular request. Note that this does not affect operation count.

BrynCooke avatar Mar 21 '23 09:03 BrynCooke