Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
cb7e8cdb
Commit
cb7e8cdb
authored
Jan 24, 2020
by
Stephane Nicoll
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '2.2.x'
Closes gh-19904
parents
31094a86
99330325
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
TomcatMetricsBinder.java
.../boot/actuate/metrics/web/tomcat/TomcatMetricsBinder.java
+12
-3
No files found.
spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/metrics/web/tomcat/TomcatMetricsBinder.java
View file @
cb7e8cdb
/*
/*
* Copyright 2012-20
19
the original author or authors.
* Copyright 2012-20
20
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -25,6 +25,7 @@ import org.apache.catalina.Container;
...
@@ -25,6 +25,7 @@ import org.apache.catalina.Container;
import
org.apache.catalina.Context
;
import
org.apache.catalina.Context
;
import
org.apache.catalina.Manager
;
import
org.apache.catalina.Manager
;
import
org.springframework.beans.factory.DisposableBean
;
import
org.springframework.boot.context.event.ApplicationStartedEvent
;
import
org.springframework.boot.context.event.ApplicationStartedEvent
;
import
org.springframework.boot.web.context.WebServerApplicationContext
;
import
org.springframework.boot.web.context.WebServerApplicationContext
;
import
org.springframework.boot.web.embedded.tomcat.TomcatWebServer
;
import
org.springframework.boot.web.embedded.tomcat.TomcatWebServer
;
...
@@ -38,12 +39,14 @@ import org.springframework.context.ApplicationListener;
...
@@ -38,12 +39,14 @@ import org.springframework.context.ApplicationListener;
* @author Andy Wilkinson
* @author Andy Wilkinson
* @since 2.1.0
* @since 2.1.0
*/
*/
public
class
TomcatMetricsBinder
implements
ApplicationListener
<
ApplicationStartedEvent
>
{
public
class
TomcatMetricsBinder
implements
ApplicationListener
<
ApplicationStartedEvent
>
,
DisposableBean
{
private
final
MeterRegistry
meterRegistry
;
private
final
MeterRegistry
meterRegistry
;
private
final
Iterable
<
Tag
>
tags
;
private
final
Iterable
<
Tag
>
tags
;
private
volatile
TomcatMetrics
tomcatMetrics
;
public
TomcatMetricsBinder
(
MeterRegistry
meterRegistry
)
{
public
TomcatMetricsBinder
(
MeterRegistry
meterRegistry
)
{
this
(
meterRegistry
,
Collections
.
emptyList
());
this
(
meterRegistry
,
Collections
.
emptyList
());
}
}
...
@@ -57,7 +60,8 @@ public class TomcatMetricsBinder implements ApplicationListener<ApplicationStart
...
@@ -57,7 +60,8 @@ public class TomcatMetricsBinder implements ApplicationListener<ApplicationStart
public
void
onApplicationEvent
(
ApplicationStartedEvent
event
)
{
public
void
onApplicationEvent
(
ApplicationStartedEvent
event
)
{
ApplicationContext
applicationContext
=
event
.
getApplicationContext
();
ApplicationContext
applicationContext
=
event
.
getApplicationContext
();
Manager
manager
=
findManager
(
applicationContext
);
Manager
manager
=
findManager
(
applicationContext
);
new
TomcatMetrics
(
manager
,
this
.
tags
).
bindTo
(
this
.
meterRegistry
);
this
.
tomcatMetrics
=
new
TomcatMetrics
(
manager
,
this
.
tags
);
this
.
tomcatMetrics
.
bindTo
(
this
.
meterRegistry
);
}
}
private
Manager
findManager
(
ApplicationContext
applicationContext
)
{
private
Manager
findManager
(
ApplicationContext
applicationContext
)
{
...
@@ -80,4 +84,9 @@ public class TomcatMetricsBinder implements ApplicationListener<ApplicationStart
...
@@ -80,4 +84,9 @@ public class TomcatMetricsBinder implements ApplicationListener<ApplicationStart
return
null
;
return
null
;
}
}
@Override
public
void
destroy
()
{
this
.
tomcatMetrics
.
close
();
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment