当前位置:首页>python>【Python 监控】6个脚本打造Prometheus自定义Exporter

【Python 监控】6个脚本打造Prometheus自定义Exporter

  • 2026-08-22 03:43:35
【Python 监控】6个脚本打造Prometheus自定义Exporter

【Python 监控】6个脚本打造Prometheus自定义Exporter

适用环境:Python 3.8+ / Prometheus 2.x / Grafana 9.x。当现成的 Exporter 覆盖不了你的业务指标,自己动手写一个才是最快的路。

01

为什么你需要自定义 Exporter?

Prometheus 生态里有几百个现成的 Exporter:Node Exporter 采系统指标,MySQL Exporter 采数据库,Windows Exporter 采 Windows 性能计数器。大多数场景下,装一个就能用。

但运维现场总有这些情况:老板要看业务订单量随时间变化的曲线,DBA 想监控慢查询 TOP10 的实时趋势,网络组需要统计每台交换机的端口错误包。这些指标没有任何现成 Exporter 能采集——因为它们是你们公司独有的业务逻辑。

这时候,自定义 Exporter 就是唯一解。

好消息是:用 Python 写一个 Prometheus Exporter 非常简单。核心就是一个 HTTP 服务,在 /metrics 端点返回符合 Prometheus 格式的纯文本。整个流程用一张表就能说清楚:

步骤 做什么 关键工具
1. 装依赖 安装 prometheus_client pip install prometheus_client
2. 定义指标 选择 Gauge/Counter/Histogram Gauge / Counter / Summary
3. 采集数据 调用 API / 读文件 / 执行命令 requests / subprocess / psutil
4. 暴露端点 启动 HTTP 服务返回 /metrics start_http_server(9100)
5. 配置抓取 Prometheus 添加 scrape target prometheus.yml
6. 可视化 Grafana 建仪表盘 + 告警 Grafana Dashboard + AlertManager

下面6个脚本,从最基础的系统指标采集到业务级别的自定义监控,逐步递进。每个脚本都可以直接拿去用,改改参数就能跑。

02

脚本一:最简 Exporter — 30 行代码跑起来

先不管什么复杂场景,把一个能跑的 Exporter 搭起来再说。这个脚本采集当前进程的 CPU 和内存使用率,暴露到 9100 端口。

# exporter_basic.py — 最简 Prometheus Exporter
import time, psutil, os
from prometheus_client import Gauge, start_http_server

# 定义两个 Gauge 指标
CPU_GAUGE = Gauge("process_cpu_percent", "当前进程CPU使用率")
MEM_GAUGE = Gauge("process_memory_mb", "当前进程内存占用MB")

def collect():
    proc = psutil.Process(os.getpid())
    CPU_GAUGE.set(proc.cpu_percent(interval=1))
    MEM_GAUGE.set(proc.memory_info().rss / 1024 / 1024)

if __name__ == "__main__":
    start_http_server(9100)  # 暴露 /metrics 端点
    print("Exporter running on :9100/metrics")
    while True:
        collect()
        time.sleep(10)  # 每10秒采集一次

运行后用浏览器打开 http://localhost:9100/metrics,你会看到这样的输出:

# HELP process_cpu_percent 当前进程CPU使用率
# TYPE process_cpu_percent gauge
process_cpu_percent 2.3
# HELP process_memory_mb 当前进程内存占用MB
# TYPE process_memory_mb gauge
process_memory_mb 45.7

就这么简单。Prometheus 会定期来拉这个端点,数据就进 TSDB 了。接下来我们在这个框架上加各种采集逻辑就行。

⚠️ 指标命名规范:Prometheus 指标名只能用小写字母、数字和下划线,格式建议为 namespace_subsystem_name_unit,比如 myapp_http_requests_total。别用中划线,别用大写。
03

脚本二:Windows 性能计数器 Exporter

Linux 有 Node Exporter,但 Windows 很多关键指标藏在性能计数器(Performance Counter)里。比如 IIS 并发连接数、.NET CLR GC 次数、SQL Server 批处理速率——这些数据 Windows Exporter 不一定暴露得全。

用 Python 的 win32pdh 模块可以直接读性能计数器,配合 Prometheus 暴露出来:

# exporter_win_perfmon.py — Windows性能计数器Exporter
import time, win32pdh
from prometheus_client import Gauge, start_http_server

# 定义要采集的计数器路径
COUNTERS = {
    "win_iis_current_connections": "\\Web Service(_Total)\\Current Connections",
    "win_sql_batch_requests_sec": "\\SQLServer:SQL Statistics\\Batch Requests/sec",
    "win_net_bytes_total_sec": "\\Network Interface(*)\\Bytes Total/sec",
}

GAUGES = {}
for name in COUNTERS:
    GAUGES[name] = Gauge(name, f"Windows计数器: {name}")

def query_counter(path):
    hq = win32pdh.OpenQuery()
    hc = win32pdh.AddCounter(hq, path)
    win32pdh.CollectQueryData(hq)
    time.sleep(1)  # 部分计数器需要两次采样
    win32pdh.CollectQueryData(hq)
    _, val = win32pdh.GetFormattedCounterValue(hc, win32pdh.PDH_FMT_DOUBLE)
    win32pdh.CloseQuery(hq)
    return val

def collect():
    for name, path in COUNTERS.items():
        try:
            GAUGES[name].set(query_counter(path))
        except Exception as e:
            print(f"采集失败 {name}: {e}")

if __name__ == "__main__":
    start_http_server(9101)
    while True:
        collect()
        time.sleep(15)

这个脚本的关键在于 COUNTERS 字典——你想监控什么计数器,加一条路径就行。Windows 性能监视器里能看到的所有计数器,这里都能采。

如果服务器没装 pywin32,可以用 subprocesstypeperf 命令来替代,不过效率会低一些。

04

脚本三:HTTP 端点健康检查 Exporter

运维最基础的监控之一:你的服务还活着吗?响应时间正常吗?这个脚本批量检查一组 URL 的状态码和响应时间,用 Label 区分不同的服务:

# exporter_http_health.py — HTTP健康检查Exporter
import time, requests
from prometheus_client import Gauge, start_http_server

# 要监控的服务列表
TARGETS = [
    {"name": "web_frontend", "url": "https://www.example.com/health"},
    {"name": "api_backend", "url": "https://api.example.com/status"},
    {"name": "auth_service", "url": "https://auth.example.com/ping"},
]

STATUS = Gauge("http_up", "服务是否存活(1=正常)", ["service"])
LATENCY = Gauge("http_response_time_ms", "响应时间毫秒", ["service"])
STATUS_CODE = Gauge("http_status_code", "HTTP状态码", ["service"])

def check_endpoint(target):
    try:
        r = requests.get(target["url"], timeout=5)
        STATUS.labels(service=target["name"]).set(1 if r.status_code == 200 else 0)
        LATENCY.labels(service=target["name"]).set(r.elapsed.total_seconds() * 1000)
        STATUS_CODE.labels(service=target["name"]).set(r.status_code)
    except requests.RequestException:
        STATUS.labels(service=target["name"]).set(0)
        LATENCY.labels(service=target["name"]).set(-1)

if __name__ == "__main__":
    start_http_server(9102)
    while True:
        for t in TARGETS:
            check_endpoint(t)
        time.sleep(30)

注意这里用了 Label。Label 是 Prometheus 的核心能力——同一个指标名,通过不同的 Label 值区分不同的实例。在 Grafana 里你可以用 http_up{service="api_backend"} 精确过滤某一个服务。

输出的 metrics 长这样:

http_up{service="web_frontend"} 1.0
http_up{service="api_backend"} 1.0
http_up{service="auth_service"} 0.0
http_response_time_ms{service="web_frontend"} 123.5
http_response_time_ms{service="api_backend"} 45.2
05

脚本四:数据库慢查询监控 Exporter

