Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.sampler = OpenTelemetry::SDK::Trace::Samplers::TraceIdRatioBased.new(0.1) - not wokring #1787

Open
akshaysn1991 opened this issue Jan 2, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@akshaysn1991
Copy link

akshaysn1991 commented Jan 2, 2025

Not able to configure sampling in OpenTelemetry::SDK.configure
getting below error

E, [2025-01-02T13:50:08.053572 #14135] ERROR -- : OpenTelemetry error: unexpected configuration error due to undefined method `sampler=' for #OpenTelemetry::SDK::Configurator:0x00007f990fd69fc0 - OpenTelemetry::SDK::ConfigurationError

Share details about your runtime

Operating system details: Mac 12
RUBY_ENGINE: "ruby"
RUBY_VERSION: "2.5.2"

gem 'opentelemetry-sdk', '> 1.1.0'
gem 'opentelemetry-exporter-otlp', '
> 0.20.3'
gem 'opentelemetry-instrumentation-all', '~> 0.24.0'
gem 'opentelemetry-exporter-zipkin'

require 'opentelemetry/sdk'

OpenTelemetry::SDK.configure do |config|
config.sampler = OpenTelemetry::SDK::Trace::Samplers::TraceIdRatioBased.new(0.1)
config.use 'OpenTelemetry::Instrumentation::Rails'
end

@akshaysn1991 akshaysn1991 added the bug Something isn't working label Jan 2, 2025
@arielvalentin
Copy link
Contributor

The configurator DSL does not support setting a sampler.

It is a parameter of the TracerProvider constructor.

I'd recommend configuring these using the standard environment variables OTEL_TRACES_SAMPLER and OTEL_TRACES_SAMPLER_ARG

https://opentelemetry.io/docs/specs/otel/configuration/sdk-environment-variables/#general-sdk-configuration

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants