Skip to content

Commit

Permalink
Create base classes for all
Browse files Browse the repository at this point in the history
  • Loading branch information
jterapin committed Jul 29, 2024
1 parent 3558787 commit 50177ff
Show file tree
Hide file tree
Showing 21 changed files with 316 additions and 173 deletions.
6 changes: 3 additions & 3 deletions codegen/projections/rails_json/lib/rails_json/config.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/projections/rails_json/sig/rails_json/client.rbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/projections/rails_json/sig/rails_json/config.rbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions codegen/projections/rpcv2_cbor/lib/rpcv2_cbor/config.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/client.rbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/projections/rpcv2_cbor/sig/rpcv2_cbor/config.rbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions codegen/projections/white_label/lib/white_label/config.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/projections/white_label/sig/white_label/client.rbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion codegen/projections/white_label/sig/white_label/config.rbs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 7 additions & 5 deletions codegen/projections/white_label/spec/telemetry_spec.rb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,18 @@
module WhiteLabel
describe Config do
context 'telemetry_provider' do
let(:custom_class) do
Class.new(Hearth::Telemetry::TelemetryProviderBase)
end

let(:custom_provider) { custom_class.new }

it 'raises error when given an invalid input', rbs_test: :skip do
expect { Config.new(telemetry_provider: 'foo').validate! }
.to raise_error(
ArgumentError,
'Expected config[:telemetry_provider] to be in ' \
'[Hearth::Telemetry::TelemetryProvider], got String.'
'[Hearth::Telemetry::TelemetryProviderBase], got String.'
)
end

Expand All @@ -23,10 +29,6 @@ module WhiteLabel
end

it 'does not raise error when given a custom provider' do
custom_provider = Hearth::Telemetry::TelemetryProvider.new(
tracer_provider: Hearth::Telemetry::NoOpTracerProvider.new,
context_manager: Hearth::Telemetry::NoOpContextManager.new
)
expect { Config.new(telemetry_provider: custom_provider).validate! }
.not_to raise_error
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ The SDK currently supports OpenTelemetry (OTel) as a provider. To use
.name("telemetry_provider")
.defaultValue("Hearth::Telemetry::NoOpTelemetryProvider.new")
.documentation(telemetryProviderDocumentation)
.documentationRbsAndValidationType("Hearth::Telemetry::TelemetryProvider")
.documentationRbsAndValidationType("Hearth::Telemetry::TelemetryProviderBase")
.documentationDefaultValue("Hearth::Telemetry::NoOpTelemetryProvider.new")
.build();

Expand Down
15 changes: 10 additions & 5 deletions hearth/lib/hearth/telemetry.rb
Original file line number Diff line number Diff line change
@@ -1,25 +1,30 @@
# frozen_string_literal: true

require_relative 'telemetry/telemetry_provider'
require_relative 'telemetry/base'
require_relative 'telemetry/span_kind'
require_relative 'telemetry/span_status'
require_relative 'telemetry/no_op'
require_relative 'telemetry/otel'

module Hearth
# # Telemetry
# Observability is the extent to which a system's current state can be
# inferred from the data it emits. The data emitted is commonly referred
# as telemetry. The AWS SDK for Ruby currently supports traces as
# as Telemetry. The AWS SDK for Ruby currently supports traces as
# a telemetry signal.
#
# A telemetry provider is used to emit telemetry data. By default, the
# `NoOpTelemetryProvider` will not record or emit any telemetry data.
# The SDK currently supports OpenTelemetry (OTel) as a provider. See
# {OTelProvider} for more information.
#
# If a provider isn't supported, you can implement your own support by
# following the telemetry interfaces defined in RBS.
# If a provider isn't supported, you can implement your own provider by
# following by inheriting the following base classes and implementing
# interface defined:
# * {TelemetryProviderBase}
# * {ContextManagerBase}
# * {TracerProviderBase}
# * {TracerBase}
# * {SpanBase}
module Telemetry
# @api private
def self.otel_loaded?
Expand Down
Loading

0 comments on commit 50177ff

Please sign in to comment.