Skip to content

Commit

Permalink
docs: Improve formatting of usage examples in OpenTelemetry SDK rubyd…
Browse files Browse the repository at this point in the history
  • Loading branch information
richardmcmillen committed Oct 3, 2022
1 parent 652e319 commit 18bfd39
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
34 changes: 17 additions & 17 deletions sdk/lib/opentelemetry/sdk/trace/export/in_memory_span_exporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@ module Trace
module Export
# A SpanExporter implementation that can be used to test OpenTelemetry integration.
#
# Example usage in a test suite:
# @example Usage in a test suite:
# class MyClassTest
# def setup
# @tracer_provider = TracerProvider.new
# # The default is `recording: true`, which is appropriate in non-test environments.
# @exporter = InMemorySpanExporter.new(recording: false)
# @tracer_provider.add_span_processor(SimpleSampledSpansProcessor.new(@exporter))
# end
#
# class MyClassTest
# def setup
# @tracer_provider = TracerProvider.new
# # The default is `recording: true`, which is appropriate in non-test environments.
# @exporter = InMemorySpanExporter.new(recording: false)
# @tracer_provider.add_span_processor(SimpleSampledSpansProcessor.new(@exporter))
# end
#
# def test_finished_spans
# @exporter.recording = true
# @tracer_provider.tracer.in_span("span") {}
# def test_finished_spans
# @exporter.recording = true
# @tracer_provider.tracer.in_span("span") {}
#
# spans = @exporter.finished_spans
# spans.wont_be_nil
# spans.size.must_equal(1)
# spans[0].name.must_equal("span")
# spans = @exporter.finished_spans
# spans.wont_be_nil
# spans.size.must_equal(1)
# spans[0].name.must_equal("span")
#
# @exporter.recording = false
# @exporter.recording = false
# end
# end
class InMemorySpanExporter
# Controls whether or not the exporter will record spans, or discard them.
Expand Down
1 change: 1 addition & 0 deletions sdk/lib/opentelemetry/sdk/trace/export/metrics_reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Export
# the unstable OpenTelemetry Metrics API. An example implementation in
# terms of StatsD is:
#
# @example
# module MetricsReporter
# def add_to_counter(metric, increment: 1, labels: {})
# StatsD.increment(metric, increment, labels, no_prefix: true)
Expand Down

0 comments on commit 18bfd39

Please sign in to comment.