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

Javadoc fix in simpleclient_servlet #417

Merged
merged 5 commits into from
Aug 29, 2018

Conversation

rbarazzutti
Copy link
Contributor

@rbarazzutti rbarazzutti commented Aug 27, 2018

hi @brian-brazil,

a small PR with fixes in the JavaDoc (displays properly the XML code)

Signed-off-by: Raphael P. Barazzutti <raphael@barazzutti.net>
/**
* The servlet exposes the metrics
*
* <p>Example config to export metrics on path {@code /metrics}:
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes no sense to me as it lacks context. What is it that takes this configuration?

As this is not tied to the servlet itself, I don't think this should be here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks for the feedback. tried to address that

Signed-off-by: Raphael P. Barazzutti <raphael@barazzutti.net>
Signed-off-by: Raphael P. Barazzutti <raphael@barazzutti.net>
/**
* The MetricsServlet class exists to provide a simple way of exposing the metrics values.
*
* <p>This servlet might be used with a filter such the {@link io.prometheus.client.filter.MetricsFilter}
Copy link
Contributor

Choose a reason for hiding this comment

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

That's for something else.

Copy link
Contributor

Choose a reason for hiding this comment

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

This line shouldn't be here, exposition and instrumentation are separate concerns.

*
* <p>This servlet might be used with a filter such the {@link io.prometheus.client.filter.MetricsFilter}
*
* <p>Usage example (in webapp's {@code web.xml}):
Copy link
Contributor

Choose a reason for hiding this comment

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

What's a web.xml?

This seems specific to one particular framework, and only one way that this could be used. The changes to this file don't belong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The web.xml file is the deployment descriptor for a Servlet-based Java web application. It's pretty common.
The XML snippet that is in MetricsFilter.java is also referring to that web.xml.

A user of the servlet may want to know how to use it, this way is the most straightforward.

Copy link
Contributor

Choose a reason for hiding this comment

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

I personally have never heard of it, nor have I ever needed to use it to use servlets. This sounds like something specific to the framework you are using, and not generally applicable and thus doesn't belong here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All major Java servlet containers handle it (all containers that are compliant with JSR-154, or newer JSRs).

Currently, this module depends on Java Servlet 3.0, that implements JSR-315 (http://download.oracle.com/otn-pub/jcp/servlet-3.0-fr-eval-oth-JSpec/servlet-3_0-final-spec.pdf), that describes pretty well how to use it.

Could you please tell me where the XML snippet that is in MetricsFilter.java should be used then?

Copy link
Contributor

Choose a reason for hiding this comment

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

I presumed it was something Spring related, as it came in in the same PR. Claiming that this applies to all web applications seems a bit broad.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR is "Spring-free" ...

I don't claim it applies to all web application. But for sure, its the most common way of deploying a very simple servlet (especially when not using an extra framework). It's a simple example, that helps many.

But I'm still trying to figure out why this syntax is fine in MetricsFilter.java and not with the servlet. I added it for consistency.

Copy link
Contributor

Choose a reason for hiding this comment

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

The current text claims it works for all web applications, which is not true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi @brian-brazil,

I'll see how to rephrase this.

But it is supposed to work on any web app container that supports the servlet 3.0 specs (which is referred by the pom.xml of this module).

Cheers

Signed-off-by: Raphael P. Barazzutti <raphael@barazzutti.net>
Signed-off-by: Raphael P. Barazzutti <raphael@barazzutti.net>
@brian-brazil brian-brazil merged commit a354712 into prometheus:master Aug 29, 2018
@brian-brazil
Copy link
Contributor

Thanks!

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.

2 participants