opentelemetry-erlang-contrib icon indicating copy to clipboard operation
opentelemetry-erlang-contrib copied to clipboard

Telemetry-based Absinthe instrumentation

Open andrewhr opened this issue 2 years ago • 4 comments

Add instrumentation for Absinthe, the GraphQL Elixir-framwork. Relies on some new telemetry work on Absinthe:

Span names and attributes also follow the JavaScript impl, the closes to a future Semantic Attribute spec.

The "span tracker" used here is to connect traces in a shape that resembles the query shape instead of execution shape. One example is:

query {
  users {
    name
  }
}

In case name is an async resolver (for example), the execution will resembles a recursive function, and such our trace will be:

RootQueryType.users
  User.name
    User.name
      User.name

With the span tracker, the above trace will become:

RootQueryType.users
  User.name
  User.name
  User.name

That helps visually scan the traces, and it's friendly to folks who doesn't know much about Absinthe internals.

andrewhr avatar May 27 '22 15:05 andrewhr

@tsloughter this is the instrumentation we talked few weeks ago on EEF observability WG meeting.

It's posted as draft for two reasons:

  • First, it depends in unreleased and WIP work on Absinthe mainline to fully work. Tests are broken reflecting that.
  • The hex.pm library is already published from https://github.com/primait/opentelemetry_absinthe, though it follows different strategies. I see how we can coordinate to merge and/or re-release from here OR release under a different name.

andrewhr avatar May 27 '22 15:05 andrewhr

Hey @andrewhr could you make the absinthe WIP features you are relying on more explicit? I'm considering pulling in the code (until the PR can be merged and the package adopted from @primait) in our current project.

rewritten avatar Aug 02 '22 15:08 rewritten

Hey @rewritten!

I linked all Absinthe issues in the description of this issue here.

The gist is, we need telemetry events for all kinds of helpers/middleware (async/batch), and they need to be fired from inside the internal Tasks created by those middleware (so span propagation works, as it tracks spans from parent processes).

There is one case which events exists, but they're not well located and propagation does work - this specific case is handled here https://github.com/absinthe-graphql/absinthe/pull/1170.

andrewhr avatar Aug 05 '22 13:08 andrewhr

@andrewhr coming up on a year so I thought I'd check on if there was anything knew around absinthe integration?

tsloughter avatar Apr 30 '23 18:04 tsloughter