All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.opentelemetry.javaagent.instrumentation.mongo.v3_1.MongoInstrumentationSingletons Maven / Gradle / Ivy

There is a newer version: 2.8.0-alpha
Show newest version
/*
 * Copyright The OpenTelemetry Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package io.opentelemetry.javaagent.instrumentation.mongo.v3_1;

import com.mongodb.event.CommandListener;
import io.opentelemetry.api.GlobalOpenTelemetry;
import io.opentelemetry.instrumentation.mongo.v3_1.MongoTelemetry;
import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig;

public final class MongoInstrumentationSingletons {

  public static final CommandListener LISTENER =
      MongoTelemetry.builder(GlobalOpenTelemetry.get())
          .setStatementSanitizationEnabled(
              AgentInstrumentationConfig.get()
                  .getBoolean(
                      "otel.instrumentation.mongo.statement-sanitizer.enabled",
                      AgentCommonConfig.get().isStatementSanitizationEnabled()))
          .build()
          .newCommandListener();

  public static boolean isTracingListener(CommandListener listener) {
    return listener.getClass().getName().equals(LISTENER.getClass().getName());
  }

  private MongoInstrumentationSingletons() {}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy