Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change value type of params in memory_checker #12797

Merged
merged 2 commits into from
Nov 24, 2022

Conversation

zbud-msft
Copy link
Contributor

@zbud-msft zbud-msft commented Nov 22, 2022

Why I did it

Fix error when calling events API, required value is string, passing float

How I did it

Change type of value from float to string

How to verify it

Manual test:

Nov 22 08:24:56.181145 str-s6000-on-4 INFO memory_checker: [telemetry]: Memory usage (20573061.12 Bytes) is larger than the threshold (200 Bytes)!
Nov 22 08:26:02.651165 str-s6000-on-4 INFO memory_checker: [telemetry]: Memory usage (20573061.12 Bytes) is larger than the threshold (200 Bytes)!
Nov 22 08:26:02.851088 str-s6000-on-4 NOTICE memory_checker: :- publish: EVENT_PUBLISHED: {"sonic-events-host:mem-threshold-exceeded":{"ctr_name":"telemetry","mem_usage":"20573061.12","threshold":"200","timestamp":"2022-11-22T08:26:02.850599Z"}}

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205

Description for the changelog

Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@zbud-msft zbud-msft changed the title Resolve bug Change value type in memory_checker Nov 22, 2022
@zbud-msft zbud-msft changed the title Change value type in memory_checker Change value type of params in memory_checker Nov 22, 2022
@zbud-msft zbud-msft marked this pull request as ready for review November 22, 2022 17:30
@zbud-msft zbud-msft requested a review from lguohan as a code owner November 22, 2022 17:30
@@ -100,7 +100,7 @@ def check_memory_usage(events_handle, container_name, threshold_value):
syslog.syslog(syslog.LOG_INFO, "[{}]: Memory usage ({} Bytes) is larger than the threshold ({} Bytes)!"
.format(container_name, mem_usage_bytes, threshold_value))
# publish event
publish_events(events_handle, container_name, mem_usage_bytes, threshold_value)
publish_events(events_handle, container_name, str(mem_usage_bytes), str(threshold_value))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use unit test to cover this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will be covered as part of sonic-mgmt integration test

@zbud-msft zbud-msft merged commit 4b001e5 into sonic-net:master Nov 24, 2022
@zbud-msft zbud-msft mentioned this pull request Nov 24, 2022
7 tasks
StormLiangMS pushed a commit to StormLiangMS/sonic-buildimage that referenced this pull request Dec 8, 2022
Fix error when calling events API, required value is string, passing float
StormLiangMS pushed a commit that referenced this pull request Dec 10, 2022
Fix error when calling events API, required value is string, passing float
@zbud-msft zbud-msft deleted the ResolveMCBug branch March 8, 2023 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants