Skip to content

Commit

Permalink
Initial commit of orienteer-metrics for issue #395
Browse files Browse the repository at this point in the history
  • Loading branch information
PhantomYdn committed Mar 11, 2020
1 parent 0afc522 commit 81b90fe
Show file tree
Hide file tree
Showing 11 changed files with 451 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,14 @@
<artifactId>orienteer-bot</artifactId>
<description>Module to build and run messangers bots</description>
</module>
<module>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-tours</artifactId>
<description>Module to create guided tours</description>
</module>
<module>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-metrics</artifactId>
<description>Module to gather metrics from Orienteer instance</description>
</module>
</metadata>
1 change: 1 addition & 0 deletions orienteer-metrics/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Module to Collect Metrics from Orienteer
269 changes: 269 additions & 0 deletions orienteer-metrics/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>orienteer-parent</artifactId>
<groupId>org.orienteer</groupId>
<version>1.5-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>orienteer-metrics</artifactId>
<name>orienteer-metrics</name>

<dependencies>
<dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- The client -->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient</artifactId>
<version>0.8.1</version>
</dependency>
<!-- Hotspot JVM metrics-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_common</artifactId>
<version>0.8.1</version>
</dependency>
<!-- Hotspot JVM metrics-->
<dependency>
<groupId>io.prometheus</groupId>
<artifactId>simpleclient_hotspot</artifactId>
<version>0.8.1</version>
</dependency>
<!-- <dependency>
<groupId>org.webjars</groupId>
<artifactId>bootstrap-tour</artifactId>
<version>0.12.0</version>
</dependency> -->
<!-- <dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>bootstrap-tourist</artifactId>
<version>0.0.10</version>
</dependency> -->
<!--<dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-architect</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!--<dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-birt</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-bpm</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!--<dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-camel</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-devutils</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-etl</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-graph</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-logger-server</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-mail</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-object</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-pages</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-pivottable</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-taucharts</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<!-- <dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-users</artifactId>
<version>${orienteer.version}</version>
</dependency>-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<!-- ORIENTEER TESTS for TESTING -->
<dependency>
<groupId>org.orienteer</groupId>
<artifactId>orienteer-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>ru.ydn.wicket.wicket-orientdb</groupId>
<artifactId>wicket-orientdb</artifactId>
<version>${wicket.orientdb.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<!-- JUNIT DEPENDENCY FOR TESTING -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/resources</directory>
</testResource>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<plugins>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.6</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<wtpversion>${wtp.version}</wtpversion>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<systemPropertyVariables>
<orienteer.loader.repository.local>${settings.localRepository}</orienteer.loader.repository.local>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
<configuration>
<systemProperties>
<systemProperty>
<name>orienteer.loader.repository.local</name>
<value>${settings.localRepository}</value>
</systemProperty>
</systemProperties>
<supportedPackagings>
<supportedPackaging>jar</supportedPackaging>
</supportedPackagings>
<webApp>
<descriptor>../orienteer-war/src/main/webapp/WEB-INF/web.xml</descriptor>
<resourceBase>src/main/resources</resourceBase>
<contextPath>/</contextPath>
<containerIncludeJarPattern>^$</containerIncludeJarPattern>
<webInfIncludeJarPattern>^$</webInfIncludeJarPattern>
</webApp>
<httpConnector>
<name>org.eclipse.jetty.server.nio.SelectChannelConnector</name>
<port>8080</port>
<idleTimeout>3600000</idleTimeout>
</httpConnector>
</configuration>
<dependencies>
<dependency>
<groupId>org.eclipse.jetty.aggregate</groupId>
<artifactId>jetty-all</artifactId>
<classifier>uber</classifier>
<version>${jetty.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package org.orienteer.metrics;

import org.apache.wicket.Application;
import org.apache.wicket.IInitializer;
import org.orienteer.core.OrienteerWebApplication;

/**
* {@link IInitializer} for 'tours' module
*/
public class Initializer implements IInitializer
{
@Override
public void init(Application application) {
OrienteerWebApplication app = (OrienteerWebApplication)application;
app.registerModule(OMetricsModule.class);
}

@Override
public void destroy(Application application) {
OrienteerWebApplication app = (OrienteerWebApplication)application;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package org.orienteer.metrics;

import org.orienteer.core.OrienteerWebApplication;
import org.orienteer.core.module.AbstractOrienteerModule;
import org.orienteer.core.module.IOrienteerModule;

import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.record.impl.ODocument;

import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.hotspot.DefaultExports;

/**
* {@link IOrienteerModule} for 'metrics' module
*/
public class OMetricsModule extends AbstractOrienteerModule{


protected OMetricsModule() {
super("metrics", 1);
}

@Override
public ODocument onInstall(OrienteerWebApplication app, ODatabaseDocument db) {
super.onInstall(app, db);
return null;
}

@Override
public void onInitialize(OrienteerWebApplication app, ODatabaseDocument db) {
super.onInitialize(app, db);
DefaultExports.initialize();
app.mountPackage(OMetricsModule.class.getPackage().getName());
}

@Override
public void onDestroy(OrienteerWebApplication app, ODatabaseDocument db) {
app.unmountPackage(OMetricsModule.class.getPackage().getName());
CollectorRegistry.defaultRegistry.clear();
super.onDestroy(app, db);
}

}
Loading

0 comments on commit 81b90fe

Please sign in to comment.