Skip to content

Commit 9eed76d

Browse files
committed
address comments
1 parent 4da3d33 commit 9eed76d

File tree

1 file changed

+17
-35
lines changed

1 file changed

+17
-35
lines changed

docs/content/docs/operations/monitoring.md

Lines changed: 17 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ under the License.
2626

2727
### Built-in Metrics
2828

29-
We offer data monitoring for built-in metrics, which includes events and actions. Events provide general-level metrics, while actions deliver both general-level and type-specific data metrics.
29+
We offer data monitoring for built-in metrics, which includes events and actions.
3030

31-
| Component Type | Count | Meter |
32-
|-------------------------------|------------------------------|--------------------------------|
33-
| Agent (Operator Builtin) | NumOfInput<br>NumOfOutput | NumOfInputPerSec<br>NumOfOutputPerSec |
34-
| Event | numOfEventProcessed | numOfEventProcessedPerSec |
35-
| Action | numOfActionsExecuted | numOfActionsExecutedPerSec |
36-
| Pre-Action | numOfActionsExecuted | numOfActionsExecutedPerSec |
31+
| Scope | Metrics | Description | Type |
32+
|--------------|--------------------------------------------------|----------------------------------------------------------------------------------|-------|
33+
| **Operator** | numOfEventProcessed | The total number of Events this operator has processed. | Count |
34+
| **Operator** | numOfEventProcessedPerSec | The number of Events this operator has processed per second. | Meter |
35+
| **Operator** | numOfActionsExecuted | The total number of actions this operator has executed. | Count |
36+
| **Operator** | numOfActionsExecutedPerSec | The number of actions this operator has executed per second. | Meter |
37+
| **Action** | <action_name>.numOfActionsExecuted | The total number of actions this operator has executed for a specific action name. | Count |
38+
| **Action** | <action_name>.numOfActionsExecutedPerSec | The number of actions this operator has executed per second for a specific action name. | Meter |
3739

3840
####
3941

@@ -43,15 +45,15 @@ In Flink Agents, users implement their logic by defining custom Actions that res
4345

4446
Here is the user case example:
4547

46-
``````python
48+
```python
4749
class MyAgent(Agent):
4850
@action(InputEvent)
4951
@staticmethod
5052
def first_action(event: Event, ctx: RunnerContext): # noqa D102
5153
start_time = time.time_ns()
52-
input = event.input
53-
content = input.get_review() + " first action."
54-
ctx.send_event(MyEvent(value=content))
54+
55+
# the action logic
56+
...
5557

5658
# Access the main agent metric group
5759
metrics = ctx.agent_metric_group
@@ -64,33 +66,13 @@ class MyAgent(Agent):
6466
action_metrics = ctx.action_metric_group
6567
action_metrics.get_histogram("actionLatencyMs") \
6668
.update(int(time.time_ns() - start_time) // 1000000)
67-
68-
@action(MyEvent)
69-
@staticmethod
70-
def second_action(event: Event, ctx: RunnerContext): # noqa D102
71-
input = event.value
72-
content = input + " second action."
73-
ctx.send_event(OutputEvent(output=content))
74-
75-
# Access the main agent metric group
76-
metrics = ctx.agent_metric_group
77-
78-
# Update global metrics
79-
metrics.get_counter("numMyEvent").inc()
80-
metrics.get_meter("numMyEventPerSecond").mark()
81-
82-
# Creating and tracking metrics for MyEvent using submetric group
83-
if isinstance(event, MyEvent):
84-
sub_metrics = metrics.action_metric_group
85-
sub_metrics.get_counter("numEvent").inc()
86-
sub_metrics.get_meter("numEventPerSecond").mark()
87-
``````
88-
89-
69+
```
9070

9171
### How to check the metrics with Flink executor
9272

93-
We can check the metric result in the WebUI of Flink Job:
73+
Flink agents allow reporting metrics to external systems. Please refer to [Flink Metric Reporters](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/deployment/metric_reporters/) for more details.
74+
75+
Additionally, we can check the metric results in the Flink Job WebUI:
9476

9577
{{< img src="/fig/operations/metricwebui.png" alt="Metric Web UI" >}}
9678

0 commit comments

Comments
 (0)