Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wildfly align with upcoming semconv
  • Loading branch information
SylvainJuge committed Jun 18, 2024
commit cb27853be49c62df67a115e83ef25c1e0d014108
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ rules:
metricAttribute:
network.io.direction: const(receive)
- bean: jboss.as:subsystem=datasources,data-source=*,statistics=pool
unit: "1"
unit: "{connection}"
metricAttribute:
data_source: param(data-source)
mapping:
ActiveCount:
metric: wildfly.db.client.connections.usage
metric: wildfly.db.client.connection.count
metricAttribute:
state: const(used)
db.client.connection.state: const(used)
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I'm missing something, the metric will have a metric attribute which will always have the same constant value. What is really the point of having such an attribute?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are correct here, having a constant metric attribute only makes sense to provide breakdown of the same metric, occurences of wildfly.db.client.connection.usage should be renamed to wildfly.db.client.connection.count. I am currently trying to validate with the implementation if there is an overlap between the connection states or if it's an effective partition (in which case we can provide a breakdown).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When looking at the implementation and the wildfly test cases it seems that we have:

  • "available" seems close to the definition of "idle"
  • "in use" seems close to the definition of "busy"
  • "active" seems to mostly be the sum of "available" + "in use"
  • for "wait count", I haven't found any proper definition besides the docs

https://github.com/wildfly/wildfly/blob/841fea771567a71d06490a0d7e9a398dc6fdf5c0/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/statistics/DataSourcePoolClearStatisticsTestCase.java#L69

https://github.com/wildfly/wildfly/blob/841fea771567a71d06490a0d7e9a398dc6fdf5c0/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jca/capacitypolicies/ResourceAdapterCapacityPoliciesTestCase.java#L143

Given that both InUseCount and IdleCount refer to physical connection states in documentation, they effectively form a partition and then using a common metric with a constant attribute for idle | used makes sense.

For WaitCount this is about the number of logical connections that are waiting for a physical connection, so it would also make sense to use the same metric with a custom wait constant attribute.

When aggregating and removing attributes this would return the total number of logical connections to the database pool, and only a subset with either idle or used attribute value would be the physical connections.

I have updated this PR to match this in fb71fa1

desc: The number of open jdbc connections
IdleCount:
metric: wildfly.db.client.connections.usage
metricAttribute:
state: const(idle)
db.client.connection.state: const(idle)
desc: The number of idle jdbc connections
WaitCount:
metric: wildfly.db.client.connections.WaitCount
Expand Down
28 changes: 14 additions & 14 deletions instrumentation/jmx-metrics/javaagent/wildfly.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

Here is the list of metrics based on MBeans exposed by Wildfly.

| Metric Name | Type | Attributes | Description |
|----------------------------------------------------|---------------|------------------------------|-------------------------------------------------------------------------|
| wildfly.network.io | Counter | server, network.io.direction | Total number of bytes transferred |
| wildfly.request.errorCount | Counter | server, listener | The number of 500 responses that have been sent by this listener |
| wildfly.request.requestCount | Counter | server, listener | The number of requests this listener has served |
| wildfly.request.processingTime | Counter | server, listener | The total processing time of all requests handed by this listener |
| wildfly.session.expiredSession | Counter | deployment | Number of sessions that have expired |
| wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions |
| wildfly.session.sessionsCreated | Counter | deployment | Total sessions created |
| wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions |
| wildfly.db.client.connections.usage | Gauge | data_source, state | The number of open jdbc connections |
| wildfly.db.client.connections.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection |
| wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back |
| wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created |
| Metric Name | Type | Attributes | Description |
|----------------------------------------------------|---------------|------------------------------------------|-------------------------------------------------------------------------|
| wildfly.network.io | Counter | server, network.io.direction | Total number of bytes transferred |
| wildfly.request.errorCount | Counter | server, listener | The number of 500 responses that have been sent by this listener |
| wildfly.request.requestCount | Counter | server, listener | The number of requests this listener has served |
| wildfly.request.processingTime | Counter | server, listener | The total processing time of all requests handed by this listener |
| wildfly.session.expiredSession | Counter | deployment | Number of sessions that have expired |
| wildfly.session.rejectedSessions | Counter | deployment | Number of rejected sessions |
| wildfly.session.sessionsCreated | Counter | deployment | Total sessions created |
| wildfly.session.activeSessions | UpDownCounter | deployment | Number of active sessions |
| wildfly.db.client.connection.usage | Gauge | data_source, db.client.connections.state | The number of open jdbc connections |
| wildfly.db.client.connection.WaitCount | Counter | data_source | The number of requests that had to wait to obtain a physical connection |
| wildfly.db.client.rollback.count | Counter | cause | The total number of transactions rolled back |
| wildfly.db.client.transaction.NumberOfTransactions | Counter | | The total number of transactions (top-level and nested) created |