Skip to content

Commit 91b2096

Browse files
mattcolegatetobespc
authored andcommitted
Put out prometheus-style metrics on /metrics/codewind for Spring and Liberty (#99)
1 parent d811b09 commit 91b2096

File tree

21 files changed

+1035
-22
lines changed

21 files changed

+1035
-22
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,14 @@ javametrics-spring
7272
javametrics-rest
7373
<groupId>com.ibm.runtimetools</groupId>
7474
<artifactId>javametrics-rest</artifactId>
75+
76+
javametrics-codewind
77+
<groupId>com.ibm.runtimetools</groupId>
78+
<artifactId>javametrics-codewind</artifactId>
79+
80+
javametrics-codewind-spring
81+
<groupId>com.ibm.runtimetools</groupId>
82+
<artifactId>javametrics-codewind-spring</artifactId>
7583
```
7684

7785
### Websphere Liberty
@@ -81,12 +89,12 @@ Javametrics requires a Java option to be set in order to load the agent. A [jvm
8189

8290
```
8391
# Load Javametrics Java agent
84-
-javaagent:<path_to_javametrics_agent_dir>/javametrics-agent-1.3.1.jar
92+
-javaagent:<path_to_javametrics_agent_dir>/javametrics-agent-1.5.0.jar
8593
```
8694
If you have built the agent locally, your path_to_javametrics_agent_dir will need to point to your clone of javametrics.
8795
e.g.
8896
```
89-
-javaagent:<path_to_git_home>/javametrics/javaagent/target/javametrics-agent-1.3.1.jar
97+
-javaagent:<path_to_git_home>/javametrics/javaagent/target/javametrics-agent-1.5.0.jar
9098
```
9199
* NOTE, if you move the javametrics-agent to another directory you need to make sure you take the asm folder with it. The asm folder is required for the agent to run as it contains files that the agent needs
92100

@@ -121,12 +129,12 @@ You also need to add the following dependencies to your pom.xml:
121129
<dependency>
122130
<groupId>com.ibm.runtimetools</groupId>
123131
<artifactId>javametrics-spring</artifactId>
124-
<version>1.4.0</version>
132+
<version>1.5.0</version>
125133
</dependency>
126134
<dependency>
127135
<groupId>com.ibm.runtimetools</groupId>
128136
<artifactId>javametrics-agent</artifactId>
129-
<version>1.4.0</version>
137+
<version>1.5.0</version>
130138
</dependency>
131139
<dependency>
132140
<groupId>org.glassfish</groupId>
@@ -162,4 +170,4 @@ This project is released under an Apache 2.0 open source license.
162170
This project uses a semver-parsable X.0.Z version number for releases, where X is incremented for breaking changes to the public API described in this document and Z is incremented for bug fixes **and** for non-breaking changes to the public API that provide new function.
163171

164172
## Version
165-
1.4.0
173+
1.5.0

codewind-spring/pom.xml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<groupId>com.ibm.runtimetools</groupId>
6+
<artifactId>javametrics-codewind-spring</artifactId>
7+
<version>1.5.0</version>
8+
<packaging>jar</packaging>
9+
10+
<name>javametrics-codewind-spring</name>
11+
<description>Application Metrics for Java (/metrics/codewind endpoint for Spring)</description>
12+
<url>https://github.com/RuntimeTools/javametrics</url>
13+
14+
<properties>
15+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16+
</properties>
17+
18+
<licenses>
19+
<license>
20+
<name>The Apache Software License, Version 2.0</name>
21+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
22+
</license>
23+
</licenses>
24+
25+
<scm>
26+
<connection>scm:git:git://github.com/runtimetools/javametrics.git</connection>
27+
<developerConnection>scm:git:ssh://github.com/runtimetools/javametrics.git</developerConnection>
28+
<url>http://github.com/runtimetools/javametrics.git/tree/master</url>
29+
</scm>
30+
31+
<developers>
32+
<developer>
33+
<name>Toby Corbin</name>
34+
<email>[email protected]</email>
35+
<organization>IBM</organization>
36+
<organizationUrl>http://www.ibm.com</organizationUrl>
37+
</developer>
38+
</developers>
39+
40+
<distributionManagement>
41+
<snapshotRepository>
42+
<id>ossrh</id>
43+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
44+
</snapshotRepository>
45+
<repository>
46+
<id>ossrh</id>
47+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2</url>
48+
</repository>
49+
</distributionManagement>
50+
51+
<dependencies>
52+
<dependency>
53+
<groupId>javax.json</groupId>
54+
<artifactId>javax.json-api</artifactId>
55+
<version>1.1</version>
56+
<scope>provided</scope>
57+
</dependency>
58+
<dependency>
59+
<groupId>com.ibm.runtimetools</groupId>
60+
<artifactId>javametrics-agent</artifactId>
61+
<version>1.5.0</version>
62+
<scope>provided</scope>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>org.springframework.boot</groupId>
67+
<artifactId>spring-boot</artifactId>
68+
<version>2.1.3.RELEASE</version>
69+
</dependency>
70+
<dependency>
71+
<groupId>org.springframework.boot</groupId>
72+
<artifactId>spring-boot-starter-web</artifactId>
73+
<version>2.1.3.RELEASE</version>
74+
</dependency>
75+
</dependencies>
76+
77+
<build>
78+
<plugins>
79+
<plugin>
80+
<groupId>org.apache.maven.plugins</groupId>
81+
<artifactId>maven-source-plugin</artifactId>
82+
<version>2.2.1</version>
83+
<executions>
84+
<execution>
85+
<id>attach-sources</id>
86+
<goals>
87+
<goal>jar-no-fork</goal>
88+
</goals>
89+
</execution>
90+
</executions>
91+
</plugin>
92+
<plugin>
93+
<groupId>org.apache.maven.plugins</groupId>
94+
<artifactId>maven-javadoc-plugin</artifactId>
95+
<version>2.9.1</version>
96+
<executions>
97+
<execution>
98+
<phase>deploy</phase>
99+
<id>attach-javadocs</id>
100+
<goals>
101+
<goal>jar</goal>
102+
</goals>
103+
</execution>
104+
</executions>
105+
</plugin>
106+
<plugin>
107+
<groupId>org.apache.maven.plugins</groupId>
108+
<artifactId>maven-gpg-plugin</artifactId>
109+
<version>1.5</version>
110+
<executions>
111+
<execution>
112+
<id>sign-artifacts</id>
113+
<phase>deploy</phase>
114+
<goals>
115+
<goal>sign</goal>
116+
</goals>
117+
</execution>
118+
</executions>
119+
</plugin>
120+
<plugin>
121+
<groupId>org.sonatype.plugins</groupId>
122+
<artifactId>nexus-staging-maven-plugin</artifactId>
123+
<version>1.6.7</version>
124+
<extensions>true</extensions>
125+
<configuration>
126+
<serverId>ossrh</serverId>
127+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
128+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
129+
</configuration>
130+
</plugin>
131+
132+
<plugin>
133+
<artifactId>maven-compiler-plugin</artifactId>
134+
<version>3.6.1</version>
135+
<configuration>
136+
<source>1.8</source>
137+
<target>1.8</target>
138+
<compilerArgs>
139+
<arg>-Xlint:all</arg>
140+
</compilerArgs>
141+
</configuration>
142+
</plugin>
143+
<plugin>
144+
<groupId>org.apache.maven.plugins</groupId>
145+
<artifactId>maven-eclipse-plugin</artifactId>
146+
<version>2.10</version>
147+
<configuration>
148+
<projectNameTemplate>
149+
[artifactId]-[version]
150+
</projectNameTemplate>
151+
<wtpapplicationxml>true</wtpapplicationxml>
152+
<wtpversion>2.0</wtpversion>
153+
</configuration>
154+
</plugin>
155+
<plugin>
156+
<groupId>org.apache.maven.plugins</groupId>
157+
<artifactId>maven-jar-plugin</artifactId>
158+
<version>2.4</version>
159+
<configuration>
160+
<packagingExcludes>%regex[WEB-INF/lib/*.*]</packagingExcludes>
161+
</configuration>
162+
</plugin>
163+
</plugins>
164+
</build>
165+
</project>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*******************************************************************************
2+
* Copyright 2017 IBM Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
5+
* use this file except in compliance with the License. You may obtain a copy of
6+
* the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13+
* License for the specific language governing permissions and limitations under
14+
* the License.
15+
******************************************************************************/
16+
package com.ibm.javametrics.codewind.spring;
17+
18+
import org.springframework.context.annotation.Bean;
19+
import org.springframework.context.annotation.Configuration;
20+
import org.springframework.boot.web.servlet.ServletRegistrationBean;
21+
22+
import java.util.Arrays;
23+
import javax.servlet.http.HttpServlet;
24+
25+
import com.ibm.javametrics.codewind.web.WebPage;
26+
27+
@Configuration
28+
public class JavametricsCodewindSpringConfigurer {
29+
30+
@Bean
31+
ServletRegistrationBean<HttpServlet> JavametricsCodewindSpringServletRegistration () {
32+
ServletRegistrationBean<HttpServlet> srb = new ServletRegistrationBean<HttpServlet>();
33+
srb.setServlet(new WebPage());
34+
srb.setUrlMappings(Arrays.asList("/metrics/codewind"));
35+
return srb;
36+
}
37+
38+
}

0 commit comments

Comments
 (0)