Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ocelotl committed Dec 6, 2023
1 parent e95fa27 commit 87b9cc6
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 6 deletions.
6 changes: 4 additions & 2 deletions prototypes/python/tests/data/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,10 @@ tracer_provider:
always_on: {}
# Configure local_parent_not_sampled sampler.
local_parent_not_sampled:
# Configure sampler to be always_off.
always_off: {}
parent_based:
remote_parent_not_sampled:
trace_id_ratio_based:
ratio: 0.0001

# Configure resource for all signals.
resource:
Expand Down
72 changes: 68 additions & 4 deletions prototypes/python/tests/test_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,76 @@ def test_create_object():
)
)

resource = create_object(configuration, processed_schema, "resource")

set_resource(resource)
set_resource(
create_object(configuration, processed_schema, "resource")
)

tracer_provider = create_object(
configuration, processed_schema, "tracer_provider"
)

tracer_provider
assert (
tracer_provider.
sampler.
parent_based.
root.
trace_id_ratio_based.
_root.
_rate
) == 0.0001

assert (
tracer_provider.
sampler.
parent_based.
local_parent_not_sampled.
parent_based.
remote_parent_not_sampled.
trace_id_ratio_based.
_root.
_rate
) == 0.0001

assert (
tracer_provider.
_span_limits.
max_events
) == 128

assert (
tracer_provider.
_active_span_processor.
_span_processors[0].
max_queue_size
) == 2048

assert (
tracer_provider.
_active_span_processor.
_span_processors[0].
span_exporter.
_headers["api-key"]
) == "1234"

assert (
tracer_provider.
_active_span_processor.
_span_processors[1].
span_exporter.
endpoint
) == "http://localhost:9411/api/v2/spans"

assert (
tracer_provider.
_active_span_processor.
_span_processors[2].
span_exporter.
__class__.
__name__
) == "ConsoleSpanExporter"

assert (
tracer_provider.
_resource.
_schema_url
) == "https://opentelemetry.io/schemas/1.16.0"

0 comments on commit 87b9cc6

Please sign in to comment.