Skip to content

Let DataFetcher Instrumenter accept the response as Object instead of Void and use DataFetcherResult for Span Status in graphql-java instrumentation #15281

@bioplasticlining

Description

@bioplasticlining

Is your feature request related to a problem? Please describe.

The technical problem:

  1. To propose changing the signature of dataFetcherInstrumenter (internal) in io.opentelemetry.instrumentation.graphql.v20_0.GraphqlInstrumenterFactory to Instrumenter<DataFetchingEnvironment, Object> (i.e. RESPONSE from Void to Object).

  2. Additionally, the default createDataFetcherInstrumenter to set a SpanStatusExtractor to perform a result instanceof DataFetcherResult and use hasErrors() to set Span Status to Error before defaulting to the Throwable. Basically copying existing behaviour for operations.

The use case:

The GraphQL-Java framework allows DataFetchers to return DataFetcherResult DataFetcherResult - graphql-java 20.0 javadoc. This can contain errors objects that signify error that is currently missed unless you look at the operation span.

There is also no way to customise this behaviour through the incubating InstrumenterCustomizer because the input is missing.

Describe the solution you'd like

I think this should be a straightforward change if there are no objections. As described above.

Describe alternatives you've considered

It doesn’t seem that an alternative exists, but I’m open to suggestions.

Additional context

N/A

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds triageNew issue that requires triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions