Skip to content

Commit 6561a48

Browse files
committed
feat: support list span & trace detail in apmplus
1 parent b62ed35 commit 6561a48

13 files changed

Lines changed: 861 additions & 191 deletions

File tree

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
### Python template
2+
# Byte-compiled / optimized / DLL files
3+
__pycache__/
4+
*.py[cod]
5+
*$py.class
6+
7+
# C extensions
8+
*.so
9+
10+
# Distribution / packaging
11+
.Python
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
wheels/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# poetry
99+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
100+
# This is especially recommended for binary packages to ensure reproducibility, and is more
101+
# commonly ignored for libraries.
102+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
103+
#poetry.lock
104+
105+
# pdm
106+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
107+
#pdm.lock
108+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
109+
# in version control.
110+
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
111+
.pdm.toml
112+
.pdm-python
113+
.pdm-build/
114+
115+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
116+
__pypackages__/
117+
118+
# Celery stuff
119+
celerybeat-schedule
120+
celerybeat.pid
121+
122+
# SageMath parsed files
123+
*.sage.py
124+
125+
# Environments
126+
.env
127+
.venv
128+
env/
129+
venv/
130+
ENV/
131+
env.bak/
132+
venv.bak/
133+
134+
# Spyder project settings
135+
.spyderproject
136+
.spyproject
137+
138+
# Rope project settings
139+
.ropeproject
140+
141+
# mkdocs documentation
142+
/site
143+
144+
# mypy
145+
.mypy_cache/
146+
.dmypy.json
147+
dmypy.json
148+
149+
# Pyre type checker
150+
.pyre/
151+
152+
# pytype static type analyzer
153+
.pytype/
154+
155+
# Cython debug symbols
156+
cython_debug/
157+
158+
.idea/
159+
.DS_Store

server/mcp_server_apmplus/README.md

Lines changed: 47 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,69 @@
22

33
The MCP Server officially launched by the Application Performance Monitoring service can accurately convert natural language into observable analysis statements. It efficiently analyzes observable data including metrics, traces, and logs, helping you comprehensively ensure the entire lifecycle of your applications and improve the efficiency of troubleshooting and problem-solving.
44

5-
| Version | v0.1.0 |
6-
| :-: |:----------------:|
5+
| Version | v0.2.0 |
6+
| :-: |:-------------------------------------------------------------------------------------------------:|
77
| Description | The APMPlus MCP Server helps you comprehensively ensure the entire lifecycle of your applications |
8-
| Category | Observability |
9-
| Tags | Observability, Traces, Metrics, Logs, Performance Monitoring |
8+
| Category | Observability |
9+
| Tags | Observability, Traces, Metrics, Logs, Performance Monitoring |
1010

1111
## Tools
1212
This MCP Server product provides the following Tools (capabilities):
1313
### 1. apmplus_server_list_alert_rule
14-
Query the alert rules for APMPlus - Server Monitoring in a specified region.
14+
Query the alert rules from APMPlus - Server Monitoring in a specified region.
1515
- Parameters:
16-
- `region_id`: [str] Region ID
17-
- `keyword`: [str] Search keyword
18-
- `page_number`: [int] Page number for pagination
19-
- `page_size`: [int] Page size for pagination
16+
- `region`: [str, optional] Region ID. Defaults to cn-beijing.
17+
- `keyword`: [str, optional] Search keyword. Defaults to "".
18+
- `page_number`: [int, optional] Page number for pagination. Defaults to 1.
19+
- `page_size`: [int, optional] Page size for pagination. Defaults to 10.
2020

2121
### 2. apmplus_server_list_notify_group
22-
Query the notification group information for APMPlus - Server Monitoring in a specified region.
22+
Query the notification group information from APMPlus - Server Monitoring in a specified region.
2323
- Parameters:
24-
- `region_id`: [str] Region ID
25-
- `keyword`: [str] Search keyword
26-
- `page_number`: [int] Page number for pagination
27-
- `page_size`: [int] Page size for pagination
24+
- `region`: [str, optional] Region ID. Defaults to cn-beijing.
25+
- `keyword`: [str, optional] Search keyword. Defaults to "".
26+
- `page_number`: [int, optional] Page number for pagination. Defaults to 1.
27+
- `page_size`: [int, optional] Page size for pagination. Defaults to 10.
2828

