Skip to content

Commit

Permalink
Add example and testing for graphql 1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
toneymathews committed Jul 22, 2022
1 parent c6a77dd commit 0d51457
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions instrumentation/graphql/Appraisals
Expand Up @@ -4,6 +4,10 @@
#
# SPDX-License-Identifier: Apache-2.0

appraise 'graphql-1.13' do
gem 'graphql', '~> 1.13.0'
end

appraise 'graphql-1.11' do
gem 'graphql', '~> 1.11.0'
end
Expand Down
21 changes: 21 additions & 0 deletions instrumentation/graphql/README.md
Expand Up @@ -53,6 +53,27 @@ OpenTelemetry::SDK.configure do |c|
end
```

#### GraphQL context configuration

Optionally, GraphQL execution context can include tracing option keys to control tracing behaviour independently per execution.

An option's global configuration must be enabled for the associated context option to be respected. This is supported for `graphql-ruby` version `>= 1.13.13 < 2` or `>= 2.0.9`.

| | Global Enabled | Global Disabled |
|:---:|:---:|:---:|
| **Context Unset** |||
| **Context Enabled** |||
| **Context Disabled** |||

```ruby
query = GraphQL::Query.new(MyAppSchema, 'query { foo }')

opentelemetry_context = query.context.namespace(:opentelemetry)
opentelemetry_context[:enable_platform_field] = true
opentelemetry_context[:enable_platform_authorized] = true
opentelemetry_context[:enable_platform_resolve_type] = true
```

## Examples

An example of usage can be seen in [`example/graphql.rb`](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/main/instrumentation/graphql/example/graphql.rb).
Expand Down

0 comments on commit 0d51457

Please sign in to comment.