Class: Instana::Instrumentation::GraphqlTracing
- Inherits:
-
GraphQL::Tracing::PlatformTracing
- Object
- GraphQL::Tracing::PlatformTracing
- Instana::Instrumentation::GraphqlTracing
- Defined in:
- lib/instana/instrumentation/graphql.rb
Instance Method Summary collapse
- #platform_authorized_key(type) ⇒ Object
- #platform_field_key(type, field) ⇒ Object
- #platform_resolve_type_key(type) ⇒ Object
- #platform_trace(platform_key, key, data) ⇒ Object
Instance Method Details
#platform_authorized_key(type) ⇒ Object
52 53 54 |
# File 'lib/instana/instrumentation/graphql.rb', line 52 def (type) "#{type.graphql_name}.authorized.graphql" end |
#platform_field_key(type, field) ⇒ Object
48 49 50 |
# File 'lib/instana/instrumentation/graphql.rb', line 48 def platform_field_key(type, field) "#{type.graphql_name}.#{field.graphql_name}" end |
#platform_resolve_type_key(type) ⇒ Object
56 57 58 |
# File 'lib/instana/instrumentation/graphql.rb', line 56 def platform_resolve_type_key(type) "#{type.graphql_name}.resolve_type.graphql" end |
#platform_trace(platform_key, key, data) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/instana/instrumentation/graphql.rb', line 18 def platform_trace(platform_key, key, data) return yield unless key == 'execute_query' operation = data[:query].selected_operation arguments = [] fields = [] operation.selections.each do |field| arguments.concat(walk_fields(field, :arguments)) fields.concat(walk_fields(field, :selections)) end payload = { operationName: data[:query].operation_name || 'anonymous', operationType: operation.operation_type, arguments: grouped_fields(arguments), fields: grouped_fields(fields), } begin span = ::Instana.tracer.start_span(:'graphql.server', attributes: {graphql: payload}) yield rescue Exception => e span.record_exception(e) raise e ensure span.finish end end |