220.10. Metrics 类型 timer


metrics:timer:metricname[?options]

220.10.1. 选项

Expand
Namedefault描述

action

-

启动或停止

如果没有提供 操作 或无效值,则在没有计时器更新的情况下会记录警告。如果在已在运行的计时器 或停止 上调用操作 start,则不会运行计时器,则不会更新并记录警告。

// measure time taken by route "calculate"
from("direct:in")
    .to("metrics:timer:simple.timer?action=start")
    .to("direct:calculate")
    .to("metrics:timer:simple.timer?action=stop");

TimerContext 对象存储为不同 Metrics 组件调用之间的 Exchange 属性。

220.10.2. Headers

消息标头可用于覆盖 Metrics 组件 URI 中指定的操作值。

Expand
Name描述预期类型

CamelMetricsTimerAction

覆盖 URI 中的计时器操作

org.apache.camel.component.metrics.timer.TimerEndpoint.TimerAction

// sets timer action using header
from("direct:in")
    .setHeader(MetricsConstants.HEADER_TIMER_ACTION, TimerAction.start)
    .to("metrics:timer:simple.timer")
    .to("direct:out");
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部