Class FeatureTelemetry

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

public class FeatureTelemetry extends Object
FeatureTelemetry provides metrics collection for top-level feature (flow) execution.

This class tracks:

  • Feature request counts
  • Feature latency histograms
  • Path-level metrics for observability

Features in Genkit are the entry points to AI functionality, typically flows that users interact with directly.

  • Method Details

    • getInstance

      public static FeatureTelemetry getInstance()
      Gets the singleton instance of FeatureTelemetry.
      Returns:
      the FeatureTelemetry instance
    • recordFeatureMetrics

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

      public void recordPathMetrics(String featureName, String path, long latencyMs, String error)
      Records metrics for a path within a flow.
      Parameters:
      featureName - the feature name
      path - the full path including step types
      latencyMs - the latency in milliseconds
      error - the error name if failed, null otherwise