Skip to content

Commit

Permalink
Add yaml test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff committed Feb 25, 2024
1 parent 0bfbe8f commit d147b62
Show file tree
Hide file tree
Showing 12 changed files with 624 additions and 53 deletions.
42 changes: 42 additions & 0 deletions examples/yaml/anchors.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# anchors.yaml demonstrates anchor substitution to reuse OTLP exporter configuration across signals.

file_format: "0.1"
exporters:
otlp: &otlp-exporter
protocol: http/protobuf
endpoint: http://localhost:4318
certificate: /app/cert.pem
client_key: /app/cert.pem
client_certificate: /app/cert.pem
headers:
api-key: !!str 1234
compression: gzip
timeout: 10000

logger_provider:
processors:
- batch:
exporter:
otlp:
# expand the otlp-exporter anchor
<<: *otlp-exporter

meter_provider:
readers:
- periodic:
interval: 5000
timeout: 30000
exporter:
otlp:
# expand the otlp-exporter anchor and add metric specific configuration
<<: *otlp-exporter
temporality_preference: delta
default_histogram_aggregation: base2_exponential_bucket_histogram

tracer_provider:
processors:
- batch:
exporter:
otlp:
# expand the otlp-exporter anchor
<<: *otlp-exporter
2 changes: 1 addition & 1 deletion examples/yaml/custom_sampler_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ static CustomSamplerBuilder singleton;

void CustomSamplerBuilder::Register(opentelemetry::sdk::init::Registry *registry)
{
registry->AddExtensionSamplerBuilder("custom", &singleton);
registry->AddExtensionSamplerBuilder("my_custom_sampler", &singleton);
};
2 changes: 1 addition & 1 deletion examples/yaml/custom_span_exporter_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ static CustomSpanExporterBuilder singleton;

void CustomSpanExporterBuilder::Register(opentelemetry::sdk::init::Registry *registry)
{
registry->AddExtensionSpanExporterBuilder("custom", &singleton);
registry->AddExtensionSpanExporterBuilder("my_custom_span_exporter", &singleton);
};
2 changes: 1 addition & 1 deletion examples/yaml/custom_span_processor_builder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ static CustomSpanProcessorBuilder singleton;

void CustomSpanProcessorBuilder::Register(opentelemetry::sdk::init::Registry *registry)
{
registry->AddExtensionSpanProcessorBuilder("custom", &singleton);
registry->AddExtensionSpanProcessorBuilder("my_custom_span_processor", &singleton);
};
55 changes: 55 additions & 0 deletions examples/yaml/extensions.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# The file format version
file_format: "0.1"

# Configure if the SDK is disabled or not. This is not required to be provided
# to ensure the SDK isn't disabled, the default value when this is not provided
# is for the SDK to be enabled.
#
# Environment variable: OTEL_SDK_DISABLED
disabled: false

# Configure text map context propagators.
#
# Environment variable: OTEL_PROPAGATORS
propagator:
# composite: [tracecontext, baggage, b3, b3multi, jaeger, xray, ottrace]
simple: tracecontext

# Configure tracer provider.
tracer_provider:
# Configure span processors.
processors:
# Configure a batch span processor.
- batch:
# Configure exporter.
#
# Environment variable: OTEL_TRACES_EXPORTER
exporter:
# Configure exporter to be zipkin.
zipkin:
# Configure endpoint.
#
# Environment variable: OTEL_EXPORTER_ZIPKIN_ENDPOINT
endpoint: http://localhost:9411/api/v2/spans
# Configure max time (in milliseconds) to wait for each export.
#
# Environment variable: OTEL_EXPORTER_ZIPKIN_TIMEOUT
timeout: 10000
# Configure a simple span processor.
- simple:
# Configure exporter.
exporter:
# Configure exporter to be console.
console: {}
- my_custom_span_processor:
comment: "This is a span processor extension point, with properties."
- batch:
exporter:
my_custom_span_exporter:
comment: "This is a span exporter extension point, with properties."

# Configure the sampler.
sampler:
my_custom_sampler:
comment: "This is a sampler extension point, with properties."

Loading

0 comments on commit d147b62

Please sign in to comment.