Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions api/lib/opentelemetry/internal/proxy_tracer_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ def delegate=(provider)
#
# @param [optional String] name Instrumentation package name
# @param [optional String] version Instrumentation package version
# @param [optional String] schema_url Specifies the Schema URL
# @param [optional Hash] attributes Specifies the scope attributes
#
# @return [Tracer]
def tracer(name = nil, version = nil)
def tracer(name = nil, version = nil, schema_url = nil, attributes = nil)
@mutex.synchronize do
return @delegate.tracer(name, version) unless @delegate.nil?
return @delegate.tracer(name, version, schema_url, attributes) unless @delegate.nil?

@registry[Key.new(name, version)] ||= ProxyTracer.new
end
Expand Down
4 changes: 3 additions & 1 deletion api/lib/opentelemetry/trace/tracer_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ class TracerProvider
#
# @param [optional String] name Instrumentation package name
# @param [optional String] version Instrumentation package version
# @param [optional String] schema_url Specifies the Schema URL
# @param [optional Hash] attributes Specifies the scope attributes
#
# @return [Tracer]
def tracer(name = nil, version = nil)
def tracer(name = nil, version = nil, schema_url = nil, attributes = nil)
@tracer ||= Tracer.new
end
end
Expand Down
4 changes: 3 additions & 1 deletion exporter/otlp/lib/opentelemetry/exporter/otlp/exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ def encode(span_data) # rubocop:disable Metrics/MethodLength, Metrics/Cyclomatic
Opentelemetry::Proto::Trace::V1::ScopeSpans.new(
scope: Opentelemetry::Proto::Common::V1::InstrumentationScope.new(
name: il.name,
version: il.version
version: il.version,
schema_url: il.schema_url,
attributes: il.attribute&.map { |k, v| as_otlp_key_value(k, v) }
),
spans: sds.map { |sd| as_otlp_span(sd) }
)
Expand Down
8 changes: 6 additions & 2 deletions sdk/lib/opentelemetry/sdk/instrumentation_scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
module OpenTelemetry
module SDK
# InstrumentationScope is a struct containing scope information for export.
InstrumentationScope = Struct.new(:name,
:version)
InstrumentationScope = Struct.new(
:name,
:version,
:schema_url,
:attributes
)
end
end
2 changes: 1 addition & 1 deletion sdk/lib/opentelemetry/sdk/trace/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class Tracer < OpenTelemetry::Trace::Tracer
# @param [TracerProvider] tracer_provider TracerProvider that initialized the tracer
#
# @return [Tracer]
def initialize(name, version, tracer_provider)
def initialize(name, version, schema_url, attributes, tracer_provider)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're not yet storing the new params anywhere?

@instrumentation_scope = InstrumentationScope.new(name, version)
@tracer_provider = tracer_provider
end
Expand Down
6 changes: 4 additions & 2 deletions sdk/lib/opentelemetry/sdk/trace/tracer_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@ def initialize(sampler: sampler_from_environment(Samplers.parent_based(root: Sam
#
# @param [optional String] name Instrumentation package name
# @param [optional String] version Instrumentation package version
# @param [optional String] schema_url Specifies the Schema URL
# @param [optional Hash] attributes Specifies the scope attributes
#
# @return [Tracer]
def tracer(name = nil, version = nil)
def tracer(name = nil, version = nil, schema_url = nil, attributes = nil)
name ||= ''
version ||= ''
OpenTelemetry.logger.warn 'calling TracerProvider#tracer without providing a tracer name.' if name.empty?
@registry_mutex.synchronize { @registry[Key.new(name, version)] ||= Tracer.new(name, version, self) }
@registry_mutex.synchronize { @registry[Key.new(name, version)] ||= Tracer.new(name, version, schema_url, attributes, self) }
end

# Attempts to stop all the activity for this {TracerProvider}. Calls
Expand Down
Loading