Skip to content

Commit 08af097

Browse files
committed
Enhance stream telemetry
Signed-off-by: Ze Gan <[email protected]>
1 parent 401bd1f commit 08af097

File tree

3 files changed

+147
-0
lines changed

3 files changed

+147
-0
lines changed

doc/TAM/SAI-Proposal-TAM-stream-telemetry.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,12 @@ The existing telemetry solution relies on a process to proactively query stats a
7777
- The vendor SDK should support querying the minimal polling interval for each counter.
7878
- When reconfiguring any stream settings, whether it is the polling interval or the stats list, the existing stream will be interrupted and regenerated.
7979
- If any of monitored objects is deleted, the existing stream will be interrupted and regenerated.
80+
- The collector is designed to handle single-cycle counter rollovers; however, vendors must ensure that the data does not roll over twice between two collection intervals.
8081

8182
### Phase 2
8283

8384
- Supports updating configuration without interrupting the telemetry stream
85+
- Support stats of tam telemetry for debugging purpose
8486

8587
## Architecture Design
8688

@@ -971,6 +973,13 @@ typedef struct _sai_stat_st_capability_t
971973
*/
972974
uint64_t minimal_polling_interval;
973975
976+
/**
977+
* @brief Maximal polling interval in nanoseconds
978+
*
979+
* If polling interval is more than this value, it will be unacceptable.
980+
*/
981+
uint64_t maximal_polling_interval;
982+
974983
} sai_stat_st_capability_t;
975984
976985
typedef struct _sai_stat_st_capability_list_t
@@ -1007,3 +1016,62 @@ sai_s32_list_t tel_type_mode[2] = {-1, -1};
10071016
sai_query_attribute_enum_values_capability(switch_id, SAI_OBJECT_TYPE_TAM_TEL_TYPE, SAI_TAM_TEL_TYPE_ATTR_MODE, tel_type_mode)
10081017

