Skip to content

Jmx unit semconv alignment - Tomcat #13650

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

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

robsunday
Copy link
Contributor

@robsunday robsunday commented Apr 4, 2025

Changes:

  1. Metric names made semconv aligned
  2. Attribute names made semconv aligned
  3. Metrics descriptions format standardized
  4. tomcat.yaml moved from agent to library folder to make it reusable in all library dependants
  5. Tomcat JMX metrics Integration test implemented. It utilize assertions and target system integration test framework ported by @SylvainJuge from opentelemetry-java-contrib

Tomcat metrics description md file moved to library
Code review followup
@@ -32,7 +38,6 @@ class JmxMetricInsightInstallerTest {
"hadoop.yaml",
"jetty.yaml",
"kafka-broker.yaml",
"tomcat.yaml",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

[for reviewer] Tomcat metrics definition is tested in a much better way in TomcatIntegrationTest.java

Copy link
Contributor

Choose a reason for hiding this comment

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

By "much better way" here it means being tested against a real tomcat instance rather than trying to parse the yaml file to see if there are any errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Moreover, it can now be easily tested with multiple tomcat versions

@robsunday robsunday marked this pull request as ready for review April 8, 2025 13:10
@robsunday robsunday requested a review from a team as a code owner April 8, 2025 13:10
@SylvainJuge
Copy link
Contributor

@robsunday #13597 has been merged, so you can update with current state of main to make diff simpler.

sourceUnit: ms
unit: s
desc: The longest request processing time.
processingTime:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think that processingTime and maxTime mbean attributes are related, so we should probably make sure their name reflect that, for example:

  • tomcat.request.max.time for maxTime + tomcat.request.total.time for processingTime
  • having the total or max not at the end of the metric name helps to avoid the "do not use total" rule in semconv
  • alternatively, we could argue that the "do not use total" rule in semconv refers only to the _total and not total suffix and then use tomcat.request.time.max and tomcat.request.time.total but this might be harder to make people agree on this.

tomcat.context: param(context)
mapping:
activeSessions:
metric: active_session.count
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
metric: active_session.count
metric: session.active.count

In addition to renaming I would suggest to add tomcat.session.active.limit updowncounter as it provides the configured limit if there is any or -1 if none is set, so using the negative value filtering would be appropriate for it.

As a side note, there are also the expiredSessions and rejectedSessions mbeans attributes that would be tempting to use for a tomcat.session.count with a metric attribute to provide breakdown per state on the total number of sessions but we would be making assumptions on the implementation, so I would not recommend that, also it prevents us from having tomcat.session.active.count and tomcat.session.active.limit.

prefix: tomcat.thread.
type: updowncounter
metricAttribute:
tomcat.thread_pool.name: param(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
tomcat.thread_pool.name: param(name)
tomcat.thread.pool.name: param(name)

This would be consistent with db.client.connection.pool.name defined in DB semconv.

currentThreadsBusy:
metric: busy.count
desc: Number of busy threads in the thread pool.

Copy link
Contributor

Choose a reason for hiding this comment

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

Here we could also capture maxThreads as tomcat.thread.limit (updowncounter), but this could be done in another PR as an improvement.

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.

3 participants