209.9. メトリクスタイプタイマー
metrics:timer:metricname[?options]
209.9.1. オプション
名前 | デフォルト | 説明 |
---|---|---|
action | - | 開始または停止 |
action
または無効な値が指定されていない場合、タイマーの更新なしで警告がログに記録されます。すでに実行中のタイマーでアクション start
が呼び出された場合、または実行されていないタイマーで stop
が呼び出された場合、何も更新されず、警告がログに記録されます。
// 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 プロパティーとして格納されます。
209.9.2. ヘッダー
メッセージヘッダーを使用して、Metrics コンポーネント URI で指定されたアクション値をオーバーライドできます。
名前 | 説明 | 想定されるタイプ |
---|---|---|
CamelMetricsTimerAction | URI のタイマーアクションをオーバーライドする |
|
// sets timer action using header from("direct:in") .setHeader(MetricsConstants.HEADER_TIMER_ACTION, TimerAction.start) .to("metric:timer:simple.timer") .to("direct:out");