Class Fido2MetricsService

java.lang.Object
io.jans.fido2.service.metric.Fido2MetricsService

@ApplicationScoped @Named("fido2MetricsService") public class Fido2MetricsService extends Object
Service for managing FIDO2 metrics data operations
Author:
FIDO2 Team
  • Constructor Details

    • Fido2MetricsService

      public Fido2MetricsService()
  • Method Details

    • storeMetricsEntry

      public void storeMetricsEntry(Fido2MetricsEntry entry)
      Store a metrics entry asynchronously
    • storeMetricsData

      public void storeMetricsData(Fido2MetricsData metricsData)
      Store metrics data as a metrics entry
    • getMetricsEntries

      public List<Fido2MetricsEntry> getMetricsEntries(LocalDateTime startTime, LocalDateTime endTime)
      Get metrics entries by time range
    • getMetricsEntriesByUser

      public List<Fido2MetricsEntry> getMetricsEntriesByUser(String userId, LocalDateTime startTime, LocalDateTime endTime)
      Get metrics entries by user
    • getMetricsEntriesByOperation

      public List<Fido2MetricsEntry> getMetricsEntriesByOperation(String operationType, LocalDateTime startTime, LocalDateTime endTime)
      Get metrics entries by operation type
    • createHourlyAggregation

      public void createHourlyAggregation(LocalDateTime hour)
      Create hourly aggregation
    • createDailyAggregation

      public void createDailyAggregation(LocalDateTime day)
      Create daily aggregation
    • createWeeklyAggregation

      public void createWeeklyAggregation(LocalDateTime week)
      Create weekly aggregation
    • createMonthlyAggregation

      public void createMonthlyAggregation(LocalDateTime month)
      Create monthly aggregation
    • getAggregations

      public List<Fido2MetricsAggregation> getAggregations(String aggregationType, LocalDateTime startTime, LocalDateTime endTime)
      Get aggregations by time range Uses interval overlap logic: finds aggregations that overlap with the query range An aggregation overlaps if: aggregation.startTime <= queryEndTime AND aggregation.endTime >= queryStartTime
    • cleanupOldData

      public void cleanupOldData(int retentionDays)
      Cleanup old data based on retention policy
    • getUserAdoptionMetrics

      public Map<String,Object> getUserAdoptionMetrics(LocalDateTime startTime, LocalDateTime endTime)
      Get user adoption metrics.

      "New" and "returning" are decided against every successful registration on record, not just the rows inside [startTime, endTime]: a user only counts as new the first time their registration succeeds, and as returning if they had already registered before the window began. adoptionRate is newUsers against the cumulative population of everyone who has ever registered as of endTime — a self-contained figure bounded by how long metrics entries are retained, not a rate against the full identity directory.

    • getPerformanceMetrics

      public Map<String,Object> getPerformanceMetrics(LocalDateTime startTime, LocalDateTime endTime)
      Get performance metrics
    • getDeviceAnalytics

      public Map<String,Object> getDeviceAnalytics(LocalDateTime startTime, LocalDateTime endTime)
      Get device/platform analytics
    • getErrorAnalysis

      public Map<String,Object> getErrorAnalysis(LocalDateTime startTime, LocalDateTime endTime)
      Get error analysis over both operation types.
    • getErrorAnalysis

      public Map<String,Object> getErrorAnalysis(LocalDateTime startTime, LocalDateTime endTime, String operationType)
      Get error analysis, optionally for one operation type.

      Pooling registration and authentication makes a deployment with healthy sign-in and poor enrolment indistinguishable from the reverse: both report the same middling success rate, and the two have different causes and different fixes. Pooling stays the default so existing callers see what they always have.

      Parameters:
      operationType - Fido2MetricsConstants.REGISTRATION or Fido2MetricsConstants.AUTHENTICATION to report that ceremony alone, or null to report both together
    • getAttestationRejectionAnalysis

      public Map<String,Object> getAttestationRejectionAnalysis(LocalDateTime startTime, LocalDateTime endTime)
      Break down attestation rejections by trust diagnostic code over a time range.

      Reads the same metrics store as getErrorAnalysis(java.time.LocalDateTime, java.time.LocalDateTime): a rejection is an entry whose error category is AttestationTrustDiagnostic.CATEGORY. No new store, no new collection path.

      Parameters:
      startTime - range start
      endTime - range end
      Returns:
      counts per reason code and per AAGUID, plus the totals needed to interpret them
    • getTrendAnalysis

      public Map<String,Object> getTrendAnalysis(String aggregationType, LocalDateTime startTime, LocalDateTime endTime)
      Get trend analysis for a specific aggregation type and time period
    • getPeriodOverPeriodComparison

      public Map<String,Object> getPeriodOverPeriodComparison(String aggregationType, int periods)
      Get period-over-period comparison
    • getAggregationSummary

      public Map<String,Object> getAggregationSummary(String aggregationType, LocalDateTime startTime, LocalDateTime endTime)
      Get aggregation summary for a time period