Usage reporting plugin

Hi.

This plugin helps us to select the input variables to send to apollo studio for logging purpose.
To meet PII compliance, we need to select only a few input variables.

The problem is that there is no documentation how it works with nested objects.
i.e.

mutation updatePaymentMutation($paymentInput: UpdatePaymentInput) {
  updatePayment(input: $paymentInput) {
    Id
    __typename
  }
}

And UpdatePaymentInput is the object:

{
  "paymentInput": {
    "id": "...",
    "address": "...",
    "city": "..."
  }
}

and I used the plugin like the followings:

new ApolloServerPluginUsageReporting({
  sendVariableValues: {
    exceptNames: ['address', 'city']
  }
})

But apollo studio is still showing the address and city field as a part of Traces.

What is the best way to hide them all?
Is there any special logic for the nested input?

Cheers

Hello, good question! We’ll make a note to clarify this further in the docs.

The exceptNames array specifies the names of entire variables to omit, as opposed to individual fields of a variable that is an input type.

To selectively omit fields from an input type, you can instead provide a transform function as the value of sendVariableValues, such as the following:

{
  transform: ({ variables, operationString}) {
    let variablesCopy = { ...variables };
    // Perform transformations on variablesCopy here.
    // You can modify or remove existing values,
    // but you can't add new values
    return variablesCopy
  }
}