阿波罗·普罗米修斯导出器
阿波罗服务器以普罗米修斯格式导出度量衡的插件 .
用这个 舞会客户 在盖子下面,导出度量衡.
自从阿波罗服务器发布新的主要版本后,出口商的新版本(v2.x.y)已经推出. 阿波罗 服务器 v2 仍然在 v1.x.y. 这两个版本将尽可能与特征相匹配.
计量
| 名称 | 说明 | 类型 |
|---|---|---|
apollo_server_starting | 阿波罗服务器启动时的最后时刻戳. | 高盖 |
apollo_server_closing | 阿波罗服务器关闭时的最后一个时间戳. | 高盖 |
apollo_query_started | 收到查询的数量. | 计数器 |
apollo_query_failed | 失败的查询量 . | 计数器 |
apollo_query_parse_started | 解析开始的查询量 . | 计数器 |
apollo_query_parse_failed | 解析失败的查询量 . | 计数器 |
apollo_query_validation_started | 已经开始验证的查询量 . | 计数器 |
apollo_query_validation_failed | 验证失败的查询量 . | 计数器 |
apollo_query_resolved | 可解决的查询数量. | 计数器 |
apollo_query_execution_started | 已经开始执行的查询数量 . | 计数器 |
apollo_query_execution_failed | 执行失败的查询量 . | 计数器 |
apollo_query_duration | 查询的总持续时间. | 直方图 |
apollo_query_field_resolution_duration | 解决字段的总长度 . | 直方图 |
关于默认衡量标准,请参考 舞会客户 默认参数.
使用量
-
安装
prom-client财务报告和审定财务报表@bmatei/apollo-prometheus-exporternpm install prom-client @bmatei/apollo-prometheus-exporter -
创建插件实例
const app = express(); const prometheusExporterPlugin = createPrometheusExporterPlugin({ app }); -
将插件添加到阿波罗服务器
const server = new ApolloServer({ plugins: [prometheusExporterPlugin] });
完整的例子,请看一下 example 此寄存器中的项目.
选项
| 名称 | 说明 | 类型 | 默认值 |
|---|---|---|---|
app | 快速实例。 目前,它被用于确定衡量终点。 除非 metricsEndpoint 被设定为虚假. | Express | undefined |
defaultLabels | 包含默认标签的对象将随每个度量发送. | Object | {} |
defaultMetrics | 启用/禁用默认参数的旗帜 prom-client。 。 。 . | Boolean | true |
defaultMetricsOptions | 默认参数的配置对象 . | DefaultMetricsCollectorConfiguration | {} |
durationHistogramBuckets | 直方图应当使用的期限列表. | number[] | [0.001, 0.005, 0.015, 0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 1, 5, 10] |
hostnameLabel | 要启用/ 无法启用的旗帜 hostname 标签. | Boolean | true |
hostnameLabelName | 名称 hostname 标签. | String | hostname |
metricsEndpoint | 启用/ 禁用公尺终点的旗帜 。 如果您禁用此选项, 您可以使用 registerPrometheusMetricsEndpoint 方法可以启用度量衡终点. | Boolean | true |
metricsEndpointPath | HTTP 路径, 其中将发布测量值 . | String | "/metrics" |
register | 普罗米修斯客户端注册表供阿波罗计量公司使用. 默认情况下,它也被默认的度量衡所使用. | Registry | register |
skipMetrics | 用于控制是否启用或禁用一个计量的密钥值映射 . | SkipMetricsMap | {} |