graphql-hive / graphql-hive/envelop

OpenTelemetry support propagation of trace

Open
#1,759 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
No language data
Stars
827
Forks
132
PR merge metrics
No merged PRs in 30d

Description

### Description

I would like to have the ability to propagate a trace to another service. I am unable to find a way to propogate the trace as the opentelemetry context is not set

Ideally I would use something simple like `opentelemetry.propagation.inject(api.context.active(), extensions);` but because the context is not set anywhere this will not work.

I have looked at implementing this as part of the plugin but cant see an obvious way as normally you would call something like:

```js
opentelemetry.context.with(ctx, () => {
// wrapped function
})
```

[See]()

But I don't think you can wrap another plugin as they are called one after another and seems its not achievable in envelope unless I am missing something.

### An alternative approach

We could set the active context for opentelemetry into the graphql context and allow it to be accessed that way.
e.g. adding a field

```js
context[activeContext] = opentelemetry.trace.setSpan(opentelemetry.context.active(), context[tracingSpanSymbol]);
```

Then provide a getter from the opentelemetry package.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.