@@ -68,9 +68,11 @@ No API changes were done.
6868### OVN sampling details
6969
7070OVN has 3 main db tables that are used for sampling:
71- - ` Sample_collector ` : This table is used to define the sampling collector. It defines the sampling rate and collectorID,
72- which is used to set up collectors in the OVS.
71+ - ` Sample_collector ` : This table is used to define the sampling collector. It defines the sampling rate via ` Probability ` field
72+ and collectorID via ` SetID ` field, which is used to set up collectors in the OVS.
7373- ` Sampling_app ` : This table is used to set ` ID ` s for existing OVN sampling applications, that are sent together with the samples.
74+ There is a supported set of ` Sampling_app ` types, for example ` acl-new ` app is used to sample new connections matched by an ACL.
75+ ` Sampling_app.ID ` is a way to identify the application that generated the sample.
7476- ` Sample ` : This table is used to define required samples and point to the collectors.
7577Every sample has ` Metadata ` that is sent together with the sample.
7678
@@ -84,15 +86,21 @@ that is decoded by `go-controller/observability-lib`.
8486When one of the supported objects (for example, network policy) is created, ovn-kuberentes generates an nbdb ` Sample ` for it.
8587
8688To decode the samples into human-readable information, ` go-controller/observability-lib ` is used. It finds ` Sample `
87- by the attached ` Sample.Metadata ` and then gets corresponding db object based on ` Sampling_add.ID ` and ` Sample.UUID ` .
88- The message is then constructed using db object ` external_ids ` .
89-
90- ### Full stack architecture
89+ by the attached ` Sample.Metadata ` and then gets corresponding db object (e.g. ACL) based on ` Sampling_app.ID ` and ` Sample.UUID ` .
90+ The message is then constructed using db object (e.g. ACL) ` external_ids ` .
9191
9292![ ovnkube-observ] ( ../images/ovnkube-observ.png )
9393
9494The diagram shows how all involved components (kernel, OVS, OVN, ovn-kubernetes) are connected.
9595
96+ #### Enabling collectors
97+
98+ Currently, we have only 1 default collector with hard-coded ID, which is set via the ` Sample_collector.SetID ` field.
99+ To make OVS start sending samples for an existing ` Sample_collector ` , a new OVSDB ` Flow_Sample_Collector_Set ` entry
100+ needs to be created with ` Flow_Sample_Collector_Set.ID ` value of ` Sample_collector.SetID ` .
101+ This is done by the ` go-controller/observability-lib ` and it is important to note that only one ` Flow_Sample_Collector_Set `
102+ should be created for a given ` Sample_collector.SetID ` value at a time. But if such entry already exists, it can be reused.
103+
96104## Best Practices
97105
98106TDB
@@ -126,6 +134,9 @@ This applies to
126134
127135 in both cases ANP will have only first-packet sample.
128136
137+ Use caution when running the ` ovnkube-observe ` tool. Currently it has poor resource management and consumes a lot of
138+ CPU when many packets are sent. Tracked here https://github.com/ovn-kubernetes/ovn-kubernetes/issues/5203
139+
129140## References
130141
131142NONE
0 commit comments