Class MongoCommandSanitizer

java.lang.Object
io.quarkus.mongodb.tracing.MongoCommandSanitizer

public class MongoCommandSanitizer extends Object
Sanitizes MongoDB commands for tracing by replacing values with type information.

This prevents sensitive data from being exposed in traces while maintaining the command structure for observability.

  • Constructor Details

    • MongoCommandSanitizer

      public MongoCommandSanitizer()
  • Method Details

    • sanitizeCommand

      public String sanitizeCommand(org.bson.BsonDocument command)
      Sanitizes a BSON command document by replacing all values with their type information.
      Parameters:
      command - the original command document
      Returns:
      sanitized command as JSON string
    • extractCollectionName

      public String extractCollectionName(org.bson.BsonDocument command)
      Extracts the collection name from a MongoDB command.
      Parameters:
      command - the command document
      Returns:
      collection name or null if not found