Sha256: 66844e59896ad85de93ff866fa3b986f61b6a2f0b2facc84a8a6d05a37c7ddf7
Contents?: true
Size: 797 Bytes
Versions: 12
Compression:
Stored size: 797 Bytes
Contents
# frozen_string_literal: true require "opentelemetry/sdk" require_relative "./condition" module Aspecto # Aspecto OpenTelemetry Distro module OpenTelemetry module Sampler # Single rule for sampling class SamplingRule def initialize(rule_config) @id = rule_config["_id"] @sampler = ::OpenTelemetry::SDK::Trace::Samplers.trace_id_ratio_based(rule_config["samplingRate"]) @conditions = rule_config["conditions"].map { |condition_config| Condition.new condition_config } @context = rule_config["context"] end attr_reader :sampler, :context def satisfies?(attributes, span_name) @conditions.all? { |condition| condition.satisfies?(attributes, span_name) } end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems