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

Add needrestart for tracing of services #124

Merged

Conversation

louisrokitta
Copy link
Contributor

Add "needrestart" to trace services which need to be restarted.

src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
LC_NUMERIC = "fr_FR.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
Copy link
Member

Choose a reason for hiding this comment

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

The mock data should only contain the real output - not the locale warnings.

Copy link
Member

Choose a reason for hiding this comment

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

I also think that goes to stderr, which is a good point to think about. https://docs.python.org/3/library/subprocess.html#subprocess.check_output says stderr is discarded by default and can be captured optionally. So to capture it manually, I'd run needrestart -b 2> /dev/null.

Copy link
Member

@ekohl ekohl left a comment

Choose a reason for hiding this comment

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

I appreciate that you're adding tests. However, I would like to see some tests that actually use the example output and see that it actually parses the right variables from it.

test/unittest_suite.py Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
@sbernhard
Copy link
Member

[test katello-host-tools]

@louisrokitta louisrokitta force-pushed the expand_tracing_of_services_need_restart branch from 7d4540a to 63b210b Compare February 15, 2022 09:25
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
src/katello/deb_tracer.py Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
test/test_katello/test_deb_tracer.py Outdated Show resolved Hide resolved
@louisrokitta louisrokitta force-pushed the expand_tracing_of_services_need_restart branch 2 times, most recently from eb380bc to 6b760b4 Compare February 15, 2022 14:52
@jturel
Copy link
Member

jturel commented Feb 22, 2022

I'm wondering if the functionality implemented here would be a better fit in frostyx/tracer . It's what provides the traces functionality to katello-host-tools. By enhancing frostyx/tracer we would benefit - and so would 'tracer' users themselves.

@sbernhard
Copy link
Member

I'm wondering if the functionality implemented here would be a better fit in frostyx/tracer . It's what provides the traces functionality to katello-host-tools. By enhancing frostyx/tracer we would benefit - and so would 'tracer' users themselves.

This was our first thought. Unfortunately, there is no tracer package available for SLES and debian because they have different approaches. Additionally, the implementation is pretty easy because we can use already existing apps.

@ekohl
Copy link
Member

ekohl commented Feb 22, 2022

Oh that's an excellent point. It looks like tracer already supports Debian so how hard would it be to package tracer for Debian?

@sbernhard
Copy link
Member

Oh that's an excellent point. It looks like tracer already supports Debian so how hard would it be to package tracer for Debian?

Unfortunately, the debian support in tracer isn't working / is not working completely and the "debian preferred way" is to use the data from needrestart. Therefore we used this solution - which is much easier and more reliable.

@ekohl
Copy link
Member

ekohl commented Feb 22, 2022

Is there a discussion with tracer to refer to, just to close the loop?

@sbernhard
Copy link
Member

sbernhard commented Feb 22, 2022

Is there a discussion with tracer to refer to, just to close the loop?

No. We tried the tracer on debian and found out, that it doesn't work currently and that there are some missing parts. Then we saw, that needrestart a) is already available as a package b) is "standard" in debian/ubuntu world c) works as expected and d) can be integrated easily.

@ekohl
Copy link
Member

ekohl commented Feb 22, 2022

I think it's a missed opportunity if you didn't try to collaborate with upstream tracer to make it work. Their readme states it's supposed to work with Debian so they care about it. That keeps this project smaller because it can rely on a common API.

@sbernhard
Copy link
Member

Understand your point regarding one API but if the truth is, that needrestart is packaged already and therefore widely used in debian environments, I see no reason to spend time to work on a project to create a second solution.

@ekohl
Copy link
Member

ekohl commented Feb 22, 2022

Is there a reason tracer couldn't use needrestart on Debian?

@sbernhard
Copy link
Member

Is there a reason tracer couldn't use needrestart on Debian?
Well, tracer had already a implementation for debian - which is in my eyes not as good as needrestart but I already wrote this.

@sbernhard
Copy link
Member

@jlsherrill can you please continue to discuss this topic? Together with #126

@jlsherrill
Copy link
Member

I'm gonna work with @parthaa to get it reviewed

@ekohl
Copy link
Member

ekohl commented Mar 29, 2022

Just to be clear, I don't explicitly object to merging this but I think it'd be good to keep things consistent. Ideally every platform fits in the same interface. That is still a goal that I think is good to keep in mind. That can also mean opening an issue to start a discussion.

src/katello/deb_tracer.py Outdated Show resolved Hide resolved
@louisrokitta louisrokitta force-pushed the expand_tracing_of_services_need_restart branch from 39c1500 to a8c6827 Compare May 6, 2022 09:38
@louisrokitta louisrokitta force-pushed the expand_tracing_of_services_need_restart branch from a8c6827 to 9a41e48 Compare May 20, 2022 09:49
@parthaa
Copy link
Contributor

parthaa commented Jun 22, 2022

Was able to generate traces and check the functionality. ACK

@parthaa parthaa merged commit 1e11968 into Katello:master Jun 22, 2022
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.

7 participants