forked from mapfish/mapfish-print
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed up metrics so that all metrics are correctly shared across the …
…application.
- Loading branch information
Jesse Eichar
committed
May 9, 2014
1 parent
9918ba1
commit cad1210
Showing
10 changed files
with
140 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
core/src/main/java/org/mapfish/print/metrics/JvmMetricsConfigurator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* Copyright (C) 2014 Camptocamp | ||
* | ||
* This file is part of MapFish Print | ||
* | ||
* MapFish Print is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* MapFish Print is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with MapFish Print. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package org.mapfish.print.metrics; | ||
|
||
import com.codahale.metrics.MetricRegistry; | ||
import com.codahale.metrics.jvm.FileDescriptorRatioGauge; | ||
import com.codahale.metrics.jvm.GarbageCollectorMetricSet; | ||
import com.codahale.metrics.jvm.MemoryUsageGaugeSet; | ||
import com.codahale.metrics.jvm.ThreadStatesGaugeSet; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
import javax.annotation.PostConstruct; | ||
|
||
/** | ||
* A bean that will add several gauges and metric sets for tracking the JVM stats. | ||
* | ||
* @author Jesse on 5/9/2014. | ||
*/ | ||
public final class JvmMetricsConfigurator { | ||
|
||
@Autowired | ||
private MetricRegistry metricRegistry; | ||
|
||
/** | ||
* Add several jvm metrics. | ||
*/ | ||
@PostConstruct | ||
public void init() { | ||
this.metricRegistry.register(name("gc"), new GarbageCollectorMetricSet()); | ||
this.metricRegistry.register(name("memory"), new MemoryUsageGaugeSet()); | ||
this.metricRegistry.register(name("thread-states"), new ThreadStatesGaugeSet()); | ||
this.metricRegistry.register(name("fd-usage"), new FileDescriptorRatioGauge()); | ||
} | ||
|
||
private String name(final String metricName) { | ||
return "jvm-" + metricName; | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
core/src/main/resources/mapfish-spring-application-context-override.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (C) 2014 Camptocamp | ||
~ | ||
~ This file is part of MapFish Print | ||
~ | ||
~ MapFish Print is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ MapFish Print is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU General Public License | ||
~ along with MapFish Print. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<beans default-lazy-init="true" xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
<!-- | ||
This file is intentionally left empty. Other plugins/configurations can add a file with the same name and the beans | ||
in that file will override the beans defined in the other default spring configuration files | ||
--> | ||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
core/src/main/webapp/WEB-INF/mapfish-print-printer-factory.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright (C) 2014 Camptocamp | ||
~ | ||
~ This file is part of MapFish Print | ||
~ | ||
~ MapFish Print is free software: you can redistribute it and/or modify | ||
~ it under the terms of the GNU General Public License as published by | ||
~ the Free Software Foundation, either version 3 of the License, or | ||
~ (at your option) any later version. | ||
~ | ||
~ MapFish Print is distributed in the hope that it will be useful, | ||
~ but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
~ GNU General Public License for more details. | ||
~ | ||
~ You should have received a copy of the GNU General Public License | ||
~ along with MapFish Print. If not, see <http://www.gnu.org/licenses/>. | ||
--> | ||
|
||
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd"> | ||
<bean id="mapPrinterFactory" class="org.mapfish.print.servlet.ServletMapPrinterFactory"> | ||
<property name="appsRootDirectory" value="servlet:///print-apps" /> | ||
</bean> | ||
</beans> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters