Skip to content

Commit 06a347d

Browse files
authored
Merge pull request #87747 from skrthomas/OSDOCS-13237
OSDOCS-13237: Create metrics for network traffic flows fields
2 parents 65bd4be + 85dbb26 commit 06a347d

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * observability/network_observability/mertics-alerts-dashboards.adoc
4+
5+
:_mod-docs-content-type: PROCEDURE
6+
[id="network-observability-creating-metrics-network-events_{context}"]
7+
= Creating metrics from nested or array fields in the Traffic flows table
8+
9+
:FeatureName: OVN Observability / Viewing `NetworkEvents`
10+
include::snippets/technology-preview.adoc[]
11+
[IMPORTANT]
12+
====
13+
OVN Observability and the ability to view and track network events is available only in {product-title} 4.17 and 4.18.
14+
====
15+
You can create a `FlowMetric` resource to generate metrics for nested or array fields in the *Traffic flows* table, such as *Network events* or *Interfaces*. The following example shows how to generate metrics from the *Network events* field for network policy events.
16+
17+
.Prerequsities
18+
* Enable `NetworkEvents feature`. See the Additional resources for how to do this.
19+
* A network policy specified.
20+
21+
.Procedure
22+
. In the web console, navigate to *Operators* -> *Installed Operators*.
23+
. In the *Provided APIs* heading for the *NetObserv Operator*, select *FlowMetric*.
24+
. In the *Project* dropdown list, select the project of the Network Observability Operator instance.
25+
. Click *Create FlowMetric*.
26+
. Create `FlowMetric` resources to add the following configurations:
27+
+
28+
.Configuration counting network policy events per policy name and namespace
29+
[source,yaml]
30+
----
31+
apiVersion: flows.netobserv.io/v1alpha1
32+
kind: FlowMetric
33+
metadata:
34+
name: network-policy-events
35+
namespace: netobserv
36+
spec:
37+
metricName: network_policy_events_total
38+
type: Counter
39+
labels: [NetworkEvents>Type, NetworkEvents>Namespace, NetworkEvents>Name, NetworkEvents>Action, NetworkEvents>Direction] <1>
40+
filters:
41+
- field: NetworkEvents>Feature
42+
value: acl
43+
flatten: [NetworkEvents] <2>
44+
remap: <3>
45+
"NetworkEvents>Type": type
46+
"NetworkEvents>Namespace": namespace
47+
"NetworkEvents>Name": name
48+
"NetworkEvents>Direction": direction
49+
----
50+
<1> These labels represent the nested fields for *Network Events* from the *Traffic flows* table. Each network event has a specific type, namespace, name, action, and direction. You can alternatively specify the `Interfaces` if `NetworkEvents` is unavailable in your {product-title} version.
51+
<2> Optional: You can choose to represent a field that contains a list of items as distinct items.
52+
<3> Optional: You can rename the fields in Prometheus.
53+
54+
.Verification
55+
. In the web console, navigate to *Observe* -> *Dashboards* and scroll down to see the *Network Policy* tab.
56+
. You should begin seeing metrics filter in based on the metric you created along with the network policy specifications.

modules/network-observability-metrics-names.adoc

+6-1
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,9 @@ When the `FlowRTT` feature is enabled in `spec.agent.ebpf.features`, the followi
5050

5151
* `namespace_rtt_seconds` *
5252
* `node_rtt_seconds`
53-
* `workload_rtt_seconds`
53+
* `workload_rtt_seconds`
54+
55+
Network events metrics names::
56+
When `NetworkEvents` feature is enabled, this metric is available by default:
57+
58+
* `namespace_network_policy_events_total`

observability/network_observability/metrics-alerts-dashboards.adoc

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ include::modules/network-observability-metrics-names.adoc[leveloffset=+1]
1414
include::modules/network-observability-includelist-example.adoc[leveloffset=+1]
1515
include::modules/network-observability-custom-metrics.adoc[leveloffset=+1]
1616
include::modules/network-observability-configuring-custom-metrics.adoc[leveloffset=+1]
17+
include::modules/network-observability-creating-metrics-network-events.adoc[leveloffset=+1]
1718

1819
[IMPORTANT]
1920
====
20-
High cardinality can affect the memory usage of Prometheus. You can check whether specific labels have high cardinality in the xref:../../observability/network_observability/json-flows-format-reference.adocl#network-observability-flows-format_json_reference[Network Flows format reference].
21+
High cardinality can affect the memory usage of Prometheus. You can check whether specific labels have high cardinality in the xref:../../observability/network_observability/json-flows-format-reference.adoc#network-observability-flows-format_json_reference[Network Flows format reference].
2122
====
2223
include::modules/network-observability-flowmetrics-charts.adoc[leveloffset=+1]
2324
include::modules/network-observability-tcp-flag-syn-flood.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)