Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/bundler/resources/azure/webmock-t…
Browse files Browse the repository at this point in the history
…w-3.19.1
  • Loading branch information
arielvalentin authored Sep 30, 2023
2 parents b00d173 + 1e8fd4e commit d722e8e
Show file tree
Hide file tree
Showing 10 changed files with 77 additions and 24 deletions.
3 changes: 2 additions & 1 deletion .toys/.toys.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
toys_version! ">= 0.14.5"
toys_version! "0.14.7"

load_git remote: "https://github.com/dazuma/toys.git",
path: ".toys/release",
as: "release",
commit: "toys/v0.14.7",
update: 3600
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ As with other OpenTelemetry clients, opentelemetry-ruby follows the
### Focus on Capabilities, Not Structure Compliance

OpenTelemetry is an evolving specification, one where the desires and
use cases are clear, but the method to satisfy those uses cases are not.
use cases are clear, but the method to satisfy those use cases are not.

As such, Contributions should provide functionality and behavior that
conforms to the specification, but the interface and structure are flexible.
Expand Down
4 changes: 4 additions & 0 deletions instrumentation/bunny/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-bunny

### v0.21.1 / 2023-09-27

* FIXED: Headers property needs to exist

### v0.21.0 / 2023-09-07

* FIXED: Align messaging instrumentation operation names
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def self.destination_name(exchange, routing_key)
def self.extract_context(properties)
# use the receive span as parent context
parent_context = OpenTelemetry.propagation.extract(properties[:tracer_receive_headers])
return [parent_context, nil] if properties[:headers].nil?

# link to the producer context
producer_context = OpenTelemetry.propagation.extract(properties[:headers])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module Bunny
VERSION = '0.21.0'
VERSION = '0.21.1'
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# frozen_string_literal: true

# Copyright The OpenTelemetry Authors
#
# SPDX-License-Identifier: Apache-2.0

require_relative '../../../../lib/opentelemetry/instrumentation/bunny/patch_helpers'

describe OpenTelemetry::Instrumentation::Bunny::PatchHelpers do
let(:properties) do
{
headers: {
'traceparent' => '00-eab67ae26433f603121bd5674149d9e1-2007f3325d3cb6d6-01'
},
tracer_receive_headers: {
'traceparent' => '00-cd52775b3cb38931adf5fa880f890c25-cddb52a470027489-01'
}
}
end

describe '.extract_context' do
it 'returns the parent context with links when headers from producer exists' do
parent_context, links = OpenTelemetry::Instrumentation::Bunny::PatchHelpers.extract_context(properties)
_(parent_context).must_be_instance_of(OpenTelemetry::Context)
_(links).must_be_instance_of(Array)
_(links.first).must_be_instance_of(OpenTelemetry::Trace::Link)
end

it 'returns the parent context with no links when headers from producer not present' do
properties.delete(:headers)
parent_context, links = OpenTelemetry::Instrumentation::Bunny::PatchHelpers.extract_context(properties)
_(parent_context).must_be_instance_of(OpenTelemetry::Context)
_(links).must_be_nil
end
end
end
1 change: 1 addition & 0 deletions instrumentation/bunny/test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@
c.error_handler = ->(exception:, message:) { raise(exception || message) }
c.logger = Logger.new($stderr, level: ENV.fetch('OTEL_LOG_LEVEL', 'fatal').to_sym)
c.add_span_processor SPAN_PROCESSOR
c.propagators = [OpenTelemetry::Trace::Propagation::TraceContext.text_map_propagator]
end
4 changes: 4 additions & 0 deletions instrumentation/graphql/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Release History: opentelemetry-instrumentation-graphql

### v0.26.7 / 2023-09-27

* FIXED: Micro optimization: build Hash w/ {} (https://github.com/open-telemetry/opentelemetry-ruby-contrib/pull/665)

### v0.26.6 / 2023-08-26

* FIXED: Improve GraphQL tracing compatibility with other tracers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ def execute_field(field:, query:, ast_node:, arguments:, object:, &block)
platform_key = _otel_execute_field_key(field: field)
return super unless platform_key

attributes = {}
attributes['graphql.field.parent'] = field.owner&.graphql_name
attributes['graphql.field.name'] = field.graphql_name
attributes['graphql.lazy'] = false
attributes = {
'graphql.field.parent' => field.owner&.graphql_name,
'graphql.field.name' => field.graphql_name,
'graphql.lazy' => false
}

tracer.in_span(platform_key, attributes: attributes, &block)
end
Expand All @@ -87,10 +88,11 @@ def execute_field_lazy(field:, query:, ast_node:, arguments:, object:, &block)
platform_key = _otel_execute_field_key(field: field)
return super unless platform_key

attributes = {}
attributes['graphql.field.parent'] = field.owner&.graphql_name
attributes['graphql.field.name'] = field.graphql_name
attributes['graphql.lazy'] = true
attributes = {
'graphql.field.parent' => field.owner&.graphql_name,
'graphql.field.name' => field.graphql_name,
'graphql.lazy' => true
}

tracer.in_span(platform_key, attributes: attributes, &block)
end
Expand All @@ -99,9 +101,10 @@ def authorized(query:, type:, object:, &block)
platform_key = @_otel_authorized_key_cache[type]
return super unless platform_key

attributes = {}
attributes['graphql.type.name'] = type.graphql_name
attributes['graphql.lazy'] = false
attributes = {
'graphql.type.name' => type.graphql_name,
'graphql.lazy' => false
}

tracer.in_span(platform_key, attributes: attributes, &block)
end
Expand All @@ -110,29 +113,32 @@ def authorized_lazy(query:, type:, object:, &block)
platform_key = @_otel_authorized_key_cache[type]
return super unless platform_key

attributes = {}
attributes['graphql.type.name'] = type.graphql_name
attributes['graphql.lazy'] = true
attributes = {
'graphql.type.name' => type.graphql_name,
'graphql.lazy' => true
}

tracer.in_span(platform_key, attributes: attributes, &block)
end

def resolve_type(query:, type:, object:, &block)
platform_key = @_otel_resolve_type_key_cache[type]

attributes = {}
attributes['graphql.type.name'] = type.graphql_name
attributes['graphql.lazy'] = false
attributes = {
'graphql.type.name' => type.graphql_name,
'graphql.lazy' => false
}

tracer.in_span(platform_key, attributes: attributes, &block)
end

def resolve_type_lazy(query:, type:, object:, &block)
platform_key = @_otel_resolve_type_key_cache[type]

attributes = {}
attributes['graphql.type.name'] = type.graphql_name
attributes['graphql.lazy'] = true
attributes = {
'graphql.type.name' => type.graphql_name,
'graphql.lazy' => true
}

tracer.in_span(platform_key, attributes: attributes, &block)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
module OpenTelemetry
module Instrumentation
module GraphQL
VERSION = '0.26.6'
VERSION = '0.26.7'
end
end
end

0 comments on commit d722e8e

Please sign in to comment.