Trying out Unblocked
Disclaimer: I am not affiliated with Unblocked, nor Unblocked sponsored this post in any way. This is my a genuine account of my time spent with Unblocked.
Since opslane does not support Prometheus Alertmanager I decided to fork it,
and then give unblocked a try.
First, I familiarized with the code in a codespace, once I had an idea of how
the code is setup I decided to give Unblocked some tasks.
The first one was to ask: how do I add a new alert source?
BTW, these are the actual questions I used. As far as I can tell Unblocked
answer was detailed and accurate.
However, before jumping into writing code I needed to assess if my codescene
could run tests. We should only touch a codebase after we've ensured it passes
tests (it's green), right?
So I asked Unblocked: how do I run tests?
It told me run the following steps:
poetry install pytest
and also suggested I might want to run specific tests and even how to run
docker, see screenshot. What Unblocked missed was that I had to install poetry
first and that I had to change directory to backend (where the app
resides).
Overall not a big deal.
Overall not a big deal.
Running pytest did not work, because it could not find one of the
dependencies. Again, this was easy to figure out (for me, at least) because I
noticed that poetry had created a venv with python 3.12, which is not the
default on the codespace. I knew I had to run poetry shell, and then run
pytest, but I decided to checkout what Unblocked would tell me instead.
So, I asked:
running pytest does not work, it complains about a missing python
dependency
Sure enough, Unblocked suggested that I activate the venv with poetry shell as
the second option. Further options were running poetry install, or trying
docker. So far, so good.
Now running pytest from within the venv yield a different error about missing
ENV vars. Let's see what Unblocked suggests: I'm getting this error, what should I do? [plus console output from
pytest]
Unblocked suggested to create a .env which is technically correct. The
top-level README suggests to copy the existing one., so I did that instead and
then ran pytest again:
cp .env.example .env pytest
Now pytest fails with: Could not parse SQLAlchemy URL from string 'sdsd'
Let's ask Unblocked again:
now pytest fails with: Could not parse SQLAlchemy URL from string
'sdsd'
can you suggest a valid sqlalchemy database url
Unblocked suggested a few URL options, I chose sqlite (even though opslane
depends in pgvector), and ran pytest again. Now all tests pass, with some
warnings. Are the warnings serious? Let's ask Unblocked: thanks, now
pytest passes, but I'm getting these warnings.
What should I do? [plus concole output]
Unblocked suggestion was once again useful, but the real fix was buried in
third place after the examples (searching for class Config and
replacing it). Now I had a different issue, so I asked: how do I migrate arbitrary_types_allowed to ConfigDict ?
Suggestion worked, and now pytest passes without warnings. I'll go into the
changes to add the AlertManager source in another post.
Here's a
summary
of the changes which I'll submit as a PR to upstream ASAP. Note that the
commit as the warning: AI-assisted changes.