-
Notifications
You must be signed in to change notification settings - Fork 177
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
[CP #1715 > support/v5.13] [python] add-monitoring-info #1716
Draft
eclipse-ecal-bot
wants to merge
1
commit into
support/v5.13
Choose a base branch
from
cherry-pick/bda08a6/support/v5.13
base: support/v5.13
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||
/* ========================= eCAL LICENSE ================================= | ||||||
* | ||||||
* Copyright (C) 2016 - 2019 Continental Corporation | ||||||
* Copyright (C) 2016 - 2024 Continental Corporation | ||||||
* | ||||||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
* you may not use this file except in compliance with the License. | ||||||
|
@@ -1343,6 +1343,8 @@ PyObject* mon_setfilterstate(PyObject* /*self*/, PyObject* args) | |||||
/****************************************/ | ||||||
/* mon_monitoring */ | ||||||
/****************************************/ | ||||||
|
||||||
// TODO: std::map<std::string, std::string> attr | ||||||
PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/) | ||||||
{ | ||||||
PyObject* retDict = PyDict_New(); | ||||||
|
@@ -1371,6 +1373,9 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/) | |||||
val = Py_BuildValue("s", process.hname().c_str()); | ||||||
PyDict_SetItemString(processDict, "hname", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("s", process.hgname().c_str()); | ||||||
PyDict_SetItemString(processDict, "hgname", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", process.pid()); | ||||||
PyDict_SetItemString(processDict, "pid", val); Py_DECREF(val); | ||||||
|
||||||
|
@@ -1418,6 +1423,9 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/) | |||||
|
||||||
val = Py_BuildValue("s", process.component_init_info().c_str()); | ||||||
PyDict_SetItemString(processDict, "component_init_info", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("s", process.ecal_runtime_version().c_str()); | ||||||
PyDict_SetItemString(processDict, "ecal_runtime_version", val); Py_DECREF(val); | ||||||
} | ||||||
|
||||||
// collect service infos | ||||||
|
@@ -1449,25 +1457,76 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/) | |||||
val = Py_BuildValue("s", service.sname().c_str()); | ||||||
PyDict_SetItemString(serviceDict, "sname", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", service.version()); | ||||||
PyDict_SetItemString(serviceDict, "version", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", service.tcp_port_v0()); | ||||||
PyDict_SetItemString(serviceDict, "tcp_port_v0", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", service.tcp_port_v1()); | ||||||
PyDict_SetItemString(serviceDict, "tcp_port_v1", val); Py_DECREF(val); | ||||||
|
||||||
PyObject* methodsDict = PyDict_New(); | ||||||
PyDict_SetItemString(serviceDict, "methods", methodsDict); Py_DECREF(methodsDict); | ||||||
|
||||||
// for(int i = 0; i < service.methods().size(); ++i) | ||||||
// { | ||||||
// const eCAL::pb::Method& method = service.methods(i); | ||||||
for(int i = 0; i < service.methods().size(); ++i) | ||||||
{ | ||||||
const eCAL::pb::Method& method = service.methods(i); | ||||||
|
||||||
val = Py_BuildValue("s", method.mname().c_str()); | ||||||
PyDict_SetItemString(methodsDict, "mname", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("s", method.req_type().c_str()); | ||||||
PyDict_SetItemString(methodsDict, "req_type", val); Py_DECREF(val); | ||||||
|
||||||
// TODO: std::string req_desc | ||||||
|
||||||
val = Py_BuildValue("s", method.resp_type().c_str()); | ||||||
PyDict_SetItemString(methodsDict, "resp_type", val); Py_DECREF(val); | ||||||
|
||||||
// TODO: std::string resp_desc | ||||||
|
||||||
val = Py_BuildValue("i", method.call_count()); | ||||||
PyDict_SetItemString(methodsDict, "call_count", val); Py_DECREF(val); | ||||||
} | ||||||
} | ||||||
|
||||||
// collect client infos | ||||||
{ | ||||||
PyObject* clientList = PyList_New(0); | ||||||
PyDict_SetItemString(retDict, "clients", clientList); Py_DECREF(clientList); | ||||||
|
||||||
for (int i = 0; i < monitoring.clients().size(); ++i) | ||||||
{ | ||||||
PyObject* clientDict = PyDict_New(); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. warning: variable 'clientDict' is not initialized [cppcoreguidelines-init-variables]
Suggested change
|
||||||
PyList_Append(clientList, clientDict); Py_DECREF(clientDict); | ||||||
|
||||||
// val = Py_BuildValue("s", method.mname().c_str()); | ||||||
// PyDict_SetItemString(methodsDict, "mname", val); Py_DECREF(val); | ||||||
const auto& client = monitoring.clients(i); | ||||||
|
||||||
val = Py_BuildValue("i", client.rclock()); | ||||||
PyDict_SetItemString(clientDict, "rclock", val); Py_DECREF(val); | ||||||
|
||||||
// val = Py_BuildValue("s", method.inp_type().c_str()); | ||||||
// PyDict_SetItemString(methodsDict, "inp_type", val); Py_DECREF(val); | ||||||
val = Py_BuildValue("s", client.hname().c_str()); | ||||||
PyDict_SetItemString(clientDict, "hname", val); Py_DECREF(val); | ||||||
|
||||||
// val = Py_BuildValue("s", method.out_type().c_str()); | ||||||
// PyDict_SetItemString(methodsDict, "out_type", val); Py_DECREF(val); | ||||||
val = Py_BuildValue("s", client.pname().c_str()); | ||||||
PyDict_SetItemString(clientDict, "pname", val); Py_DECREF(val); | ||||||
|
||||||
// val = Py_BuildValue("i", method.call_count()); | ||||||
// PyDict_SetItemString(methodsDict, "call_count", val); Py_DECREF(val); | ||||||
//} | ||||||
val = Py_BuildValue("s", client.uname().c_str()); | ||||||
PyDict_SetItemString(clientDict, "uname", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", client.pid()); | ||||||
PyDict_SetItemString(clientDict, "pid", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("s", client.sname().c_str()); | ||||||
PyDict_SetItemString(clientDict, "sname", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("s", client.sid().c_str()); | ||||||
PyDict_SetItemString(clientDict, "sid", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", client.version()); | ||||||
PyDict_SetItemString(clientDict, "version", val); Py_DECREF(val); | ||||||
} | ||||||
} | ||||||
|
||||||
// collect topic infos | ||||||
|
@@ -1511,9 +1570,25 @@ PyObject* mon_monitoring(PyObject* /*self*/, PyObject* /*args*/) | |||||
val = Py_BuildValue("y#", topic.tdesc().c_str(), (Py_ssize_t)(topic.tdesc().length())); | ||||||
PyDict_SetItemString(topicDict, "tdesc", val); Py_DECREF(val); | ||||||
|
||||||
// TODO: SDataTypeInformation tdatatype | ||||||
|
||||||
// TODO: std::vector<TLayer> tlayer | ||||||
|
||||||
val = Py_BuildValue("i", topic.tsize()); | ||||||
PyDict_SetItemString(topicDict, "tsize", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", topic.connections_loc()); | ||||||
PyDict_SetItemString(topicDict, "connections_loc", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", topic.connections_ext()); | ||||||
PyDict_SetItemString(topicDict, "connections_ext", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", topic.message_drops()); | ||||||
PyDict_SetItemString(topicDict, "message_drops", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", topic.did()); | ||||||
PyDict_SetItemString(topicDict, "did", val); Py_DECREF(val); | ||||||
|
||||||
val = Py_BuildValue("i", topic.dclock()); | ||||||
PyDict_SetItemString(topicDict, "dclock", val); Py_DECREF(val); | ||||||
|
||||||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
warning: variable 'clientList' is not initialized [cppcoreguidelines-init-variables]