You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
31
30
32
-
**TODO**: How to check the metrics with Flink executor.
In Flink Agents, users implement their logic by defining custom Actions that respond to various Events throughout the Agent lifecycle. To support user-defined metrics, we introduce two new properties: `agent_metric_group` and `action_metric_group` in the RunnerContext. These properties allow users to create or update global metrics and independent metrics for actions. For an introduction to metric types, please refer to the [Metric types documentation](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/ops/metrics/#metric-types).
# Creating and tracking metrics for MyEvent using submetric group
83
+
ifisinstance(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
+
90
+
91
+
### How to check the metrics with Flink executor
92
+
93
+
We can check the metric result in the WebUI of Flink Job:
94
+
95
+
{{< img src="/fig/operations/metricwebui.png" alt="Metric Web UI" >}}
34
96
35
97
## Log
36
98
37
-
{{< hint warning >}}
38
-
**TODO**: How to add log in Flink Agents.
99
+
The Flink Agents' log system uses Flink's logging framework. For more details, please refer to the [Flink log system documentation](https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/advanced/logging/).
100
+
101
+
### How to add log in Flink Agents
102
+
103
+
For adding logs in Java code, you can refer to [Best practices for developers](https://nightlies.apache.org/flink/flink-docs-master/docs/deployment/advanced/logging/#best-practices-for-developers). In Python, you can add logs using `logging`. Here is a specific example:
**TODO**: How to check the logs with Flink executor.
41
-
{{< /hint >}}
115
+
We can check the log result in the WebUI of Flink Job:
116
+
117
+
{{< img src="/fig/operations/logwebui.png" alt="Log Web UI" >}}
42
118
43
119
## Event Log
44
120
45
-
{{< hint warning >}}
46
-
**TODO**: How to use and check the event logs.
47
-
{{< /hint >}}
121
+
Currently, the system supports **File-based Event Log** as the default implementation. Future releases will introduce support for additional types of event logs and provide configuration options to let users choose their preferred logging mechanism.
122
+
123
+
### File Event Log
124
+
125
+
The **File Event Log** is a file-based event logging system that stores events in structured files within a flat directory. Each event is recorded in **JSON Lines (JSONL)** format, with one JSON object per line.
126
+
127
+
#### File Structure
128
+
129
+
The log files follow a naming convention consistent with Flink's logging standards and are stored in a flat directory structure:
130
+
131
+
```
132
+
{baseLogDir}/
133
+
├── events-{jobId}-{taskName}-{subtaskId}.log
134
+
├── events-{jobId}-{taskName}-{subtaskId}.log
135
+
└── events-{jobId}-{taskName}-{subtaskId}.log
136
+
```
137
+
138
+
By default, all File-based Event Logs are stored in the `flink-agents` subdirectory under the system temporary directory (`java.io.tmpdir`). In future versions, we plan to add a configurable parameter to allow users to customize the base log directory, providing greater control over log storage paths and lifecycle management.
0 commit comments