OpenLiberty / docs

See Open Liberty documentation on https://openliberty.io/docs/
https://openliberty.io/docs/
Other
13 stars 47 forks source link

Introduction topic to metrics with OL #1891

Closed Charlotte-Holt closed 3 years ago

Charlotte-Holt commented 4 years ago

We need a new concept topic that talks about the two kinds of metrics you can use with OL - MicroProfile Metrics and JMX metrics. We already have reference lists for both of these metric types. We also have a dev-focused topic about annotations with MP Metrics. This topic should introduce both types and answer the following questions:

I previously wrote a short blurb about JMX metrics that didn't fit into any existing metrics topics but is probably high-level enough to be included in this topic, so you can see if it works:

== JMX metrics
In addition to accessing metrics from a `/metrics` endpoint, you can also access Java Management Extensions (JMX) metrics by enabling the link:/docs/ref/feature/#monitor-1.0.html[Performance Monitoring feature].
While the link:/docs/ref/feature/#mpMetrics.html[MicroProfile Metrics feature] provides a `/metrics` REST endpoint that you can use with Prometheus or other web-based tools, the Performance Monitoring feature provides JMX MXBeans that you can use with JConsole or other JMX-based tools.

If you use the Performance Monitoring feature with the MicroProfile Metrics feature, then you get both JMX metrics and `/metrics` endpoint metrics, and the JMX metrics are included in the `/metrics` output.
The MicroProfile Metrics 2.3 feature and later automatically enables the Performance Monitoring feature.
For a list of all JMX metrics that are available for Open Liberty, see the link:/docs/ref/general/#jmx-metrics-list.html[JMX metrics reference list].

=== Enable JMX metrics
You can enable JMX metrics by adding the Performance Monitoring feature to your `server.xml` file.
After you add this feature to your server configuration, monitoring of JMX metrics automatically starts.

After you enable monitoring for Open Liberty, you can use JConsole to connect to the JVM and view performance data by clicking each attribute of the MXBeans.
JConsole is a JVM tool used for viewing monitoring and performance data.
If you prefer, you can choose to use other products that consume JMX metrics to view your metrics information.
Charlotte-Holt commented 4 years ago

@donbourne I know I slacked you, but just wanted to note it here :) This topic is ready for your review: https://draft-openlibertyio.mybluemix.net/docs/20.0.0.9/introduction-monitoring-metrics.html.

Like we talked about:

  1. Need to answer the questions "What are the benefits of each?" and "Why would you use each?" in the intro paragraph.
  2. Update the table to split out JSON and Prometheus.
Charlotte-Holt commented 4 years ago

@donbourne I updated the topic and fixed the table to only include the metrics that are available by GET request: https://draft-openlibertyio.mybluemix.net/docs/20.0.0.9/introduction-monitoring-metrics.html.

donbourne commented 4 years ago

@Charlotte-Holt , here are my comments...


This part needs to also talk about the server component's metrics:

MicroProfile Metrics provides an API for developers to add metrics to their applications. Metrics come in a variety of forms, including counters, gauges, timers, histograms, and meters. You can access MicroProfile Metrics by enabling the MicroProfile Metrics feature. The MicroProfile Metrics feature provides a /metrics REST interface that conforms to the MicroProfile Metrics specification. Real-time values of all metrics are available from a call to the /metrics endpoint. For more information about adding these metrics to your applications, see Microservice observability with metrics. For a list of all REST endpoint-style metrics that are available for Open Liberty, see the Metrics reference list.

suggest:

The MicroProfile Metrics feature provides a /metrics REST interface that conforms to the MicroProfile Metrics specification. Open Liberty uses MicroProfile Metrics to expose metrics describing the internal state of many of its components. Developers can use the MicroProfile Metrics API to expose metrics from their applications as well.

Metrics come in a variety of forms, including counters, gauges, timers, histograms, and meters. You can access MicroProfile Metrics by enabling the MicroProfile Metrics feature. Real-time values of all metrics are available from a call to the /metrics endpoint. For more information about adding these metrics to your applications, see Microservice observability with metrics. For a list of all REST endpoint-style metrics that are available for Open Liberty, see the Metrics reference list.


While the MicroProfile Metrics feature provides a /metrics REST endpoint that you can use with Prometheus or other web-based tools


provides JMX MXBeans that you can use with JConsole. -> provides JMX MXBeans that you can use with monitoring tools that use JMX, such as JConsole.


This part feels a bit loose:

If you enable the MicroProfile Metrics feature with the Performance Monitoring feature, then you get both REST endpoint-style metrics and JMX metrics, and the JMX metrics are included in the /metrics output. The MicroProfile Metrics feature version 2.3 and later automatically enables the Performance Monitoring feature.

suggest:

If you enable both the MicroProfile Metrics and Performance Monitoring features, then the JMX MXBeans for monitoring and the /metrics REST endpoint will be activated. In this case, metrics for Open Liberty server components are exposed though both interfaces. The MicroProfile Metrics feature version 2.3 and later automatically enables the Performance Monitoring feature.


somehow this topic needs to convey that mp metrics provides basic metrics about the JVM and metrics added to applications using the MP Metrics API, but mp metrics doesn't provide metrics about OL server components unless mp metrics is used in conjunction with Performance Monitoring feature. Perhaps that could be at the start of the "Using both types of metrics" section.


intro:

With Open Liberty, you can use two types of metrics to monitor your applications, REST endpoint-style metrics provided by MicroProfile Metrics and JMX metrics.

MicroProfile Metrics can be accessed by monitoring tools such as Prometheus and by any client capable of making REST requests.

JMX metrics are suitable for use by Java-based monitoring tools that can communicate with JMX servers, or by custom JMX clients.

Charlotte-Holt commented 4 years ago

@donbourne Thanks! I've addressed your feedback in the updated draft.

donbourne commented 4 years ago

looks good!

Charlotte-Holt commented 4 years ago

@lauracowen Can you review https://draft-openlibertyio.mybluemix.net/docs/20.0.0.10/introduction-monitoring-metrics.html?

lauracowen commented 4 years ago

Some style things but I'll sign it off:

donbourne commented 4 years ago

...that's a just hangover from printed documents in which it's not possible for the author to know where the figure will be typeset on the eventually published/printed page. Whereas in online articles, you control exactly where the figure/table goes in the flow of content on the page.

... cool history lesson, thanks! :-)

Charlotte-Holt commented 4 years ago

@lauracowen Thx for the review! Updated: https://draft-openlibertyio.mybluemix.net/docs/20.0.0.12/introduction-monitoring-metrics.html. Do you still think the file name is okay (introduction-monitoring-metrics)? Maybe we can talk on Friday about using the code feature name in parentheses in certain contexts - could be an update for the style guide.

Charlotte-Holt commented 4 years ago

Requesting a peer review from @Rwalls1

Rwalls1 commented 4 years ago

Peer review

The topic looks good, I just have a few comments:

Charlotte-Holt commented 4 years ago

@Rwalls1 Thanks for the review. Feedback addressed:

lauracowen commented 4 years ago

I just saw this and one thing I'd say about "If you prefer" is that it potentially provides a reason as to why you might also choose something - if that choice literally just comes down to preference. It may not make a difference in this particular situation but conversational is not necessarily a bad thing in the Open Liberty docs - we need to avoid them coming across as really dry and sterile - they need to be appealing to the reader, not just be functional in providing information. There are many reasons you might make a "choice"; a "preference" can be one of those reasons.

I think the comment is probably referring to "If you prefer, you can choose to use other products"? If so, that could be shortened to "If you prefer, you can use other products...." or similar to make it more concise. I'm not saying one is better than the other here - I'll leave the choice to Charlotte. But, in general, there's value in the writing being a little conversational as long as it's not super-wordy or super-colloquial (I agree the docs need to be concise in how things are described etc though).

Charlotte-Holt commented 4 years ago

@chirp1 Updated link: https://draft-openlibertyio.mybluemix.net/docs/20.0.0.12/introduction-monitoring-metrics.html

Charlotte-Holt commented 4 years ago

@chirp1 I'd went through focused on updates relating to the chapters on clarity and concreteness. Some specific updates I made:

donbourne commented 4 years ago

would like to reference this topic to address a customer question at https://groups.io/g/openliberty/topic/78185136 . Can this please be published?

chirp1 commented 4 years ago

Hi Charlotte, The topic looks nice! I have a few comments:

Charlotte-Holt commented 4 years ago

@chirp1 Thanks for the review! I addressed all your feedback as follows:

chirp1 commented 4 years ago

Hi Charlotte, The updates look good and the topic looks nice! As we discussed over slack with David, we don't need "Table 1" on a topic with a single table. I added the "editorial reviewed" label to this issue and am moving the issue to the Ready to Publish column.

Charlotte-Holt commented 3 years ago

Merged to vNext with Karen's edits in #3262