Enum StatsErrorCode

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<StatsErrorCode>

    public enum StatsErrorCode
    extends java.lang.Enum<StatsErrorCode>
    This enum tracks the error codes that we use to report anomalies in metrics. Background: there are various edge cases, both intentional and unintentional, that can cause us to not emit a metric, either because we don't want to or because we cannot. Historically, we had many such edge cases that would make a metric default to zero. This is problematic when debugging why a metric is not acting right, since we cannot easily disambiguate between the various edge cases. In order to ease the debugging of metric anomalies, we are using this enum to track which code paths emit which error code. This ensures that we don't use the same sentinel values for two different meanings. By convention, because most, if not all, metrics are positive, we will use negative values for the error codes. We'll start at -10 and go down from there. If we need these error codes outside of the server module, we can move it out.
    • Field Summary

      Modifier and Type Field Description
      int code  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static StatsErrorCode valueOf​(java.lang.String name)
      Returns the enum constant of this type with the specified name.
      static StatsErrorCode[] values()
      Returns an array containing the constants of this enum type, in the order they are declared.
      • Methods inherited from class java.lang.Enum

        clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
      • Methods inherited from class java.lang.Object

        getClass, notify, notifyAll, wait, wait, wait
    • Enum Constant Detail


        public static final StatsErrorCode STORE_VERSION_SHOULD_NOT_EMIT_METRICS
        The original metrics implementation dealt with the problem of proliferation of transient metrics in downstream reporting systems by only reporting on one of the store versions, and by avoiding the inclusion of the version number as part of the metric name. This has since been superseded by a new versioned pattern where we maintain backup/current/future metrics in order to abstract away the specific version number while still providing visibility into the various versions. Once we migrate all relevant metrics to this new pattern, then this error code should not be used anymore. Until then, we might see this. This should only happen because of a race condition where the MetricsReporter queries a metric while the StoreIngestionService has identified that this is an old push but hasn't switched to the new push yet.

        public static final StatsErrorCode METRIC_ONLY_AVAILABLE_FOR_HYBRID_STORES
        Some metrics only make sense in the context of hybrid stores and should not be queried otherwise. If they are queried regardless, then we will emit this error code.

        public static final StatsErrorCode STORE_VERSION_STATE_UNAVAILABLE
        Some metrics rely on the data contained in: StoreVersionState If this state is not available, the metric cannot be computed and this error code will be emitted.

        public static final StatsErrorCode NO_SUBSCRIBED_PARTITION
        Some metrics aggregate data across many partitions. If no partitions are subscribed, then we may be querying that metric in a situation where it is inappropriate to do so, hence we will report this error code.

        public static final StatsErrorCode INACTIVE_STORE_INGESTION_TASK
        Inactive StoreIngestionTask instances should not be asked for metrics in the first place, but in case they are, there is a check that will prevent them from being interrogated. If this happens, this error code will be sent.

        public static final StatsErrorCode NULL_DIV_STATS
        When the DIVStatsReporter attempts to get stats, it tries to get hold of an instance of DIVStats which should have been set previously. If this instance has not been set, then it will be null, and this error code will be sent. This error code is expected for metrics related to store-versions which don't exist, such as: 1. the future version when there is no ongoing push, 2. the backup version for a store which contains only one or zero versions, or 3. the current version for a store which contains no versions at all. There may also be unexpected scenarios that cause this instance to be null... TODO: Need to find a better way to disambiguate the expected and unexpected case...

        public static final StatsErrorCode NULL_BDB_ENVIRONMENT
        The BDB stats depend on getting a handle of com.sleepycat.je.Environment. If the instance is null, then this error code will be sent.

        public static final StatsErrorCode NULL_BDB_STATS
        Since storage engine stats has been migrated to versioned stats. It would encounter the similar edge cases as DIVStatsReporter has. Check NULL_DIV_STATS for more details.

        public static final StatsErrorCode NULL_STORAGE_ENGINE_STATS
        Check AggVersionedStorageEngineStats to find more details.

        public static final StatsErrorCode NULL_INGESTION_STATS
        Used by AggVersionedStorageIngestionStats when the stats reporter fetches a null stats.

        public static final StatsErrorCode METRIC_ONLY_AVAILABLE_FOR_LEADER_FOLLOWER_STORES
        Some metrics only make sense in the context of L/F stores and should not be queried otherwise. If they are queried regardless, then we will emit this error code. We deliberately set it value to be 0 since it's mostly benign. If the resource doesn't belong to L/F model, it shouldn't encounter any L/F error :D

        public static final StatsErrorCode WRITE_COMPUTE_DESERIALIZATION_FAILURE
        This is bubbled up when write compute adapter fails to get the current value from the storage engine.

        public static final StatsErrorCode WRITE_COMPUTE_UPDATE_FAILURE
        This is bubbled up when write compute adapter fails to perform update operations on top of the current value.

        public static final StatsErrorCode LAG_MEASUREMENT_FAILURE
        This may be used when kafka topic's offset lag measurement may fail due to any reason.

        public static final StatsErrorCode KAFKA_CLIENT_METRICS_DEFAULT
        Default value for kafka client metrics. This is used when emitting metric configured via ConfigKeys#KAFKA_PRODUCER_METRICS and that metric is missing from those returned by the Kafka client.

        public static final StatsErrorCode UNKNOWN_METRIC_EXCEPTION
        There was an exception when retrieving a metric value. Please consult application logs to determine the root cause!

        public static final StatsErrorCode ACTIVE_ACTIVE_NOT_ENABLED
        This metric should not be emitted as it is a metric specific to an A/A store.
    • Field Detail

      • code

        public final int code
    • Method Detail

      • values

        public static StatsErrorCode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (StatsErrorCode c : StatsErrorCode.values())
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static StatsErrorCode valueOf​(java.lang.String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        name - the name of the enum constant to be returned.
        the enum constant with the specified name
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null