Skip to content

Commit 169cc17

Browse files
Collect more metrics by default
1 parent 29669c4 commit 169cc17

5 files changed

Lines changed: 43 additions & 6 deletions

File tree

tomcat/changelog.d/16631.added

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Collect more metrics by default

tomcat/datadog_checks/tomcat/data/metrics.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ jmx_metrics:
1313
currentThreadsBusy:
1414
alias: tomcat.threads.busy
1515
metric_type: gauge
16+
minSpareThreads:
17+
alias: tomcat.threads.min
18+
metric_type: gauge
1619
- include:
1720
domain_regex: Catalina|Tomcat
1821
type: GlobalRequestProcessor
@@ -32,6 +35,9 @@ jmx_metrics:
3235
maxTime:
3336
alias: tomcat.max_time
3437
metric_type: gauge
38+
minTime:
39+
alias: tomcat.min_time
40+
metric_type: gauge
3541
processingTime:
3642
alias: tomcat.processing_time
3743
metric_type: counter
@@ -48,6 +54,12 @@ jmx_metrics:
4854
requestCount:
4955
alias: tomcat.servlet.request_count
5056
metric_type: counter
57+
maxTime:
58+
alias: tomcat.servlet.max_time
59+
metric_type: gauge
60+
minTime:
61+
alias: tomcat.servlet.min_time
62+
metric_type: gauge
5163
- include:
5264
# Deprecated metric available in Tomcat 7
5365
# https://github.com/apache/tomcat/blob/7.0.x/java/org/apache/catalina/core/StandardContext.java#L5293-L5297
@@ -70,6 +82,12 @@ jmx_metrics:
7082
hitCount:
7183
alias: tomcat.string_cache.hit_count
7284
metric_type: counter
85+
size:
86+
alias: tomcat.string_cache.size
87+
metric_type: gauge
88+
maxSize:
89+
alias: tomcat.string_cache.max_size
90+
metric_type: gauge
7391
- include:
7492
# Example Bean: `Catalina:type=WebResourceRoot,host=localhost,context=/docs,name=Cache`
7593
domain_regex: Catalina|Tomcat

tomcat/metadata.csv

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,26 @@
11
metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation,integration,short_name,curated_metric
22
tomcat.threads.max,gauge,10,thread,,The maximum number of allowed worker threads.,0,tomcat,max threads,
3+
tomcat.threads.min,gauge,10,thread,,The minimum number of allowed worker threads.,0,tomcat,min threads,
34
tomcat.threads.count,gauge,10,thread,,The number of threads managed by the thread pool.,0,tomcat,thread count,
45
tomcat.threads.busy,gauge,10,thread,,The number of threads that are in use.,0,tomcat,busy threads,
56
tomcat.bytes_sent,gauge,10,byte,second,Bytes per second sent by all the request processors.,0,tomcat,bytes sent,
67
tomcat.bytes_rcvd,gauge,10,byte,second,Bytes per second received by all request processors.,0,tomcat,bytes rcvd,
78
tomcat.error_count,gauge,10,error,second,The number of errors per second on all request processors.,-1,tomcat,errors,
89
tomcat.request_count,gauge,10,request,second,The number of requests per second across all request processors.,0,tomcat,requests,
910
tomcat.max_time,gauge,10,millisecond,,The longest request processing time (in milliseconds).,0,tomcat,max time,
11+
tomcat.min_time,gauge,10,millisecond,,The shortest request processing time (in milliseconds).,0,tomcat,min time,
1012
tomcat.processing_time,gauge,10,,,The sum of request processing times across all requests handled by the request processors (in milliseconds) per second.,0,tomcat,proc time,
1113
tomcat.servlet.processing_time,gauge,10,,,The sum of request processing times across all requests to the servlet (in milliseconds) per second.,0,tomcat,servlet proc time,
1214
tomcat.servlet.error_count,gauge,10,error,second,The number of erroneous requests received by the servlet per second.,-1,tomcat,servlet err count,
1315
tomcat.servlet.request_count,gauge,10,request,second,The number of requests received by the servlet per second.,0,tomcat,servlet requests,
1416
tomcat.cache.access_count,gauge,10,get,second,The number of accesses to the cache per second.,0,tomcat,cache accesses,
1517
tomcat.cache.hits_count,gauge,10,hit,second,The number of cache hits per second.,0,tomcat,cache hits,
18+
tomcat.servlet.max_time,gauge,10,millisecond,,The maximum processing time of a request,0,tomcat,servlet max time,
19+
tomcat.servlet.min_time,gauge,10,millisecond,,The minimum processing time of a request,0,tomcat,servlet min time,
1620
tomcat.string_cache.access_count,gauge,10,get,second,The number of accesses to the string cache per second.,0,tomcat,string cache accesses,
1721
tomcat.string_cache.hit_count,gauge,10,hit,second,The number of string cache hits per second.,0,tomcat,string cache hits,
22+
tomcat.string_cache.cache_size,gauge,10,byte,,The size of the String cache,0,tomcat,string cache size,
23+
tomcat.string_cache.max_size,gauge,10,byte,,The maximum size of the String cache,0,tomcat,string cache max size,
1824
tomcat.web.cache.lookup_count,gauge,10,get,second,The number of lookups to the web resource cache per second.,0,tomcat,web cache lookups,
1925
tomcat.web.cache.hit_count,gauge,10,hit,second,The number of web resource cache hits per second.,0,tomcat,web cache hits,
2026
tomcat.jsp.count,gauge,10,page,second,The number of JSPs per second that have been loaded in the web module.,0,tomcat,jsp count,

tomcat/tests/common.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,11 @@
1414
HERE = get_here()
1515

1616
TOMCAT_E2E_METRICS = [
17-
# Tomcat
1817
"tomcat.max_time",
1918
"tomcat.threads.busy",
2019
"tomcat.threads.count",
2120
"tomcat.threads.max",
22-
# Rates
21+
"tomcat.threads.min",
2322
"tomcat.bytes_sent",
2423
"tomcat.bytes_rcvd",
2524
"tomcat.error_count",
@@ -28,14 +27,24 @@
2827
"tomcat.servlet.processing_time",
2928
"tomcat.servlet.error_count",
3029
"tomcat.servlet.request_count",
30+
"tomcat.servlet.max_time",
31+
"tomcat.servlet.min_time",
3132
"tomcat.jsp.count",
3233
"tomcat.jsp.reload_count",
3334
"tomcat.string_cache.access_count",
3435
"tomcat.string_cache.hit_count",
36+
"tomcat.string_cache.size",
37+
"tomcat.string_cache.max_size",
3538
"tomcat.web.cache.hit_count",
3639
"tomcat.web.cache.lookup_count",
3740
] + JVM_E2E_METRICS_NEW
3841

42+
OPTIONAL_TOMCAT_E2E_METRICS = [
43+
"tomcat.min_time",
44+
"tomcat.string_cache.size",
45+
"tomcat.string_cache.max_size",
46+
]
47+
3948
E2E_METADATA = {
4049
'use_jmx': True,
4150
'env_vars': {

tomcat/tests/test_e2e.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,19 @@
55
from datadog_checks.dev.jmx import JVM_E2E_METRICS_NEW
66
from datadog_checks.dev.utils import get_metadata_metrics
77

8-
from .common import TOMCAT_E2E_METRICS
8+
from .common import OPTIONAL_TOMCAT_E2E_METRICS, TOMCAT_E2E_METRICS
99

1010

1111
def test_metrics(dd_agent_check, instance):
1212
aggregator = dd_agent_check(instance, rate=True)
1313

1414
for metric in TOMCAT_E2E_METRICS:
15-
aggregator.assert_metric(metric)
16-
aggregator.assert_metric_has_tag(metric, 'instance:tomcat-localhost-9012')
17-
aggregator.assert_metric_has_tag(metric, 'dd.internal.jmx_check_name:tomcat')
15+
at_least = 0 if metric in OPTIONAL_TOMCAT_E2E_METRICS else 1
16+
aggregator.assert_metric(metric, at_least=at_least)
17+
18+
if at_least:
19+
aggregator.assert_metric_has_tag(metric, 'instance:tomcat-localhost-9012')
20+
aggregator.assert_metric_has_tag(metric, 'dd.internal.jmx_check_name:tomcat')
1821

1922
aggregator.assert_all_metrics_covered()
2023
aggregator.assert_metrics_using_metadata(get_metadata_metrics(), exclude=JVM_E2E_METRICS_NEW)

0 commit comments

Comments
 (0)