10091018
```
1019+
1020+
#### Stats for TAM telemetry
1021+
1022+
```c++
1023+
1024+
/**
1025+
* @brief TAM telemetry counter IDs in sai_get_tam_telemetry_stats_ext() call
1026+
*
1027+
* @flags ranges
1028+
*/
1029+
typedef enum _sai_tam_telemetry_stat_t
1030+
{
1031+
/** Tam telemetry stat range start */
1032+
SAI_TAM_TELEMETRY_STAT_START,
1033+
1034+
/**
1035+
* @brief Total number of telemetry records successfully ingested
1036+
*
1037+
* Indicates the cumulative count of telemetry messages received and accepted
1038+
* into the telemetry system.
1039+
* Unit: Count [uint64_t]
1040+
*/
1041+
SAI_TAM_TELEMETRY_STAT_INGESTED_RECORDS = SAI_TAM_TELEMETRY_STAT_START,
1042+
1043+
/**
1044+
* @brief Number of telemetry records pending read or processing
1045+
*
1046+
* Represents current backlog or pending messages awaiting processing.
1047+
* This is a gauge-type value rather than a monotonically increasing counter.
1048+
* Unit: Count [uint64_t]
1049+
*/
1050+
SAI_TAM_TELEMETRY_STAT_PENDING_READ_RECORDS,
1051+
1052+
/**
1053+
* @brief Total number of telemetry records successfully consumed
1054+
*
1055+
* Indicates the cumulative count of telemetry records that have been processed
1056+
* by the consumer.
1057+
* Unit: Count [uint64_t]
1058+
*/
1059+
SAI_TAM_TELEMETRY_STAT_CONSUMED_RECORDS,
1060+
1061+
/**
1062+
* @brief Total number of telemetry records dropped
1063+
*
1064+
* Represents the cumulative number of telemetry messages discarded due to
1065+
* buffer overflow, timeout, or internal error.
1066+
* Unit: Count [uint64_t]
1067+
*/
1068+
SAI_TAM_TELEMETRY_STAT_DROPPED_RECORDS,
1069+
1070+
/** Tam telemetry stat range end */
1071+
SAI_TAM_TELEMETRY_STAT_END,
1072+
1073+
SAI_TAM_TELEMETRY_STAT_CUSTOM_RANGE_BASE = 0x10000000,
1074+
1075+
} sai_tam_telemetry_stat_t;
1076+
1077+
```

inc/saitam.h

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,59 @@ typedef enum _sai_tam_telemetry_attr_t
16071607

16081608
} sai_tam_telemetry_attr_t;
16091609

1610+
/**
1611+
* @brief TAM telemetry counter IDs in sai_get_tam_telemetry_stats_ext() call
1612+
*
1613+
* @flags ranges
1614+
*/
1615+
typedef enum _sai_tam_telemetry_stat_t
1616+
{
1617+
/** Tam telemetry stat range start */
1618+
SAI_TAM_TELEMETRY_STAT_START,
1619+
1620+
/**
1621+
* @brief Total number of telemetry records successfully ingested
1622+
*
1623+
* Indicates the cumulative count of telemetry messages received and accepted
1624+
* into the telemetry system.
1625+
* Unit: Count [uint64_t]
1626+
*/
1627+
SAI_TAM_TELEMETRY_STAT_INGESTED_RECORDS = SAI_TAM_TELEMETRY_STAT_START,
1628+
1629+
/**
1630+
* @brief Number of telemetry records pending read or processing
1631+
*
1632+
* Represents current backlog or pending messages awaiting processing.
1633+
* This is a gauge-type value rather than a monotonically increasing counter.
1634+
* Unit: Count [uint64_t]
1635+
*/
1636+
SAI_TAM_TELEMETRY_STAT_PENDING_READ_RECORDS,
1637+
1638+
/**
1639+
* @brief Total number of telemetry records successfully consumed
1640+
*
1641+
* Indicates the cumulative count of telemetry records that have been processed
1642+
* by the consumer.
1643+
* Unit: Count [uint64_t]
1644+
*/
1645+
SAI_TAM_TELEMETRY_STAT_CONSUMED_RECORDS,
1646+
1647+
/**
1648+
* @brief Total number of telemetry records dropped
1649+
*
1650+
* Represents the cumulative number of telemetry messages discarded due to
1651+
* buffer overflow, timeout, or internal error.
1652+
* Unit: Count [uint64_t]
1653+
*/
1654+
SAI_TAM_TELEMETRY_STAT_DROPPED_RECORDS,
1655+
1656+
/** Tam telemetry stat range end */
1657+
SAI_TAM_TELEMETRY_STAT_END,
1658+
1659+
SAI_TAM_TELEMETRY_STAT_CUSTOM_RANGE_BASE = 0x10000000,
1660+
1661+
} sai_tam_telemetry_stat_t;
1662+
16101663
/**
16111664
* @brief Create and return a telemetry object
16121665
*
@@ -2484,6 +2537,24 @@ sai_status_t sai_tam_telemetry_get_data(
24842537
_Inout_ sai_size_t *buffer_size,
24852538
_Out_ void *buffer);
24862539

2540+
/**
2541+
* @brief Get TAM telemetry statistics counters extended.
2542+
*
2543+
* @param[in] tam_telemetry_id TAM telemetry id
2544+
* @param[in] number_of_counters Number of counters in the array
2545+
* @param[in] counter_ids Specifies the array of counter ids
2546+
* @param[in] mode Statistics mode
2547+
* @param[out] counters Array of resulting counter values.
2548+
*
2549+
* @return #SAI_STATUS_SUCCESS on success, failure status code on error
2550+
*/
2551+
typedef sai_status_t (*sai_get_tam_telemetry_stats_ext_fn)(
2552+
_In_ sai_object_id_t tam_telemetry_id,
2553+
_In_ uint32_t number_of_counters,
2554+
_In_ const sai_stat_id_t *counter_ids,
2555+
_In_ sai_stats_mode_t mode,
2556+
_Out_ uint64_t *counters);
2557+
24872558
/**
24882559
* @brief SAI TAM API set
24892560
*/
@@ -2553,6 +2624,8 @@ typedef struct _sai_tam_api_t
25532624
sai_get_tam_counter_subscription_attribute_fn get_tam_counter_subscription_attribute;
25542625
sai_bulk_object_create_fn create_tam_counter_subscriptions;
25552626
sai_bulk_object_remove_fn remove_tam_counter_subscriptions;
2627+
2628+
sai_get_tam_telemetry_stats_ext_fn get_tam_telemetry_stats_ext;
25562629
} sai_tam_api_t;
25572630

25582631
/**

inc/saitypes.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1909,6 +1909,12 @@ typedef struct _sai_stat_st_capability_t
19091909
*/
19101910
uint64_t minimal_polling_interval;
19111911

1912+
/**
1913+
* @brief Maximal polling interval in nanoseconds
1914+
*
1915+
* If polling interval is more than this value, it will be unacceptable.
1916+
*/
1917+
uint64_t maximal_polling_interval;
19121918
} sai_stat_st_capability_t;
19131919

19141920
typedef struct _sai_stat_st_capability_list_t

0 commit comments

Comments
 (0)