Skip to content

Conversation

@vgorkavenko
Copy link
Contributor

@vgorkavenko vgorkavenko commented Oct 17, 2025

Description

Separate Performance Collection module for CSMv3 and CMv2 Oracle daemons

Related Issue/Task

  • Related task: #[task number]
  • Epic: [epic name or link, if applicable]

How Has This Been Tested?

Describe how you tested the changes:

  • Local tests (e.g., pytest)
  • Manual testing (describe steps)
  • Not tested (explain why)

Checklist

  • Documentation updated (if required)
  • New tests added (if applicable)
  • CSM_STATE_VERSION is bumped (if the new version affects data in the cache)

@vgorkavenko vgorkavenko added the wip Work In Progress label Oct 17, 2025
@vgorkavenko vgorkavenko changed the base branch from develop to csm-next October 21, 2025 08:47
@vgorkavenko vgorkavenko changed the title [WIP] [CMv2 | CSMv3] feat: separate performance collection and distribution [WIP] feat: separate performance collection and distribution Oct 21, 2025
try:
return func(*args, **kwargs)
except ValueError as exc:
return jsonify({"error": str(exc)}), 400

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
except ValueError as exc:
return jsonify({"error": str(exc)}), 400
except Exception as exc: # pylint: disable=broad-exception-caught
return jsonify({"error": repr(exc), "trace": traceback.format_exc()}), 500

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
Comment on lines +119 to +120
if ver != cls.VERSION:
raise ValueError(f"Unsupported epoch blob version: {ver}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Manual intervention is required then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It should prevent reading outdated blobs from Performance Collector that we aren't able to decode due to different version of encoding algo

Comment on lines +14 to +16
self._conn = sqlite3.connect(
self._path, check_same_thread=False, timeout=variables.PERFORMANCE_COLLECTOR_DB_CONNECTION_TIMEOUT
)
Copy link
Contributor

Choose a reason for hiding this comment

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

What if we have an optional _conn field that is opened via a separate method such as connect and reused in theconnection context manager? The context manager checks whether a connection has been established and uses it, or opens a new one otherwise. Thus, clients that prefer to keep the connection open can use the connect method and close it eventually, while other clients can use the connection context manager. I would also consider using the latter only. I think it is cheap to open a connection, do whatever is needed and close it afterwards.

Copy link
Contributor

Choose a reason for hiding this comment

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

To ensure thread safety I would also add an assert that we in the preferred mode of operation, see threadsafety.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CMv2 CSMv3 wip Work In Progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants