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

Publish additional events #12563

Merged
merged 6 commits into from
Nov 7, 2022

Conversation

zbud-msft
Copy link
Contributor

Why I did it

Add event_publish code or regex for rsyslog plugin for additional events

How I did it

How to verify it

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 marked this pull request as ready for review November 1, 2022 00:23
@zbud-msft zbud-msft requested a review from lguohan as a code owner November 1, 2022 00:23
@lgtm-com
Copy link

lgtm-com bot commented Nov 1, 2022

This pull request introduces 1 alert when merging 1c69b25 into 2626573 - view on LGTM.com

new alerts:

  • 1 for Unreachable code

@@ -55,6 +57,11 @@ def __init__(self):

self.load_critical_process_cache()

self.events_handle = events_init_publisher(EVENTS_PUBLISHER_SOURCE)

def __del__(self):
Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 1, 2022

Choose a reason for hiding this comment

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

del

__del__ is hacky. Suggest follow https://stackoverflow.com/a/6104568/2514803 for unmanaged resource. #Closed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No longer use del, moved deinit to the end of check() method which is the main driver of the script, used by manager.py

@zbud-msft
Copy link
Contributor Author

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@zbud-msft zbud-msft merged commit 8f48773 into sonic-net:master Nov 7, 2022
@dgsudharsan
Copy link
Collaborator

dgsudharsan commented Nov 22, 2022

@zbud-msft I am getting the following traceback. Can you please investigate?

Program 'container_memory_telemetry'
status Status ok
monitoring status Monitored
monitoring mode active
on reboot start
last exit value 1
last output Traceback (most recent call last):
File "/usr/bin/memory_checker", line 173, in
main()
File "/usr/bin/memory_checker", line 165, in main
check_memory_usage(events_handle, args.container_name, args.threshold_value)
File "/usr/bin/memory_checker", line 103, in check_memory_usage
publish_events(events_handle, container_name, mem_usage_bytes, threshold_value)
File "/usr/bin/memory_checker", line 64, in publish_events
params["mem_usage"] = mem_usage_bytes
File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 419, in setitem
return swsscommon.FieldValueMap___setitem_(self, *args)
TypeError: Wrong number or type of arguments for overloaded function 'FieldValueMap___setitem__'.
Possible C/C++ prototype[telemetry]: Memory usage (864131481.6 Bytes) is larger than the threshold (4
19430400 Bytes)!
data collected Tue, 22 Nov 2022 02:44:14

Here is a full trace
/usr/bin/memory_checker telemetry 400000
[telemetry]: Memory usage (760951603.2 Bytes) is larger than the threshold (400000 Bytes)!
Traceback (most recent call last):
File "/usr/bin/memory_checker", line 173, in
main()
File "/usr/bin/memory_checker", line 165, in main
check_memory_usage(events_handle, args.container_name, args.threshold_value)
File "/usr/bin/memory_checker", line 103, in check_memory_usage
publish_events(events_handle, container_name, mem_usage_bytes, threshold_value)
File "/usr/bin/memory_checker", line 64, in publish_events
params["mem_usage"] = mem_usage_bytes
File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 419, in setitem
return swsscommon.FieldValueMap___setitem_(self, *args)
TypeError: Wrong number or type of arguments for overloaded function 'FieldValueMap___setitem__'.
Possible C/C++ prototypes are:
std::map< std::string,std::string >::setitem(std::map< std::string,std::string >::key_type const &)
std::map< std::string,std::string >::setitem(std::map< std::string,std::string >::key_type const &,std::map< std::string,std::string >::mapped_type const &)

@zbud-msft
Copy link
Contributor Author

@zbud-msft I am getting the following traceback. Can you please investigate?

Program 'container_memory_telemetry' status Status ok monitoring status Monitored monitoring mode active on reboot start last exit value 1 last output Traceback (most recent call last): File "/usr/bin/memory_checker", line 173, in main() File "/usr/bin/memory_checker", line 165, in main check_memory_usage(events_handle, args.container_name, args.threshold_value) File "/usr/bin/memory_checker", line 103, in check_memory_usage publish_events(events_handle, container_name, mem_usage_bytes, threshold_value) File "/usr/bin/memory_checker", line 64, in publish_events params["mem_usage"] = mem_usage_bytes File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 419, in setitem return swsscommon.FieldValueMap___setitem_(self, *args) TypeError: Wrong number or type of arguments for overloaded function 'FieldValueMap___setitem__'. Possible C/C++ prototype[telemetry]: Memory usage (864131481.6 Bytes) is larger than the threshold (4 19430400 Bytes)! data collected Tue, 22 Nov 2022 02:44:14

Here is a full trace /usr/bin/memory_checker telemetry 400000 [telemetry]: Memory usage (760951603.2 Bytes) is larger than the threshold (400000 Bytes)! Traceback (most recent call last): File "/usr/bin/memory_checker", line 173, in main() File "/usr/bin/memory_checker", line 165, in main check_memory_usage(events_handle, args.container_name, args.threshold_value) File "/usr/bin/memory_checker", line 103, in check_memory_usage publish_events(events_handle, container_name, mem_usage_bytes, threshold_value) File "/usr/bin/memory_checker", line 64, in publish_events params["mem_usage"] = mem_usage_bytes File "/usr/lib/python3/dist-packages/swsscommon/swsscommon.py", line 419, in setitem return swsscommon.FieldValueMap___setitem_(self, *args) TypeError: Wrong number or type of arguments for overloaded function 'FieldValueMap___setitem__'. Possible C/C++ prototypes are: std::map< std::string,std::string >::setitem(std::map< std::string,std::string >::key_type const &) std::map< std::string,std::string >::setitem(std::map< std::string,std::string >::key_type const &,std::map< std::string,std::string >::mapped_type const &)

Fixed as part of #12797

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.

4 participants