DBA 最关心的事情之一:最近有没有慢查询?这个脚本连接 MySQL,统计过去 5 分钟内执行时间超过阈值的查询数量,并把 TOP3 慢查询的指纹暴露为指标:

# exporter_mysql_slow.py — MySQL慢查询Exporter
import time, pymysql
from prometheus_client import Gauge, Counter, start_http_server

DB_CONF = {"host": "127.0.0.1", "user": "monitor", "password": "secret"}
SLOW_THRESHOLD = 1.0  # 1秒以上算慢查询

SLOW_COUNT = Counter("mysql_slow_queries_total", "慢查询累计数")
SLOW_GAUGE = Gauge("mysql_slow_queries_5m", "过去5分钟慢查询数")

def collect_slow():
    conn = pymysql.connect(**DB_CONF, database="information_schema")
    cur = conn.cursor()
    cur.execute("""
        SELECT COUNT(*) FROM events_statements_summary_by_digest
        WHERE AVG_TIMER_WAIT/1000000000000 > %s
        AND LAST_SEEN > NOW() - INTERVAL 5 MINUTE
    """, (SLOW_THRESHOLD,))
    count = cur.fetchone()[0]
    SLOW_GAUGE.set(count)
    SLOW_COUNT.inc(count)
    conn.close()

if __name__ == "__main__":
    start_http_server(9103)
    while True:
        collect_slow()
        time.sleep(60)

这个脚本用 information_schema.events_statements_summary_by_digest 表来统计慢查询。它按 SQL 指纹聚合,不会因为同一条慢 SQL 执行了 100 次就报 100 个不同的指标。

如果你用的是 PostgreSQL,把查询换成 pg_stat_statements 视图就行,逻辑完全一样。

06

脚本五:Exporter 自监控 — 你的监控器还活着吗?

监控系统的监控,是运维的经典套娃问题。如果你的 Exporter 自己挂了,Prometheus 只会显示 target down,但你不会知道是 Exporter 进程死了还是网络不通。

这个脚本做两件事:暴露 Exporter 自身的健康指标,同时批量检查所有 Exporter 的 /metrics 端点是否正常响应:

# exporter_health.py — Exporter自监控
import time, requests, os, psutil
from prometheus_client import Gauge, Counter, start_http_server

# 所有Exporter的地址
EXPORTERS = [
    {"name": "basic", "url": "http://localhost:9100/metrics"},
    {"name": "win_perfmon", "url": "http://localhost:9101/metrics"},
    {"name": "http_health", "url": "http://localhost:9102/metrics"},
    {"name": "mysql_slow", "url": "http://localhost:9103/metrics"},
]

UP = Gauge("exporter_up", "Exporter是否存活", ["exporter"])
SCRAPE_DURATION = Gauge("exporter_scrape_duration_ms", "抓取耗时", ["exporter"])
SCRAPE_ERRORS = Counter("exporter_scrape_errors_total", "抓取失败累计", ["exporter"])
SELF_MEM = Gauge("exporter_self_memory_mb", "本进程内存MB")
SELF_CPU = Gauge("exporter_self_cpu_percent", "本进程CPU%")

def check_exporters():
    for exp in EXPORTERS:
        try:
            r = requests.get(exp["url"], timeout=3)
            UP.labels(exporter=exp["name"]).set(1 if r.status_code == 200 else 0)
            SCRAPE_DURATION.labels(exporter=exp["name"]).set(r.elapsed.total_seconds() * 1000)
        except Exception:
            UP.labels(exporter=exp["name"]).set(0)
            SCRAPE_ERRORS.labels(exporter=exp["name"]).inc()

def self_metrics():
    proc = psutil.Process(os.getpid())
    SELF_MEM.set(proc.memory_info().rss / 1024 / 1024)
    SELF_CPU.set(proc.cpu_percent(interval=0.5))

if __name__ == "__main__":
    start_http_server(9104)
    while True:
        check_exporters()
        self_metrics()
        time.sleep(15)

