Class TenantTraceSamplingHelper


  • public final class TenantTraceSamplingHelper
    extends Object
    A helper class for applying the tenant specific trace sampling configuration.
    • Method Detail

      • getTraceSamplingPriority

        public static OptionalInt getTraceSamplingPriority​(TenantObject tenantObject,
                                                           String authId)
        Gets the trace sampling priority configured for the given tenant and authentication identifier.
        Parameters:
        tenantObject - The tenant from which to get the trace sampling priority configuration.
        authId - The authentication identifier to get the trace sampling priority for (may be null).
        Returns:
        An OptionalInt containing the identified sampling priority or an empty OptionalInt if no priority was identified.
        Throws:
        NullPointerException - if tenantObject is null.
      • applyTraceSamplingPriority

        public static OptionalInt applyTraceSamplingPriority​(TenantObject tenantObject,
                                                             String authId,
                                                             io.opentracing.Span span)
        Applies the trace sampling priority configured for the given tenant to the given span.
        Parameters:
        tenantObject - The tenant from which to get the trace sampling priority configuration.
        authId - The authentication identifier to get the trace sampling priority for (may be null).
        span - The span to apply the configuration to.
        Returns:
        An OptionalInt containing the applied sampling priority or an empty OptionalInt if no priority was applied.
        Throws:
        NullPointerException - if tenantObject or span is null.