Skip to content

Commit 5c1d90f

Browse files
committed
Add HFT harmonizer configuration
Signed-off-by: Ze Gan <ganze718@gmail.com>
1 parent 9f40291 commit 5c1d90f

2 files changed

Lines changed: 105 additions & 14 deletions

File tree

doc/high-frequency-telemetry/high-frequency-telemetry-hld.md

Lines changed: 57 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
- [7.4. Config DB](#74-config-db)
2727
- [7.4.1. DEVICE\_METADATA](#741-device_metadata)
2828
- [7.4.2. HIGH\_FREQUENCY\_TELEMETRY\_PROFILE](#742-high_frequency_telemetry_profile)
29-
- [7.4.3. HIGH\_FREQUENCY\_TELEMETRY\_GROUP](#743-high_frequency_telemetry_group)
29+
- [7.4.3. HIGH\_FREQUENCY\_TELEMETRY\_HARMONIZER](#743-high_frequency_telemetry_harmonizer)
30+
- [7.4.4. HIGH\_FREQUENCY\_TELEMETRY\_GROUP](#744-high_frequency_telemetry_group)
3031
- [7.5. StateDb](#75-statedb)
3132
- [7.5.1. HIGH\_FREQUENCY\_TELEMETRY\_SESSION](#751-high_frequency_telemetry_session)
3233
- [7.6. Work Flow](#76-work-flow)
@@ -52,6 +53,7 @@
5253
| --- | ---------- | ------ | ------------------ |
5354
| 0.1 | 09/06/2024 | Ze Gan | Initial version |
5455
| 0.2 | 03/01/2025 | Janet Cui | Initial version |
56+
| 0.3 | 06/21/2026 | Ze Gan | Add harmonizer configuration |
5557

5658
## 2. Scope
5759

@@ -130,6 +132,7 @@ flowchart LR
130132
asic[\ASIC\]
131133
132134
config_db --HIGH_FREQUENCY_TELEMETRY_PROFILE
135+
HIGH_FREQUENCY_TELEMETRY_HARMONIZER
133136
HIGH_FREQUENCY_TELEMETRY_GROUP--> hft_orch
134137
state_db --HIGH_FREQUENCY_TELEMETRY_SESSION--> counter_syncd
135138
hft_orch --HIGH_FREQUENCY_TELEMETRY_SESSION--> state_db
@@ -169,7 +172,7 @@ flowchart LR
169172
swss_act((Swss actor: Handle swss message))
170173
netlink_act((Netlink actor: Receive netlink message from kernel))
171174
ipfix_act((Ipfix actor: Handle IPFix message))
172-
harmonize_act((Harmonize actor: Unifies sampling and handles data rollover))
175+
harmonize_act((Harmonize actor: Aggregates samples and handles data rollover))
173176
cdb_act((Counter DB actor: Store counters to counter DB))
174177
otel_act((OpenTelemetry actor: Send counters to OpenTelemetry collector))
175178
cdb[(Counter DB)]
@@ -186,13 +189,22 @@ flowchart LR
186189
187190
```
188191

192+
The Harmonize actor applies optional per-profile harmonization after IPFIX records are parsed and before counters are exported to Counter DB or OpenTelemetry. A profile selects a harmonizer by setting `HIGH_FREQUENCY_TELEMETRY_PROFILE.harmonizer`; if no harmonizer is selected, Counter Syncd forwards the lower-layer reported samples without extra aggregation, rollover correction, or heatmap handling.
193+
194+
A harmonizer supports the following methods and can be extended with more methods later:
195+
196+
- Reporting rate aggregation: aggregates the lower-layer reported samples into the configured harmonizer reporting interval. The unit is microseconds. If `reporting_rate` is not configured, the harmonizer uses the lower-layer reporting interval and does not aggregate samples.
197+
- Data rollover: enables rollover correction for the configured group and counter pairs. The list is empty by default, so no counters are corrected for rollover unless configured.
198+
- Heatmap data: marks the configured group and counter pairs as heatmap data. The list is empty by default.
199+
189200
#### 7.1.2. High frequency telemetry Orch
190201

191202
The `High frequency telemetry Orch` is a new object within the Orchagent. It has following primary duties:
192203

193204
1. Maintain the TAM SAI objects according to the high frequency telemetry configuration in the config DB.
194205
2. Generate a unique template ID for each high frequency telemetry profile to ensure distinct identification and management.
195206
3. Register and activate streams on counter syncd.
207+
4. Resolve the harmonizer configuration referenced by each profile and publish it with the session metadata for Counter Syncd.
196208

197209
`High frequency telemetry Orch` leverages `tam_counter_subscription` objects to bind monitoring objects, such as ports, buffers, or queues, to streams. Therefore, this orch must ensure that the lifecycle of `tam_counter_subscription` objects is within the lifecycle of their respective monitoring objects.
198210

@@ -509,6 +521,7 @@ HIGH_FREQUENCY_TELEMETRY_PROFILE|{{profile_name}}
509521
"poll_interval": {{uint32}}
510522
"otel_endpoint": {{string of endpoint}} (Optional)
511523
"otel_certs": {{string of path}} (Optional)
524+
"harmonizer": {{string of harmonizer name}} (Optional)
512525
```
513526
514527
```
@@ -520,9 +533,37 @@ otel_endpoint = string ; The endpoint of OpenTelemetry collector. E.G. 192.
520533
It will use the local OpenTelemetry collector if this value isn't provided.
521534
otel_certs = string ; The path of certificates for OpenTelemetry collector. E.G. /etc/sonic/otel/cert.private
522535
If this value isn't provided, we will use a non-secure channel.
536+
harmonizer = string ; The optional name of the HIGH_FREQUENCY_TELEMETRY_HARMONIZER entry that this profile applies.
537+
If this value isn't provided, no harmonizer configuration is applied.
538+
```
539+
540+
#### 7.4.3. HIGH_FREQUENCY_TELEMETRY_HARMONIZER
541+
542+
```
543+
HIGH_FREQUENCY_TELEMETRY_HARMONIZER|{{harmonizer_name}}
544+
"reporting_rate": {{uint32}} (Optional)
545+
"data_rollover_flags": {{list of group and counter pair}} (Optional)
546+
"heatmap_counters": {{list of group and counter pair}} (Optional)
547+
```
548+
549+
```
550+
key = HIGH_FREQUENCY_TELEMETRY_HARMONIZER|harmonizer_name a string as the identifier of harmonizer configuration
551+
; field = value
552+
reporting_rate = uint32 ; The reporting interval after harmonization, unit microseconds.
553+
It aggregates lower-layer reported samples within each reporting window.
554+
If this value isn't provided, the harmonizer uses the lower-layer reporting interval and does not aggregate samples.
555+
data_rollover_flags = A list of group and counter pairs that require rollover correction.
556+
The syntax of each entry is group_name|object_counter.
557+
In CONFIG_DB, multiple entries are encoded as group_name1|object_counter1,group_name2|object_counter2.
558+
The group_name must match HIGH_FREQUENCY_TELEMETRY_GROUP.group_name, and object_counter must be valid for that group.
559+
Examples are PORT|IF_IN_UCAST_PKTS and QUEUE|DROPPED_PACKETS.
560+
The default value is empty, meaning no counters are corrected for rollover.
561+
heatmap_counters = A list of group and counter pairs that should be treated as heatmap data.
562+
The syntax is the same as data_rollover_flags, for example PORT|IF_IN_UCAST_PKTS and QUEUE|DROPPED_PACKETS.
563+
The default value is empty.
523564
```
524565
525-
#### 7.4.3. HIGH_FREQUENCY_TELEMETRY_GROUP
566+
#### 7.4.4. HIGH_FREQUENCY_TELEMETRY_GROUP
526567
527568
```
528569
HIGH_FREQUENCY_TELEMETRY_GROUP|{{profile_name}}|{{group_name}}
@@ -543,7 +584,7 @@ object_names = A list of object name.
543584
object_counters = A list of stats of object;
544585
```
545586
546-
For the schema of `HIGH_FREQUENCY_TELEMETRY_GROUP`, please refer to its [YANG model](sonic-high-frequency-telemetry.yang).
587+
For the schemas of high frequency telemetry config tables, please refer to their [YANG model](sonic-high-frequency-telemetry.yang).
547588
548589
### 7.5. StateDb
549590
@@ -556,6 +597,7 @@ HIGH_FREQUENCY_TELEMETRY_SESSION|{{profile_name}}|{{group_name}}
556597
"object_ids": {{list of uint16_t}}
557598
"session_type": {{ipfix}}
558599
"session_config": {{binary array}}
600+
"harmonizer_config": {{serialized harmonizer configuration}} (Optional)
559601
"config_version": {{uint32_t}}
560602
```
561603
@@ -571,6 +613,9 @@ object_ids = A list of object ID;
571613
session_type = ipfix ; Specified the session type.
572614
session_config = binary array;
573615
If the session type is IPFIX, This field stores the IPFIX template to interpret the message of this session.
616+
harmonizer_config = string;
617+
The serialized HIGH_FREQUENCY_TELEMETRY_HARMONIZER configuration applied by this session.
618+
If this value isn't provided, Counter Syncd does not apply harmonization to this session.
574619
config_version = uint32_t; Indicates which version is being used. The default value is 0.
575620
This value will be increased once the new config was applied by CounterSyncd.
576621
```
@@ -606,6 +651,7 @@ sequenceDiagram
606651
hft_orch ->> syncd: Initialize <br/>HOSTIF<br/>TAM_TRANSPORT<br/>TAM_collector<br/>
607652
608653
config_db ->> hft_orch: HIGH_FREQUENCY_TELEMETRY_PROFILE
654+
config_db ->> hft_orch: HIGH_FREQUENCY_TELEMETRY_HARMONIZER
609655
config_db ->> hft_orch: HIGH_FREQUENCY_TELEMETRY_GROUP
610656
port_orch ->> hft_orch: Port/Queue/Buffer ... object
611657
@@ -643,6 +689,7 @@ sequenceDiagram
643689
end
644690
loop Receive IPFIX message of stats from genetlink
645691
alt Have this template of IPFIX been registered?
692+
counter ->> counter: Apply harmonizer configuration
646693
counter ->> otel: Push message to OpenTelemetry Collector
647694
else
648695
counter ->> counter: Discard this message
@@ -673,6 +720,12 @@ sudo config high_frequency_telemetry profile add $profile_name --stream_state=$s
673720
# Change stream state
674721
sudo config high_frequency_telemetry profile set $profile_name --stream_state=$stream_state
675722

723+
# Bind a harmonizer to a profile
724+
sudo config high_frequency_telemetry profile set $profile_name --harmonizer=$harmonizer_name
725+
726+
# Add a harmonizer
727+
sudo config high_frequency_telemetry harmonizer add $harmonizer_name --reporting_rate=$reporting_rate --data_rollover_flags="$group_name1|$object_counter1,$group_name2|$object_counter2" --heatmap_counters="$group_name3|$object_counter3"
728+
676729
# Add a monitor group
677730
sudo config high_frequency_telemetry group "$profile|$group_name" --object_names="$object1,$object2" --object_counters="$object_counters1,$object_counters2"
678731

doc/high-frequency-telemetry/sonic-high-frequency-telemetry.yang

Lines changed: 48 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,54 @@ module sonic-high-frequency-telemetry {
4141
}
4242
}
4343

44-
leaf poll_interval {
45-
mandatory true;
46-
description "The interval to poll counter, unit milliseconds.";
47-
type uint32;
48-
}
49-
50-
}
51-
}
52-
53-
container HIGH_FREQUENCY_TELEMETRY_GROUP {
44+
leaf poll_interval {
45+
mandatory true;
46+
description "The interval to poll counter, unit microseconds.";
47+
type uint32;
48+
}
49+
50+
leaf harmonizer {
51+
description "Optional harmonizer configuration applied by this profile.";
52+
type leafref {
53+
path "/sonic-high-frequency-telemetry:sonic-high-frequency-telemetry/HIGH_FREQUENCY_TELEMETRY_HARMONIZER/HIGH_FREQUENCY_TELEMETRY_HARMONIZER_LIST/name";
54+
}
55+
}
56+
57+
}
58+
}
59+
60+
container HIGH_FREQUENCY_TELEMETRY_HARMONIZER {
61+
description "HIGH_FREQUENCY_TELEMETRY_HARMONIZER part of config_db.json";
62+
list HIGH_FREQUENCY_TELEMETRY_HARMONIZER_LIST {
63+
key "name";
64+
65+
leaf name {
66+
type string {
67+
length 1..128;
68+
}
69+
}
70+
71+
leaf reporting_rate {
72+
description "The reporting interval after harmonization, unit microseconds.";
73+
type uint32;
74+
}
75+
76+
leaf-list data_rollover_flags {
77+
description "List of group and counter pairs that require rollover correction.";
78+
type string;
79+
must "re-match(current(), '(PORT|BUFFER_POOL|INGRESS_PRIORITY_GROUP|QUEUE)\\|[^|]+')";
80+
}
81+
82+
leaf-list heatmap_counters {
83+
description "List of group and counter pairs that should be treated as heatmap data.";
84+
type string;
85+
must "re-match(current(), '(PORT|BUFFER_POOL|INGRESS_PRIORITY_GROUP|QUEUE)\\|[^|]+')";
86+
}
87+
88+
}
89+
}
90+
91+
container HIGH_FREQUENCY_TELEMETRY_GROUP {
5492
description "HIGH_FREQUENCY_TELEMETRY_GROUP part of config_db.json";
5593
list HIGH_FREQUENCY_TELEMETRY_GROUP_LIST {
5694
key "profile_name group_name";

0 commit comments

Comments
 (0)