unstract icon indicating copy to clipboard operation
unstract copied to clipboard

WIP: Added es and cerebro services, rudimentary unstract-metrics lib added

Open chandrasekharan-zipstack opened this issue 1 year ago • 4 comments

What

  • Added es and cerebro services as part of the optional profile unstract-metrics
  • Added a simple unstract-metrics library that wraps elasticsearch_dsl to add and query metrics
  • Added some pytests for the new library methods

NOTE: Understood now that index creation need not happen through the regular code flow so some of the changes here would be invalid, will continue my development assuming that the index is already created and focus on exposing methods to aid easier collection of metrics for each sub-process / process type

How

  • Made use of elasticsearch_dsl which is a high level lib that helps interact with es

Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)

  • No, new changes added under optional profile and not used anywhere

Env Config

  • Added below envs to new library
ES_URL=http://localhost:9200
ES_CLOUD_ID=
ES_API_KEY=
COLLECT_UNSTRACT_METRICS=False

Relevant Docs

Dependencies Versions

  • elasticsearch-dsl~=8.14.0 but not included in any existing services yet

Notes on Testing

  • Tried setting it up locally and able to view the index and its mapping after inserting the metrics

Screenshots

  1. Docker compose stats with the new services image
  2. Able to access the es instance through cerebro image
  3. Added some unit tests image

Checklist

I have read and understood the Contribution Guidelines.

filepath function $$\textcolor{#23d18b}{\tt{passed}}$$ SUBTOTAL
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_logs}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_cleanup\_skip}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_client\_init}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image\_exists}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_image}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_get\_container\_run\_config\_without\_mount}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{worker/src/unstract/worker/clients/test\_docker.py}}$$ $$\textcolor{#23d18b}{\tt{test\_run\_container}}$$ $$\textcolor{#23d18b}{\tt{1}}$$ $$\textcolor{#23d18b}{\tt{1}}$$
$$\textcolor{#23d18b}{\tt{TOTAL}}$$ $$\textcolor{#23d18b}{\tt{9}}$$ $$\textcolor{#23d18b}{\tt{9}}$$

github-actions[bot] avatar Nov 03 '24 06:11 github-actions[bot]

Closing this PR since we agreed not to introduce ES for this usecase. Will refer this PR in subsequent metrics related changes instead