2929
### 3. apmplus_server_query_metrics
30-
Query the metrics for APMPlus - Server Monitoring in a specified region.
30+
Query the metrics from APMPlus - Server Monitoring in a specified region.
3131
- Parameters:
32-
- `region_id`: [str] Region ID
32+
- `region`: [str, optional] Region ID. Defaults to cn-beijing.
3333
- `query`: [str] Metric expression, in PromQL format
3434
- `start_time`: [int] Start time, in seconds
3535
- `end_time`: [int] End time, in seconds
3636

37+
### 4. apmplus_server_get_trace_detail
38+
Get trace detail information from APMPlus - Server Monitoring in a specified region.
39+
- Parameters:
40+
- `trace_id`: [str, optional] Trace ID.
41+
- `suggest_time`: [int, optional] Suggest time in seconds.
42+
- `region`: [str, optional] Region ID. Defaults to cn-beijing.
43+
44+
### 5. apmplus_server_list_span
45+
Get a list of trace span from APMPlus - Server Monitoring in a specified region.
46+
- Parameters:
47+
- `start_time`: [int] Start time in seconds, example: 1693536000
48+
- `end_time`: [int] End time in seconds, example: 1693546000
49+
- `filters`: [list[dict], optional] Filter expression.
50+
Each dict contains:
51+
- 'Op' (str): in, not_in
52+
- 'Key' (str): Filter key
53+
- 'Values' (list[str]): Filter values
54+
- `order`: [str, optional] Order direction. Defaults to DESC.
55+
- `order_by`: [str, optional] Order by field. Defaults to "".
56+
- `offset`: [int, optional] Offset for pagination. Defaults to 0.
57+
- `limit`: [int, optional] Limit for pagination. Defaults to 10.
58+
- `min_call_cost_millisecond`: [int, optional] Minimum call cost in milliseconds. Defaults to 0.
59+
- `max_call_cost_millisecond`: [int, optional] Maximum call cost in milliseconds. Defaults to 0.
60+
- `project_name`: [str, optional] The project name.
61+
- `tag_filters`: [list[dict], optional] List of tag filters. Each dict contains:
62+
- 'Key' (str): Tag key
63+
- 'Value' (list[str]): Tag value
64+
Max 10 tag pairs.
65+
Empty value means no restriction on tag value.
66+
- `region`: [str, optional] Region ID. Defaults to cn-beijing.
67+
3768
## Compatible Platforms
3869
You can use cline, cursor, claude desktop, or other terminals that support MCP server calls.
3970

server/mcp_server_apmplus/README_zh.md

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,67 @@
22

33
应用性能监控服务官方推出的 MCP Server,可以将自然语言精准转化为可观测分析语句,高效分析包含指标、链路和日志在内的可观测数据,助您全面保障应用的全生命周期,提升异常问题排查与解决的效率。
44

5-
| 版本 | v0.1.0 |
6-
| :-: |:----------------:|
5+
| 版本 | v0.2.0 |
6+
| :-: |:---------------------------------:|
77
| 描述 | APMPlus MCP Server 助您全面保障应用的全生命周期 |
8-
| 分类 | 可观测 |
9-
| 标签 | 可观测,链路,指标,日志,性能监控 |
8+
| 分类 | 可观测 |
9+
| 标签 | 可观测,链路,指标,日志,性能监控 |
1010

1111
## Tools
1212
本 MCP Server 产品提供以下 Tools (工具/能力):
1313
### 1. apmplus_server_list_alert_rule
1414
查询应用性能监控-服务端监控在指定区域下的告警规则
1515
- 参数:
16-
- `region_id`: [str] 地域 id
17-
- `keyword`: [str] 搜索关键词
18-
- `page_number`: [int] 分页页码
19-
- `page_size`: [int] 分页大小
16+
- `region`: [str, optional] 地域 ID。默认为 cn-beijing。
17+
- `keyword`: [str, optional] 搜索关键词。默认为空。
18+
- `page_number`: [int, optional] 分页页码。默认为1。
19+
- `page_size`: [int, optional] 分页大小。默认为10。
2020

