Class OpenTelemetryResolver


  • public class OpenTelemetryResolver
    extends java.lang.Object
    Resolver class for OpenTelemetry operations in Valkey GLIDE. This class provides native methods to interact with OpenTelemetry functionality implemented in the Rust core library.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static long createLeakedOtelSpan​(java.lang.String spanName)
      Creates a new OpenTelemetry span with the given name that will not be automatically dropped by the Rust core.
      static void dropOtelSpan​(long spanPtr)
      Drops an OpenTelemetry span that was created with createLeakedOtelSpan(String), releasing its resources.
      static int initOpenTelemetry​(java.lang.String tracesEndpoint, int tracesSamplePercentage, java.lang.String metricsEndpoint, long flushIntervalMs)
      Initializes OpenTelemetry with the provided configuration.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OpenTelemetryResolver

        public OpenTelemetryResolver()
    • Method Detail

      • initOpenTelemetry

        public static int initOpenTelemetry​(java.lang.String tracesEndpoint,
                                            int tracesSamplePercentage,
                                            java.lang.String metricsEndpoint,
                                            long flushIntervalMs)
        Initializes OpenTelemetry with the provided configuration.
        Parameters:
        tracesEndpoint - The endpoint for traces exporter (can be null if not used)
        tracesSamplePercentage - The percentage of requests to sample (0 for default)
        metricsEndpoint - The endpoint for metrics exporter (can be null if not used)
        flushIntervalMs - The interval in milliseconds between consecutive exports (0 for default)
        Returns:
        0 on success, error code otherwise: 1 - Missing configuration (both traces and metrics are null) 2 - Invalid traces endpoint 3 - Invalid metrics endpoint 4 - Runtime initialization failure 5 - OpenTelemetry initialization failure
      • createLeakedOtelSpan

        public static long createLeakedOtelSpan​(java.lang.String spanName)
        Creates a new OpenTelemetry span with the given name that will not be automatically dropped by the Rust core. The caller is responsible for dropping this span using dropOtelSpan(long).
        Parameters:
        spanName - The name of the span to create
        Returns:
        A pointer to the created span, or 0 if creation failed
      • dropOtelSpan

        public static void dropOtelSpan​(long spanPtr)
        Drops an OpenTelemetry span that was created with createLeakedOtelSpan(String), releasing its resources.
        Parameters:
        spanPtr - The pointer to the span to drop