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

Use context provided by request #121

Open
wants to merge 3 commits into
base: stable/yoga-m3
Choose a base branch
from

Conversation

sven-rosenzweig
Copy link
Contributor

Scoping all API and RPC calls to the same context makes debugging far easier since the request id will be logged by the agent.

Oslo_log tries to extract the context either by explicit passing to the logger or taking it from the thread-local store. The latter does not work since some of the requests enter a queue before being processed by a different thread. Therefore the context is passed in job entering the queue and passed to every log line necessary.

@sven-rosenzweig sven-rosenzweig force-pushed the context_aware_logging branch 3 times, most recently from 1c23104 to 6ebd039 Compare August 15, 2023 13:24
Scoping all API and RPC calls to the same context makes debugging
far easier since the request will be logged.

Oslo_log tries to extract the context either by explicit passing to the
logger or taking it from the thread-local store. The
latter does not work since some of the requests enter a queue before being processed by a different thread.
Therefore the context is passed in job entering the queue and passed to
every log line necessary.
@github-actions
Copy link

Name                                                                         Stmts   Miss  Cover
------------------------------------------------------------------------------------------------
networking_nsxv3/api/rpc.py                                                    208    113    46%
networking_nsxv3/common/config.py                                               16      0   100%
networking_nsxv3/common/constants.py                                            45      0   100%
networking_nsxv3/common/locking.py                                              35     11    69%
networking_nsxv3/common/synchronization.py                                     183     47    74%
networking_nsxv3/db/db.py                                                       77     15    81%
networking_nsxv3/extensions/nsxtoperations.py                                  104    104     0%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/agent.py                      160     47    71%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/cli.py                        335    227    32%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/client_nsx.py                 204     50    75%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/constants_nsx.py                6      0   100%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/extensions/firewall.py         27      0   100%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/mp_to_policy_migration.py     185     56    70%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider.py                   189     11    94%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider_nsx_mgmt.py          526     38    93%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider_nsx_policy.py        631     85    87%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/realization.py                267     51    81%
networking_nsxv3/plugins/ml2/drivers/nsxv3/driver.py                           123    123     0%
networking_nsxv3/prometheus/exporter.py                                         21      5    76%
networking_nsxv3/services/logapi/drivers/nsxv3/driver.py                        41      1    98%
networking_nsxv3/services/qos/drivers/nsxv3/qos.py                              34      4    88%
networking_nsxv3/services/trunk/drivers/nsxv3/trunk.py                          71      3    96%
------------------------------------------------------------------------------------------------
TOTAL                                                                         3488    991    72%

Calls, initially started from the driver, made from the agent to neutron server also used a one-time created
context instead of the context associated with the call, leading to one
single request id for all calls made by the agent, instead of them being
tied to a client request for which they were made.

For calls, made from the agent to neutron server initially triggered by the sync-loop, still use
the one-time created context.
@github-actions
Copy link

Name                                                                         Stmts   Miss  Cover
------------------------------------------------------------------------------------------------
networking_nsxv3/api/rpc.py                                                    208    113    46%
networking_nsxv3/common/config.py                                               16      0   100%
networking_nsxv3/common/constants.py                                            45      0   100%
networking_nsxv3/common/locking.py                                              35     11    69%
networking_nsxv3/common/synchronization.py                                     183     47    74%
networking_nsxv3/db/db.py                                                       77     15    81%
networking_nsxv3/extensions/nsxtoperations.py                                  104    104     0%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/agent.py                      160     47    71%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/cli.py                        335    227    32%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/client_nsx.py                 204     50    75%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/constants_nsx.py                6      0   100%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/extensions/firewall.py         27      0   100%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/mp_to_policy_migration.py     185     56    70%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider.py                   189     11    94%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider_nsx_mgmt.py          526     38    93%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider_nsx_policy.py        631     85    87%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/realization.py                267     51    81%
networking_nsxv3/plugins/ml2/drivers/nsxv3/driver.py                           123    123     0%
networking_nsxv3/prometheus/exporter.py                                         21      5    76%
networking_nsxv3/services/logapi/drivers/nsxv3/driver.py                        41      1    98%
networking_nsxv3/services/qos/drivers/nsxv3/qos.py                              34      4    88%
networking_nsxv3/services/trunk/drivers/nsxv3/trunk.py                          71      3    96%
------------------------------------------------------------------------------------------------
TOTAL                                                                         3488    991    72%

@github-actions
Copy link

Name                                                                         Stmts   Miss  Cover
------------------------------------------------------------------------------------------------
networking_nsxv3/api/rpc.py                                                    212    116    45%
networking_nsxv3/common/config.py                                               16      0   100%
networking_nsxv3/common/constants.py                                            45      0   100%
networking_nsxv3/common/locking.py                                              35     11    69%
networking_nsxv3/common/synchronization.py                                     183     47    74%
networking_nsxv3/db/db.py                                                       77     15    81%
networking_nsxv3/extensions/nsxtoperations.py                                  104    104     0%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/agent.py                      160     47    71%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/cli.py                        335    227    32%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/client_nsx.py                 204     50    75%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/constants_nsx.py                6      0   100%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/extensions/firewall.py         27      0   100%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/mp_to_policy_migration.py     185     56    70%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider.py                   189     11    94%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider_nsx_mgmt.py          526     38    93%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/provider_nsx_policy.py        631     85    87%
networking_nsxv3/plugins/ml2/drivers/nsxv3/agent/realization.py                267     51    81%
networking_nsxv3/plugins/ml2/drivers/nsxv3/driver.py                           123    123     0%
networking_nsxv3/prometheus/exporter.py                                         21      5    76%
networking_nsxv3/services/logapi/drivers/nsxv3/driver.py                        41      1    98%
networking_nsxv3/services/qos/drivers/nsxv3/qos.py                              34      4    88%
networking_nsxv3/services/trunk/drivers/nsxv3/trunk.py                          71      3    96%
------------------------------------------------------------------------------------------------
TOTAL                                                                         3492    994    72%

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.

1 participant