Class ToolTelemetry

java.lang.Object
com.google.genkit.ai.telemetry.ToolTelemetry

public class ToolTelemetry extends Object
ToolTelemetry provides metrics collection for tool execution.

This class tracks:

  • Tool invocation counts
  • Tool latency histograms
  • Tool error rates
  • Method Details

    • getInstance

      public static ToolTelemetry getInstance()
      Gets the singleton instance of ToolTelemetry.
      Returns:
      the ToolTelemetry instance
    • recordToolMetrics

      public void recordToolMetrics(String toolName, String featureName, String path, long latencyMs, String error)
      Records metrics for a tool execution.
      Parameters:
      toolName - the tool name
      featureName - the feature/flow name
      path - the span path
      latencyMs - the latency in milliseconds
      error - the error name if failed, null otherwise