Xpersona
M

MicroService Metric Skill

CLAWHUB · Unverified

分析 Java 业务代码,识别监控指标项,提供指标定义、标签建议及采集方案,支持AOP类补充参考。 Skill: MicroService Metric Skill Owner: azrcn Summary: 分析 Java 业务代码,识别监控指标项,提供指标定义、标签建议及采集方案,支持AOP类补充参考。 Tags: latest:1.0.0 Version history: v1.0.0 | 2026-04-07T07:26:38.819Z | user Metric-skill 1.0.0 – Initial Release - Analyzes Java business code to identify monitorable metrics and provide monitoring suggestions. - Recognizes metrics using code patterns (method names, parameters, return types, etc.), without assumi

62
Rank
84
Safety
1.1k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s170b2fvqg8jytyxtn8kznzp5584dn34:metric-skill
  1. Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-azrcn-metric-skill/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

11,767 characters of source documentation, loaded on request.

Extracted files

3 files captured from the source.

Skill.md

---
name: metric-log
description: 分析 Java 代码,识别业务指标项并提供监控建议。触发词: "指标日志"、"metric log"、"业务指标"、"指标识别"。
---

# Metric Log Skill

分析 Java 业务代码,识别可监控的指标项,提供指标定义和采集建议。

## 触发

- 用户请求: "业务指标"、"metric log"、"指标识别"、"添加监控"
- 文件: `**/*Service.java`, `**/*Controller.java`, `**/*Manager.java`, `**/*Facade.java`

## 核心思路

本 skill 不预设具体业务领域的指标,而是基于**代码模式**识别指标特征,由用户根据业务定义具体指标名。

## 执行步骤

1. **读取用户提供分析的文件**
   - 解析类名(推断业务领域)
   - 扫描所有 public 方法

2. **询问用户**
   > 是否需要扫描项目中的 AOP 类?(可选)
   >
   > - **是**:扫描项目中已有的 Aspect/Interceptor/Filter,作为补充参考
   > - **否**:仅分析用户提供的文件

3. **指标识别与分析**
   - 根据方法名前缀推断操作类型
   - 根据返回类型推断结果指标
   - 根据参数类型推断维度标签
   - 扫描异常处理块
   - 扫描耗时计算点
   - 如有 AOP:结合 AOP 分析已有的采集情况

4. **生成识别报告**(统一输出格式)
   - 按方法列出识别依据
   - 提供建议的指标名模板
   - 标注建议的标签
   - 如有 AOP:标注已有的采集情况

## 通用识别模式

### 1. 方法命名识别 (CRUD + 业务动作)

方法名是识别指标的最重要线索:

| 方法名模式 | 识别为 | 指标类型建议 |
|------------|--------|--------------|
| `createXxx` | Xxx 创建 | Counter |
| `saveXxx` / `addXxx` | Xxx 保存 | Counter |
| `deleteXxx` / `removeXxx` | Xxx 删除 | Counter |
| `updateXxx` / `modifyXxx` | Xxx 更新 | Counter |
| `getXxx` / `queryXxx` | Xxx 查询 | Counter / Histogram |
| `listXxx` | Xxx 列表 | Histogram |
| `countXxx` | Xxx 计数 | Gauge |

**业务动作识别**:

| 方法名模式 | 识别为 | 指标类型建议 |
|------------|--------|--------------|
| `login` / `logout` | 登录/登出 | Counter |
| `pay` / `refund` | 支付/退款 | Counter + Amount Gauge |
| `approve` / `reject` | 审批 | Counter (带状态标签) |
| `send` / `receive` | 发送/接收 | Counter |
| `execute` / `run` | 执行 | Counter + Histogram |
| `handle` / `process` | 处理 | Counter + Histogram |
| `sync` | 同步 | Counter + Histogram |

```java
// 识别: 方法名包含 create/add/save → 增量计数器
public User createUser(UserRequest request) { } → 建议指标: xxx_created_total

// 识别: 方法名包含 pay/refund → 交易类指标
public PayResult pay(PayRequest request) { } → 建议指标: xxx_pay_total + xxx_pay_amount

// 识别: 方法名包含 login → 登录类指标
public LoginResult login(String username) { } → 建议指标: login_attempts_total

// 识别: 方法名包含 get/find/query → 查询类指标
public Order getOrder(Long id) { } → 建议指标: xxx_query_total + xxx_query_duration_ms
```

### 2. 参数特征识别

根据参数类型推断指标:

| 参数特征 | 识别为 | 指标建议 |
|----------|--------|----------|
| `Pageable` / `PageRequest` | 分页查询 | 添加 page/size 标签 |
| `List<XxxRequest>` | 批量操作 | 记录批量大小 |
| `Date` / `LocalDateTime` | 时间敏感 | 添加时间维度标签 |
| `BigDecimal` / `Double`(金额) | 金额类 | 记录金额 sum/avg |
| `Long`(ID) | 实体操作 | 可添加 ID 前缀标签 |

```java
// 识别: 分页参数 → 分页指标
public Page<Order> listOrders(Pageable pageable) {
    // 建议添加标签: page, size
}

// 识别: 批量参数 → 批量大小指标
public void batchImport(List<ImportData> dataList) {
    // 建议指标: batch_size (记录 dataList.size())
}

// 识别: 金额参数 → 金额类指标
public void charge(BigDecimal amount) {
    // 建议指标: xxx_amount_total (Sum)
}
```

### 3. 返回值特征识别

| 返回值特征 | 识别为 | 指标建议 |
|------------|--------|----------|
| `boolean` / `Result<T>` | 操作结果 | 区分 success/failed |
| `Page<T>` | 分页结果 | 记录 total 字段 |
| `List<T

_meta.json

{
  "ownerId": "kn72ywqqveqqd2e645ss6ad4v184cd3q",
  "slug": "metric-skill",
  "version": "1.0.0",
  "publishedAt": 1775546798819
}

skill-card.md

## Description:

Analyzes Java business code to identify monitorable business metrics and provide monitoring recommendations.

This skill is ready for commercial/non-commercial use.

## Publisher:

[azrcn](https://clawhub.ai/user/azrcn)

### License/Terms of Use:

MIT-0

## Use Case:

Developers and engineers use this skill to analyze Java service, controller, manager, and facade code for monitorable business metrics. It produces metric name, label, type, and collection suggestions, with optional AOP, interceptor, and filter review to avoid duplicate collection.

### Deployment Geography for Use:

Global

## Known Risks and Mitigations:

Risk: Broad trigger phrases and optional project-wide AOP scanning could lead the agent to examine more Java files than the user intended.

Mitigation: Confirm the analysis scope and user approval before scanning AOP, interceptor, filter, or project-wide files.

Risk: Metric suggestions are based on code patterns and may not match the application's actual business semantics.

Mitigation: Review proposed metric names, labels, types, and collection methods against business definitions before instrumenting code.

## Reference(s):

- [ClawHub skill page](https://clawhub.ai/azrcn/skills/metric-skill)
- [ClawHub publisher profile](https://clawhub.ai/user/azrcn)

## Skill Output:

**Output Type(s):** [text, markdown, code, guidance]

**Output Format:** [Markdown report with tables and Java snippets]

**Output Parameters:** [1D]

**Other Properties Related to Output:** [May include optional AOP, interceptor, and filter coverage notes when the user approves broader project scanning.]

## Skill Version(s):

1.0.0 (source: server release metadata)

## Ethical Considerations:

Users should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.

Sponsored

Ads related to MicroService Metric Skill and adjacent AI workflows.