Class CoreEvents

java.lang.Object
org.frontcache.plugin.host.CoreEvents

public final class CoreEvents extends Object
The core's emit points, one method per event: each checks FcEventBus.wants(long) before building anything, so a node nobody observes pays one volatile read per point and allocates nothing. Never throws into its caller.
  • Method Details

    • guardMatched

      public static void guardMatched(RequestContext context, String rule, String disposition, int status)
      A guard rule acted on a request (rejected / redirected) or matched it as a dry run (status 0).
    • challengeIssued

      public static void challengeIssued(RequestContext context, String rule, String provider, String plugin)
      A challenge rule sent a visitor to a provider's page - after the redirect is written.
    • rateLimitExceeded

      public static void rateLimitExceeded(RequestContext context, String bucket, String rule, int limit, long windowMillis, String clientKey)
      A client crossed a bucket's limit - called once per client per window, by the rate-limit predicate.
    • circuitStateChanged

      public static void circuitStateChanged(String commandKey, String from, String to, float failureRate)
    • configReloaded

      public static void configReloaded(String file, boolean ok, int entries, List<String> reasons)
    • originError

      public static void originError(RequestContext context, String command, String failure, int status, String uri, Throwable cause, long latencyMillis)
      A resilience command's origin call failed.
      Parameters:
      context - null for a call made outside a request (a management lookup)
      failure - the command's failure event, as failureName(Enum) spells it
      status - the origin's status when it answered one outside 2xx-4xx; 0 otherwise
      cause - what the call threw; null for a refusal (circuit, bulkhead, pool)
    • fallbackServed

      public static void fallbackServed(RequestContext context, String command, String failure, String uri, Throwable cause)
      A fallback was served instead of the origin.
      Parameters:
      context - null for a call made outside a request
      cause - what the command threw; null for a refusal
    • cacheInvalidated

      public static void cacheInvalidated(String scope, String filter)
      Parameters:
      filter - null for all and purge
    • requestCompleted

      public static void requestCompleted(RequestContext context, boolean cacheable, String cache, long runtimeMillis, long lengthBytes)
      A request was logged. Only a top-level one is an event, and only when the draw falls in a subscriber's sample - so a node that is observed but not for requests pays one volatile read here, and one that is pays a random draw per request and builds the event for the sampled share only.
      Parameters:
      cache - from-cache, dynamic, dynamic-soft or plugin:<id>, as the request log writes it
    • failureName

      public static String failureName(Enum<?> failure)
      A resilience event type as an event spells it: TIMEOUT -> timeout.
    • uri

      public static String uri(RequestContext context)
      host + path + query, as the guard log line writes it, truncated.