DetectMateService
Microservice for logdataanomaly services
Install / Use
/learn @ait-detectmate/DetectMateServiceREADME
DetectMate Service
DetectMate Service is a framework for building modular services that communicate via NNG messaging.
Setup
With uv (recommended):
uv sync --dev
With pip and virtualenv:
python -m venv venv
source venv/bin/activate
pip install -e .
Developer setup
If you plan to contribute to the development of this package, follow these steps to set up the dev environment and install pre-commit hooks (using prek)
uv sync --dev
uv run --dev prek install
Run the tests:
uv run --dev pytest -q
Run the tests with coverage (add --cov-report=html to generate an HTML report):
uv run --dev pytest --cov=. --cov-report=term-missing
Usage
To use the Service class, you can create a subclass that implements the process method. Here's an example:
import pynng
from service.core import Service
class DemoService(Service):
def process(self, raw_message: bytes) -> bytes | None:
return None # No actual processing in this demo
service = DemoService()
with service:
with pynng.Req0(dial=service.settings.manager_addr) as req:
for cmd in ("ping", "status", "stop"):
print(f">>> {cmd}")
req.send(cmd.encode("utf-8"))
reply = req.recv().decode("utf-8", "ignore")
print(f"<<< {reply}")
CLI
You can also run the service using the command line interface (CLI). It takes configuration files as arguments:
Example configuration files can be found in the tests/config directory.
Start the service:
uv run detectmate --settings examples/service_settings.yaml
To survey the state of your component and interact with the running service, use the detectmate-client tool.
Get the service status:
uv run detectmate-client status --url <http_host:http_port>
Stop the engine:
uv run detectmate-client stop --url <http_host:http_port>
Start the engine:
uv run detectmate-client start --url <http_host:http_port>
Request prometheus metrics:
uv run detectmate-client metrics --url <http_host:http_port>
Shutdown entire service:
uv run detectmate-client shutdown --url <http_host:http_port>
Demo pipeline run with Docker
A containerized demonstration of the DetectMate log analysis pipeline. The demo runs three services (reader, parser, detector) that process audit logs to detect anomalies, with a test script that feeds log lines through the complete pipeline and reports detected anomalies.
Terminal 1 (keep running to see service logs):
docker compose up reader parser detector
Terminal 2 (run after services are up):
# Wait a few seconds for services to be ready, then:
docker compose up demo
Documentation
Contribution
We're happily taking patches and other contributions. Please see the following links for how to get started:
If you encounter any bugs, please create an issue on Github.
License
Related Skills
claude-opus-4-5-migration
107.6kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
model-usage
346.8kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
TrendRadar
50.7k⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, and smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅,支持关键词精准筛选。AI 智能筛选新闻 + AI 翻译 + AI 分析简报直推手机,也支持接入 MCP 架构,赋能 AI 自然语言对话分析、情感洞察与趋势预测等。支持 Docker ,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/bark/slack 等渠道智能推送。
mcp-for-beginners
15.8kThis open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
