Skip to content

Commit

Permalink
[Telemetry] enable default service config if no config from DB (#16683)
Browse files Browse the repository at this point in the history
#### Why I did it
Fix issue #16533 , telemetry service exit in master and 202305 branches due to no telemetry configs in redis DB.

#### How I did it
Enable default config if no TELEMETRY configs from redis DB.

#### How to verify it
After the fix, telemetry service would work with the following two scenarios:
1. With TELEMETRY config in redis DB, load service configs from DB.
2. No TELEMETRY config in redis DB, use default service configs.
  • Loading branch information
qnos authored and haris-khan1596 committed Jun 5, 2024
1 parent c55f3b8 commit f00efef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dockers/docker-sonic-telemetry/telemetry.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

EXIT_TELEMETRY_VARS_FILE_NOT_FOUND=1
INCORRECT_TELEMETRY_VALUE = 2
INCORRECT_TELEMETRY_VALUE=2
TELEMETRY_VARS_FILE=/usr/share/sonic/templates/telemetry_vars.j2

if [ ! -f "$TELEMETRY_VARS_FILE" ]; then
Expand Down Expand Up @@ -75,7 +75,7 @@ THRESHOLD_CONNECTIONS=$(echo $GNMI | jq -r '.threshold')
if [[ $THRESHOLD_CONNECTIONS =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" --threshold $THRESHOLD_CONNECTIONS"
else
if [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
if [ -z $GNMI ] || [[ $THRESHOLD_CONNECTIONS == "null" ]]; then
TELEMETRY_ARGS+=" --threshold 100"
else
echo "Incorrect threshold value, expecting positive integers" >&2
Expand All @@ -88,7 +88,7 @@ IDLE_CONN_DURATION=$(echo $GNMI | jq -r '.idle_conn_duration')
if [[ $IDLE_CONN_DURATION =~ ^[0-9]+$ ]]; then
TELEMETRY_ARGS+=" --idle_conn_duration $IDLE_CONN_DURATION"
else
if [[ $IDLE_CONN_DURATION == "null" ]]; then
if [ -z $GNMI ] || [[ $IDLE_CONN_DURATION == "null" ]]; then
TELEMETRY_ARGS+=" --idle_conn_duration 5"
else
echo "Incorrect idle_conn_duration value, expecting positive integers" >&2
Expand Down

0 comments on commit f00efef

Please sign in to comment.