Interface PerformanceLogCallback

    • Method Detail

      • publish

        void publish​(PerformanceActivity activity,
                     int connectionId,
                     long duration,
                     Exception exception)
              throws Exception
        Publish performance log for connection-level activities.
        Parameters:
        activity - The type of activity being logged.
        connectionId - The ID of the connection.
        duration - The duration of the operation (milliseconds by default, nanoseconds if useNanoseconds() returns true).
        exception - An exception, if an error occurred.
        Throws:
        Exception - if the callback cannot publish the performance event.
      • publish

        void publish​(PerformanceActivity activity,
                     int connectionId,
                     int statementId,
                     long duration,
                     Exception exception)
              throws Exception
        Publish performance log for statement-level activities.
        Parameters:
        activity - The type of activity being logged.
        connectionId - The ID of the connection.
        statementId - The ID of the statement (if applicable).
        duration - The duration of the operation (milliseconds by default, nanoseconds if useNanoseconds() returns true).
        exception - An exception, if an error occurred.
        Throws:
        Exception - if the callback cannot publish the performance event.
      • getCurrentApplicationName

        default String getCurrentApplicationName()
        Returns the application name of the connection associated with the current performance event. This is the value of the applicationName connection property, which defaults to "Microsoft JDBC Driver for SQL Server" when not set. Applications using a connection pool can set this property on the pool's data source to identify which pool the event originated from. Unlike getCurrentUserSql(), this value is available for both connection-level and statement-level activities. Only valid inside a publish(com.microsoft.sqlserver.jdbc.PerformanceActivity, int, long, java.lang.Exception) callback invocation. Returns null when called outside publish(), or when the connection properties have not been parsed yet (for example, a connection that fails before the property is resolved).
        Returns:
        the application name, or null if not available.