Skip to content

Commit 84dbf1a

Browse files
authored
Change gauges to counters (#95)
* Add RecentRawValues field to GroupState to update prom counters * Fix tests * Update network_definitions gauge->counter * Add support to count operation with Counters
1 parent b24be79 commit 84dbf1a

19 files changed

+65
-55
lines changed

contrib/kubernetes/flowlogs2metrics.conf.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,105 +7,105 @@ pipeline:
77
prom:
88
metrics:
99
- name: bandwidth_per_network_service
10-
type: gauge
10+
type: counter
1111
valuekey: bandwidth_network_service_value
1212
labels:
1313
- by
1414
- aggregate
1515
buckets: []
1616
- name: bandwidth_per_source_destination_subnet
17-
type: gauge
17+
type: counter
1818
valuekey: bandwidth_source_destination_subnet_value
1919
labels:
2020
- by
2121
- aggregate
2222
buckets: []
2323
- name: bandwidth_per_source_subnet
24-
type: gauge
24+
type: counter
2525
valuekey: bandwidth_source_subnet_value
2626
labels:
2727
- by
2828
- aggregate
2929
buckets: []
3030
- name: connections_per_destination_subnet
31-
type: gauge
31+
type: counter
3232
valuekey: dest_connection_subnet_count_value
3333
labels:
3434
- by
3535
- aggregate
3636
buckets: []
3737
- name: connections_per_source_subnet
38-
type: gauge
38+
type: counter
3939
valuekey: src_connection_count_value
4040
labels:
4141
- by
4242
- aggregate
4343
buckets: []
4444
- name: connections_per_tcp_flags
45-
type: gauge
45+
type: counter
4646
valuekey: TCPFlags_count_value
4747
labels:
4848
- by
4949
- aggregate
5050
buckets: []
5151
- name: connections_per_destination_as
52-
type: gauge
52+
type: counter
5353
valuekey: dst_as_connection_count_value
5454
labels:
5555
- by
5656
- aggregate
5757
buckets: []
5858
- name: connections_per_source_as
59-
type: gauge
59+
type: counter
6060
valuekey: src_as_connection_count_value
6161
labels:
6262
- by
6363
- aggregate
6464
buckets: []
6565
- name: count_per_source_destination_subnet
66-
type: gauge
66+
type: counter
6767
valuekey: count_source_destination_subnet_value
6868
labels:
6969
- by
7070
- aggregate
7171
buckets: []
7272
- name: egress_per_destination_subnet
73-
type: gauge
73+
type: counter
7474
valuekey: bandwidth_destination_subnet_value
7575
labels:
7676
- by
7777
- aggregate
7878
buckets: []
7979
- name: egress_per_namespace
80-
type: gauge
80+
type: counter
8181
valuekey: bandwidth_namespace_value
8282
labels:
8383
- by
8484
- aggregate
8585
buckets: []
8686
- name: connections_per_destination_location
87-
type: gauge
87+
type: counter
8888
valuekey: dest_connection_location_count_value
8989
labels:
9090
- by
9191
- aggregate
9292
buckets: []
9393
- name: mice_count
94-
type: gauge
94+
type: counter
9595
valuekey: mice_count_value
9696
labels:
9797
- by
9898
- aggregate
9999
buckets: []
100100
- name: elephant_count
101-
type: gauge
101+
type: counter
102102
valuekey: elephant_count_value
103103
labels:
104104
- by
105105
- aggregate
106106
buckets: []
107107
- name: service_count
108-
type: gauge
108+
type: counter
109109
valuekey: dest_service_count_value
110110
labels:
111111
- by

docs/metrics.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ and the transformation to generate the exported metric.
1919
| **Usage** | Evaluate network usage breakdown per network service |
2020
| **Labels** | bandwidth, graph, rate, network-service |
2121
| **Operation** | aggregate by `service` and `sum` field `bytes` |
22-
| **Exposed as** | `fl2m_bandwidth_per_network_service` of type `gauge` |
22+
| **Exposed as** | `fl2m_bandwidth_per_network_service` of type `counter` |
2323
| **Visualized as** | "Bandwidth per network service" on dashboard `details` |
2424
|||
2525

@@ -31,7 +31,7 @@ and the transformation to generate the exported metric.
3131
| **Usage** | Evaluate network usage breakdown per source / destination subnet pair |
3232
| **Labels** | bandwidth, graph, rate, subnet |
3333
| **Operation** | aggregate by `dstSubnet24, srcSubnet24` and `sum` field `bytes` |
34-
| **Exposed as** | `fl2m_bandwidth_per_source_destination_subnet` of type `gauge` |
34+
| **Exposed as** | `fl2m_bandwidth_per_source_destination_subnet` of type `counter` |
3535
| **Visualized as** | "Bandwidth per src and destination subnet" on dashboard `details` |
3636
|||
3737

@@ -43,7 +43,7 @@ and the transformation to generate the exported metric.
4343
| **Usage** | Evaluate network usage breakdown per source subnet |
4444
| **Labels** | bandwidth, graph, rate, subnet |
4545
| **Operation** | aggregate by `srcSubnet` and `sum` field `bytes` |
46-
| **Exposed as** | `fl2m_bandwidth_per_source_subnet` of type `gauge` |
46+
| **Exposed as** | `fl2m_bandwidth_per_source_subnet` of type `counter` |
4747
| **Visualized as** | "Bandwidth per source subnet" on dashboard `details` |
4848
|||
4949

@@ -55,7 +55,7 @@ and the transformation to generate the exported metric.
5555
| **Usage** | Evaluate network connections per subnet |
5656
| **Labels** | rate, subnet |
5757
| **Operation** | aggregate by `dstSubnet` and `sum` field `isNewFlow` |
58-
| **Exposed as** | `fl2m_connections_per_destination_subnet` of type `gauge` |
58+
| **Exposed as** | `fl2m_connections_per_destination_subnet` of type `counter` |
5959
| **Visualized as** | "Connections rate per destinationIP /16 subnets" on dashboard `details` |
6060
|||
6161

@@ -67,7 +67,7 @@ and the transformation to generate the exported metric.
6767
| **Usage** | Evaluate network connections per subnet |
6868
| **Labels** | rate, subnet |
6969
| **Operation** | aggregate by `srcSubnet` and `count` |
70-
| **Exposed as** | `fl2m_connections_per_source_subnet` of type `gauge` |
70+
| **Exposed as** | `fl2m_connections_per_source_subnet` of type `counter` |
7171
| **Visualized as** | "Connections rate per sourceIP /16 subnets" on dashboard `details` |
7272
|||
7373

@@ -79,7 +79,7 @@ and the transformation to generate the exported metric.
7979
| **Usage** | Evaluate difference in connections rate of different TCP Flags. Can be used, for example, to identify syn-attacks. |
8080
| **Labels** | rate, TCPFlags |
8181
| **Operation** | aggregate by `TCPFlags` and `count` |
82-
| **Exposed as** | `fl2m_connections_per_tcp_flags` of type `gauge` |
82+
| **Exposed as** | `fl2m_connections_per_tcp_flags` of type `counter` |
8383
| **Visualized as** | "Connections rate per TCPFlags" on dashboard `details` |
8484
|||
8585

@@ -91,7 +91,7 @@ and the transformation to generate the exported metric.
9191
| **Usage** | Evaluate amount of connections targeted at different Autonomous Systems |
9292
| **Labels** | rate, count, AS |
9393
| **Operation** | aggregate by `dstAS` and `count` |
94-
| **Exposed as** | `fl2m_connections_per_destination_as` of type `gauge` |
94+
| **Exposed as** | `fl2m_connections_per_destination_as` of type `counter` |
9595
| **Visualized as** | "Connections rate per destination AS" on dashboard `details` |
9696
|||
9797

@@ -103,7 +103,7 @@ and the transformation to generate the exported metric.
103103
| **Usage** | Evaluate amount of connections initiated by different Autonomous Systems |
104104
| **Labels** | rate, count, AS |
105105
| **Operation** | aggregate by `srcAS` and `count` |
106-
| **Exposed as** | `fl2m_connections_per_source_as` of type `gauge` |
106+
| **Exposed as** | `fl2m_connections_per_source_as` of type `counter` |
107107
| **Visualized as** | "Connections rate per source AS" on dashboard `details` |
108108
|||
109109

@@ -115,7 +115,7 @@ and the transformation to generate the exported metric.
115115
| **Usage** | Evaluate network usage breakdown per source / destination subnet pair |
116116
| **Labels** | count, graph, rate, subnet |
117117
| **Operation** | aggregate by `dstSubnet24, srcSubnet24` and `count` |
118-
| **Exposed as** | `fl2m_count_per_source_destination_subnet` of type `gauge` |
118+
| **Exposed as** | `fl2m_count_per_source_destination_subnet` of type `counter` |
119119
| **Visualized as** | "Connections rate of src / destination subnet occurences" on dashboard `details` |
120120
|||
121121

@@ -127,7 +127,7 @@ and the transformation to generate the exported metric.
127127
| **Usage** | Evaluate network usage breakdown per destination subnet |
128128
| **Labels** | bandwidth, graph, rate, subnet |
129129
| **Operation** | aggregate by `dstSubnet` and `sum` field `bytes` |
130-
| **Exposed as** | `fl2m_egress_per_destination_subnet` of type `gauge` |
130+
| **Exposed as** | `fl2m_egress_per_destination_subnet` of type `counter` |
131131
| **Visualized as** | "Bandwidth per destination subnet" on dashboard `details` |
132132
| **Visualized as** | "Total bandwidth" on dashboard `totals` |
133133
|||
@@ -140,7 +140,7 @@ and the transformation to generate the exported metric.
140140
| **Usage** | Evaluate network usage breakdown per namespace |
141141
| **Labels** | kubernetes, bandwidth, graph |
142142
| **Operation** | aggregate by `srcK8S_Namespace, srcK8S_Type` and `sum` field `bytes` |
143-
| **Exposed as** | `fl2m_egress_per_namespace` of type `gauge` |
143+
| **Exposed as** | `fl2m_egress_per_namespace` of type `counter` |
144144
| **Visualized as** | "Bandwidth per namespace" on dashboard `details` |
145145
|||
146146

@@ -152,7 +152,7 @@ and the transformation to generate the exported metric.
152152
| **Usage** | Evaluate network connections geo-location |
153153
| **Labels** | rate, connections-count, geo-location, destinationIP |
154154
| **Operation** | aggregate by `dstLocation_CountryName` and `count` |
155-
| **Exposed as** | `fl2m_connections_per_destination_location` of type `gauge` |
155+
| **Exposed as** | `fl2m_connections_per_destination_location` of type `counter` |
156156
| **Visualized as** | "Connections rate per destinationIP geo-location" on dashboard `details` |
157157
|||
158158

@@ -165,8 +165,8 @@ and the transformation to generate the exported metric.
165165
| **Labels** | bandwidth, mice, elephant, rate |
166166
| **Operation** | aggregate by `mice_Evaluate` and `count` |
167167
| **Operation** | aggregate by `elephant_Evaluate` and `count` |
168-
| **Exposed as** | `fl2m_mice_count` of type `gauge` |
169-
| **Exposed as** | `fl2m_elephant_count` of type `gauge` |
168+
| **Exposed as** | `fl2m_mice_count` of type `counter` |
169+
| **Exposed as** | `fl2m_elephant_count` of type `counter` |
170170
| **Visualized as** | "Mice flows count" on dashboard `details` |
171171
| **Visualized as** | "Elephant flows count" on dashboard `details` |
172172
|||
@@ -179,7 +179,7 @@ and the transformation to generate the exported metric.
179179
| **Usage** | Evaluate network services |
180180
| **Labels** | rate, network-services, destination-port, destination-protocol |
181181
| **Operation** | aggregate by `service` and `count` |
182-
| **Exposed as** | `fl2m_service_count` of type `gauge` |
182+
| **Exposed as** | `fl2m_service_count` of type `counter` |
183183
| **Visualized as** | "Network services connections rate" on dashboard `details` |
184184
| **Visualized as** | "Number of network services" on dashboard `totals` |
185185
|||

network_definitions/bandwidth_per_network_service.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ encode:
2828
prom:
2929
metrics:
3030
- name: bandwidth_per_network_service
31-
type: gauge
31+
type: counter
3232
valuekey: bandwidth_network_service_value
3333
labels:
3434
- by

network_definitions/bandwidth_per_src_dest_subnet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ encode:
3333
prom:
3434
metrics:
3535
- name: bandwidth_per_source_destination_subnet
36-
type: gauge
36+
type: counter
3737
valuekey: bandwidth_source_destination_subnet_value
3838
labels:
3939
- by

network_definitions/bandwidth_per_src_subnet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ encode:
2828
prom:
2929
metrics:
3030
- name: bandwidth_per_source_subnet
31-
type: gauge
31+
type: counter
3232
valuekey: bandwidth_source_subnet_value
3333
labels:
3434
- by

network_definitions/connection_rate_per_dest_subnet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ encode:
3131
prom:
3232
metrics:
3333
- name: connections_per_destination_subnet
34-
type: gauge
34+
type: counter
3535
valuekey: dest_connection_subnet_count_value
3636
labels:
3737
- by

network_definitions/connection_rate_per_src_subnet.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ encode:
2626
prom:
2727
metrics:
2828
- name: connections_per_source_subnet
29-
type: gauge
29+
type: counter
3030
valuekey: src_connection_count_value
3131
labels:
3232
- by

network_definitions/connection_rate_per_tcp_flags.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ encode:
2020
prom:
2121
metrics:
2222
- name: connections_per_tcp_flags
23-
type: gauge
23+
type: counter
2424
valuekey: TCPFlags_count_value
2525
labels:
2626
- by

network_definitions/connections_per_dst_as.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ encode:
2121
prom:
2222
metrics:
2323
- name: connections_per_destination_as
24-
type: gauge
24+
type: counter
2525
valuekey: dst_as_connection_count_value
2626
labels:
2727
- by

network_definitions/connections_per_src_as.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ encode:
2121
prom:
2222
metrics:
2323
- name: connections_per_source_as
24-
type: gauge
24+
type: counter
2525
valuekey: src_as_connection_count_value
2626
labels:
2727
- by

0 commit comments

Comments
 (0)