[frontport] Fix proxy metrics cardinality explosion from bot traffic (#5600)
Motivation
The tower middleware added in #5534 extracts
method_namefrom the URI path usingrsplit('/')for per-method success/error metrics. This works correctly for gRPC requests, but internet-facing proxies also receive bot/scanner traffic (.env,wp-login.php, etc.). Each unique probe path creates a permanent new Prometheus time series, causing unbounded label cardinality.On a test network, 325+ unique
method_namelabel values were observed within hours, all from bot probes.This was discovered and fixed during the backport to
testnet_conway(#5591).Proposal
Replace the naive
rsplit('/')extraction with a check for the gRPC URI pattern. gRPC paths have the form/{package}.{Service}/{Method}— the first segment always contains a dot. Non-gRPC requests are bucketed asnon_grpcinstead of recording the raw path, keeping label cardinality bounded to the number of actual gRPC methods.Test Plan
- CI
- Verified on a test network (
andrtest-conway): after deploying, proxy error metrics collapsed from 325+ unique labels to just 2 (non_grpc+ one straggler from before the fix). gRPC success metrics correctly show PascalCase method names (HandleBlockProposal,HandleLiteCertificate, etc.).
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
Linera is a decentralized blockchain infrastructure designed for highly scalable, secure, low-latency Web3 applications.
Documentation
Visit our developer page and read our whitepaper to learn more about the Linera protocol.
Repository Structure
The main crates and directories of this repository can be summarized as follows: (listed from low to high levels in the dependency graph)
linera-baseBase definitions, including cryptography.linera-versionA library to manage version info in binaries and services.linera-viewsA library mapping complex data structures onto a key-value store. The corresponding procedural macros are implemented inlinera-views-derive.linera-executionPersistent data and the corresponding logic for runtime and execution of Linera applications.linera-chainPersistent data and the corresponding logic for chains of blocks, certificates, and cross-chain messaging.linera-storageDefines the storage abstractions for the protocol on top oflinera-chain.linera-coreThe core Linera protocol, including client and server logic, node synchronization, etc.linera-rpcDefines the data-type for RPC messages (currently all client ↔ proxy ↔ chain ↔ chain interactions), and track the corresponding data schemas.linera-clientLibrary for writing Linera clients. Used for the command-line client and the node service inlinera-service, as well as the Web client inlinera-web.linera-serviceExecutable for clients (aka CLI wallets), proxy (aka validator frontend) and servers.linera-sdkThe library to develop Linera applications written in Rust for the Wasm virtual machine. The corresponding procedural macros are implemented inlinera-sdk-derive.examplesExamples of Linera applications written in Rust.Prerequisites
See
INSTALL.mdfor software requirements to develop in this repo.Quickstart with the Linera CLI tool
The following commands set up a local test network and run some transfers between the microchains owned by a single wallet.
Enable logs for user applications:
Set the path of the future wallet:
More complex examples may be found in our developer manual as well as the example applications in this repository.
Contributing
We welcome contributions from the community! If you’d like to contribute to the Linera protocol:
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)For detailed guidelines, see our contribution guide.