2121
### 2. apmplus_server_list_notify_group
2222
查询应用性能监控-服务端监控在指定区域下的通知组信息
2323
- 参数:
24-
- `region_id`: [str] 地域 id
25-
- `keyword`: [str] 搜索关键词
26-
- `page_number`: [int] 分页页码
27-
- `page_size`: [int] 分页大小
24+
- `region`: [str, optional] 地域 ID。默认为 cn-beijing。
25+
- `keyword`: [str, optional] 搜索关键词。默认为空。
26+
- `page_number`: [int, optional] 分页页码。默认为1。
27+
- `page_size`: [int, optional] 分页大小。默认为10。
2828

2929
### 3. apmplus_server_query_metrics
3030
查询应用性能监控-服务端监控在指定区域下的指标
3131
- 参数:
32-
- `region_id`: [str] 地域 id
33-
- `query`: [str] 指标表达式,PromQL格式
34-
- `start_time`: [int] 开始时间,单位为秒
35-
- `end_time`: [int] 结束时间,单位为秒
32+
- `region`: [str, optional] 地域 ID。默认为 cn-beijing。
33+
- `query`: [str] 指标表达式,PromQL格式。
34+
- `start_time`: [int] 开始时间,单位为秒。
35+
- `end_time`: [int] 结束时间,单位为秒。
36+
37+
### 4. apmplus_server_get_trace_detail
38+
查询应用性能监控-服务端监控在指定区域下的链路详情信息
39+
- 参数:
40+
- `trace_id`: [str, optional] 链路 ID。
41+
- `suggest_time`: [int, optional] 链路发生的大致时间(秒)。
42+
- `region`: [str, optional] 地域 ID。默认为 cn-beijing。
43+
44+
### 5. apmplus_server_list_span
45+
查询应用性能监控-服务端监控在指定区域下的链路Span列表
46+
- 参数:
47+
- `start_time`: [int] 开始时间(秒),例如:1693536000。
48+
- `end_time`: [int] 结束时间(秒),例如:1693546000。
49+
- `filters`: [list[dict], optional] 过滤表达式。每个字典包含:
50+
- 'Op' (str): in, not_in
51+
- 'Key' (str): 过滤键
52+
- 'Values' (list[str]): 过滤值
53+
- `order`: [str, optional] 排序方向。默认为 DESC。
54+
- `order_by`: [str, optional] 排序字段。默认为空字符串。
55+
- `offset`: [int, optional] 分页偏移量。默认为 0。
56+
- `limit`: [int, optional] 分页限制。默认为 10。
57+
- `min_call_cost_millisecond`: [int, optional] 最小调用耗时(毫秒)。默认为 0。
58+
- `max_call_cost_millisecond`: [int, optional] 最大调用耗时(毫秒)。默认为 0。
59+
- `project_name`: [str, optional] 项目名称。
60+
- `tag_filters`: [list[dict], optional] 标签过滤列表。每个字典包含:
61+
- 'Key' (str): 标签键
62+
- 'Value' (list[str]): 标签值
63+
Max 10 tag pairs.
64+
最多 10 个标签对。空值表示对标签值无限制。
65+
- `region`: [str, optional] 地域 ID。默认为 cn-beijing。
3666

3767
## 可适配平台
3868
可以使用cline、cursor、claude desktop或支持MCP server调用的其它终端

server/mcp_server_apmplus/pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
[project]
22
name = "mcp-server-apmplus"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.10"
77
dependencies = [
8-
"mcp==1.10.0",
8+
"black>=26.1.0",
9+
"click==8.2.0",
10+
"mcp==1.12.4",
911
"requests>=2.32.3",
10-
"volcengine-python-sdk>=3.0.1",
12+
"volcengine-python-sdk==5.0.14",
1113
]
1214

1315
[project.scripts]
14-
mcp-server-apmplus = "mcp_server_apmplus.main:main"
16+
mcp-server-apmplus = "mcp_server_apmplus.server:main"
1517

1618
[build-system]
1719
requires = ["hatchling"]

server/mcp_server_apmplus/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,5 +77,5 @@ urllib3==2.4.0
7777
# volcengine-python-sdk
7878
uvicorn==0.34.2
7979
# via mcp
80-
volcengine-python-sdk==3.0.1
80+
volcengine-python-sdk==5.0.14
8181
# via mcp-server-apmplus (pyproject.toml)

server/mcp_server_apmplus/run.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ set -ex
33
cd `dirname $0`
44

55
cd src
6-
exec python3 -m mcp_server_apmplus.main -t streamable-http
6+
exec python3 -m mcp_server_apmplus.server -t streamable-http

0 commit comments

Comments
 (0)