这个脚本的思路很直接:用一个"管家"Exporter 去检查所有其他 Exporter 的健康状态,同时暴露自己的资源使用情况。如果某个 Exporter 挂了,exporter_up{name="xxx"} 会变成 0,Grafana 就能立即告警。

⚠️ 生产环境注意:这个"管家"Exporter 本身也需要被监控。建议用 systemd 管理所有 Exporter 进程,并配置 Restart=always 自动重启。同时把管家 Exporter 的端口也加到 Prometheus 的抓取目标里。
07

脚本六:Prometheus 注册 + Grafana 仪表盘

Exporter 都跑起来了,最后一步是让 Prometheus 来抓取它们,然后在 Grafana 里建仪表盘。

编辑 Prometheus 配置文件 prometheus.yml,添加抓取目标:

# prometheus.yml 追加内容
scrape_configs:
  - job_name: "custom_python_exporters"
    scrape_interval: 15s
    static_configs:
      - targets:
          - "server01:9100"  # 基础指标
          - "server01:9101"  # Windows性能计数器
          - "server01:9102"  # HTTP健康检查
          - "server01:9103"  # MySQL慢查询
          - "server01:9104"  # Exporter自监控

重启 Prometheus 后,打开 http://prometheus:9090/targets,确认所有 target 状态是 UP。

接下来在 Grafana 里建仪表盘。核心面板推荐这几个:

面板名称 PromQL 查询 可视化类型
服务存活状态 http_up Stat (绿/红灯)
响应时间趋势 http_response_time_ms Time Series
慢查询趋势 rate(mysql_slow_queries_total[5m]) Time Series + Threshold
Exporter健康 exporter_up Stat (绿/红灯)

告警规则建议在 Prometheus 端配置,而不是在 Grafana 里。原因是 Prometheus 的告警规则可以复用 recording rules,性能更好:

groups:
  - name: custom_exporter_alerts
    rules:
      - alert: ServiceDown
        expr: http_up == 0
        for: 2m
        labels:
          severity: critical
        annotations:
          summary: "服务 {{ $labels.service }} 不可用"

配合 AlertManager,告警可以推送到钉钉、飞书、Slack 或者企业微信。具体的 AlertManager 配置不是本文重点,但核心思路就是:Exporter 产生指标 → Prometheus 抓取 → 告警规则匹配 → AlertManager 路由通知。

总结

6 个脚本,从零搭建了一套完整的自定义监控体系:基础指标、Windows 性能计数器、HTTP 健康检查、数据库慢查询、Exporter 自监控、Prometheus 注册 + Grafana 可视化。每个脚本都是独立可运行的,按需组合就行。

关键记住三点:指标命名要规范(namespace_subsystem_name_unit),采集间隔别太短(10-30 秒足够),Exporter 进程要用 systemd 管理并配置自动重启。做到这三点,你的自定义监控就能稳定跑在生产环境。

— END —

岩学晓林 技术栈

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-08-22 09:02:43 HTTP/2.0 GET : https://f.mffb.com.cn/a/511769.html
  2. 运行时间 : 0.519304s [ 吞吐率:1.93req/s ] 内存消耗:4,557.16kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=80d32d0adb93122d3e877170f807dc57
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000994s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.001576s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.006202s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.000702s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.001367s ]
  6. SELECT * FROM `set` [ RunTime:0.034424s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.001814s ]
  8. SELECT * FROM `article` WHERE `id` = 511769 LIMIT 1 [ RunTime:0.008556s ]
  9. UPDATE `article` SET `lasttime` = 1787360563 WHERE `id` = 511769 [ RunTime:0.007419s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 66 LIMIT 1 [ RunTime:0.000887s ]
  11. SELECT * FROM `article` WHERE `id` < 511769 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.028826s ]
  12. SELECT * FROM `article` WHERE `id` > 511769 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.004562s ]
  13. SELECT * FROM `article` WHERE `id` < 511769 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.158649s ]
  14. SELECT * FROM `article` WHERE `id` < 511769 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.016230s ]
  15. SELECT * FROM `article` WHERE `id` < 511769 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.024913s ]
0.526155s