blob: 6e21ab3a380e435da237d734e62e66134bc40524 [file]
/** @file
Abuse Shield plugin statistics.
@section license License
Licensed to the Apache Software Foundation (ASF) under one or more contributor license
agreements. See the NOTICE file distributed with this work for additional information regarding
copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the License. You may obtain
a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License
is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing permissions and limitations under
the License.
*/
#pragma once
namespace abuse_shield
{
/** Per-tracker statistics/metrics. */
struct TrackerStats {
int events{-1}; ///< Total events tracked
int events_untracked{-1}; ///< Events lost in an ordinary contest or bounded scan
int scan_exhausted{-1}; ///< Events not tracked because the protected-slot scan hit its bound
int slots_used{-1}; ///< Current slots in use (gauge)
int contests{-1}; ///< Total contest attempts
int contests_won{-1}; ///< Contests won by new IP
int evictions{-1}; ///< Occupied tracker slots replaced by contest winners
/** Initialize tracker statistics with a name prefix.
*
* @param[in] prefix The prefix for stat names (e.g., "txn", "conn", "h2").
*/
void init(const char *prefix);
};
/** Global action statistics/metrics. */
struct ActionStats {
int actions_log_untracked{-1}; ///< Log actions without a tracking slot
int actions_log_failed{-1}; ///< Failed log object writes
int fingerprint_missing_methods{-1}; ///< Valid registries missing configured methods
int rules_matched{-1}; ///< Total times any rule matched
int actions_blocked{-1}; ///< Total block actions executed
int actions_block_failed{-1}; ///< Block actions that could not be stored
int actions_closed{-1}; ///< Total close actions executed
int actions_close_failed{-1}; ///< Close actions that could not shut down a connection
int actions_logged{-1}; ///< Successful log writes or fallback submissions
int connections_rejected{-1}; ///< Blocked connections rejected at TLS or HTTP session start
int connections_reject_failed{-1}; ///< Plain HTTP blocked connections that could not be rejected
int fingerprint_matches{-1}; ///< ClientHello fingerprint rule matches
int fingerprint_connections_rejected{-1}; ///< Connections rejected at ClientHello
int fingerprint_unavailable{-1}; ///< ClientHellos with absent or invalid registries
/** Initialize action statistics by creating the ATS stat entries. */
void init();
};
} // namespace abuse_shield