WingtipsToLightStepLifecycleListener implements SpanLifecycleListener { protected String sanitizeIdIfNecessary(final String originalId, final boolean allow128Bit) { if (originalId == null) { return null; } if (isAllowedNumChars(originalId, allow128Bit)) { if (isLowerHex(originalId)) { return originalId; } else if (isHex(originalId, true)) { return originalId.toLowerCase(); } } Long originalIdAsRawLong = attemptToConvertToLong(originalId); if (originalIdAsRawLong != null) { return TraceAndSpanIdGenerator.longToUnsignedLowerHexString(originalIdAsRawLong); } if (allow128Bit) { String sanitizedId = attemptToSanitizeAsUuid(originalId); if (sanitizedId != null) { return sanitizedId; } } int allowedNumChars = allow128Bit ? 32 : 16; return DigestUtils.sha256Hex(originalId).toLowerCase().substring(0, allowedNumChars); } WingtipsToLightStepLifecycleListener(
        @NotNull String serviceName,
        @NotNull String accessToken,
        @NotNull String satelliteUrl,
        int satellitePort
    );  WingtipsToLightStepLifecycleListener(@NotNull JRETracer tracer); @Override void spanSampled(Span wingtipsSpan); @Override void spanStarted(Span wingtipsSpan); @Override void spanCompleted(Span wingtipsSpan);  }
@UseDataProvider("idSanitizationScenarios") @Test public void sanitizeIdIfNecessary_sanitizes_ids_as_expected( IdSanitizationScenario scenario ) { String result128bit = listener.sanitizeIdIfNecessary(scenario.originalId, true); String result64bit = listener.sanitizeIdIfNecessary(scenario.originalId, false); assertThat(result128bit).isEqualTo(scenario.expectedSanitizedResultForTraceId); assertThat(result64bit).isEqualTo(scenario.expectedSanitizedResultForSpanIdOrParentSpanId); }