Set ID of routes and fix bug when no configuration file is found.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
ebd058a433
commit
186d678861
|
@ -2,9 +2,10 @@
|
||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
## [1.1.1] - 2023-01-xx
|
## [1.1.1] - 2023-01-22
|
||||||
- Simplify plugin naming
|
- Simplify plugin naming
|
||||||
- Initial support for calling (groovy) scripts
|
- Initial support for executing (groovy) scripts
|
||||||
|
- Fixed bug when no config file were found
|
||||||
|
|
||||||
## [1.1.0] - 2022-12-17
|
## [1.1.0] - 2022-12-17
|
||||||
- Lower influx time precision from milliseconds to seconds
|
- Lower influx time precision from milliseconds to seconds
|
||||||
|
@ -50,6 +51,7 @@ All notable changes to this project will be documented in this file.
|
||||||
### Changed
|
### Changed
|
||||||
- Updated 3rd party dependencies.
|
- Updated 3rd party dependencies.
|
||||||
|
|
||||||
|
<!--
|
||||||
[1.1.0]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.1.0%0Dv0.1.24
|
[1.1.0]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.1.0%0Dv0.1.24
|
||||||
[1.0.24]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.24%0Dv0.1.23
|
[1.0.24]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.24%0Dv0.1.23
|
||||||
[1.0.23]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.23%0Dv0.1.21
|
[1.0.23]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v1.0.23%0Dv0.1.21
|
||||||
|
@ -59,3 +61,4 @@ All notable changes to this project will be documented in this file.
|
||||||
[0.1.11]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.11%0Dv0.1.10
|
[0.1.11]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.11%0Dv0.1.10
|
||||||
[0.1.10]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.10%0Dv0.1.9
|
[0.1.10]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.10%0Dv0.1.9
|
||||||
[0.1.9]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.9%0Dv0.1.8
|
[0.1.9]: https://bitbucket.org/mnellemann/sysmon/branches/compare/v0.1.9%0Dv0.1.8
|
||||||
|
-->
|
||||||
|
|
|
@ -85,7 +85,7 @@ public class Application implements Callable<Integer> {
|
||||||
try {
|
try {
|
||||||
configuration.parse(configurationFile.toPath());
|
configuration.parse(configurationFile.toPath());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.err.println(e.getMessage());
|
System.err.println("Could not parse configuration file: " + e.getMessage());
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,6 +62,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
from("seda:metrics?purgeWhenStopping=true")
|
from("seda:metrics?purgeWhenStopping=true")
|
||||||
|
.routeId("aggregation")
|
||||||
.aggregate(constant(true), AggregationStrategies.beanAllowNull(ComboAppender.class, "append"))
|
.aggregate(constant(true), AggregationStrategies.beanAllowNull(ComboAppender.class, "append"))
|
||||||
.completionTimeout(5000L)
|
.completionTimeout(5000L)
|
||||||
.doTry()
|
.doTry()
|
||||||
|
@ -72,6 +73,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
||||||
.end();
|
.end();
|
||||||
|
|
||||||
from("seda:outbound?purgeWhenStopping=true")
|
from("seda:outbound?purgeWhenStopping=true")
|
||||||
|
.routeId("outbound")
|
||||||
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
|
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
|
||||||
.doTry()
|
.doTry()
|
||||||
.marshal(new JacksonDataFormat(ComboResult.class))
|
.marshal(new JacksonDataFormat(ComboResult.class))
|
||||||
|
@ -108,6 +110,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
||||||
Registry registry = getContext().getRegistry();
|
Registry registry = getContext().getRegistry();
|
||||||
|
|
||||||
from("timer:scripts?fixedRate=true&period=30s")
|
from("timer:scripts?fixedRate=true&period=30s")
|
||||||
|
.routeId(script.toString())
|
||||||
.bean(script, "run")
|
.bean(script, "run")
|
||||||
.outputType(MetricResult.class)
|
.outputType(MetricResult.class)
|
||||||
.process(new MetricEnrichProcessor(registry))
|
.process(new MetricEnrichProcessor(registry))
|
||||||
|
@ -129,6 +132,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
||||||
String timerName = ext.isThreaded() ? ext.getName() : "default";
|
String timerName = ext.isThreaded() ? ext.getName() : "default";
|
||||||
String timerInterval = (ext.getInterval() != null) ? ext.getInterval() : "30s";
|
String timerInterval = (ext.getInterval() != null) ? ext.getInterval() : "30s";
|
||||||
from("timer:" + timerName + "?fixedRate=true&period=" + timerInterval)
|
from("timer:" + timerName + "?fixedRate=true&period=" + timerInterval)
|
||||||
|
.routeId(ext.getName())
|
||||||
.bean(ext, "getMetrics")
|
.bean(ext, "getMetrics")
|
||||||
.outputType(MetricResult.class)
|
.outputType(MetricResult.class)
|
||||||
.process(new MetricEnrichProcessor(registry))
|
.process(new MetricEnrichProcessor(registry))
|
||||||
|
|
|
@ -67,6 +67,10 @@ public final class Configuration {
|
||||||
|
|
||||||
|
|
||||||
String getScriptPath() {
|
String getScriptPath() {
|
||||||
|
if(result == null) {
|
||||||
|
log.debug("No configuration file loaded ...");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return result.getString("scripts");
|
return result.getString("scripts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,10 @@ public class ScriptWrapper {
|
||||||
private final static GroovyClassLoader loader = new GroovyClassLoader();
|
private final static GroovyClassLoader loader = new GroovyClassLoader();
|
||||||
|
|
||||||
private GroovyObject script;
|
private GroovyObject script;
|
||||||
|
private final String name;
|
||||||
|
|
||||||
public ScriptWrapper(String scriptPath, String scriptFile) {
|
public ScriptWrapper(String scriptPath, String scriptFile) {
|
||||||
|
name = scriptFile;
|
||||||
try {
|
try {
|
||||||
Class<?> scriptClass = loader.parseClass(new File(scriptPath, scriptFile));
|
Class<?> scriptClass = loader.parseClass(new File(scriptPath, scriptFile));
|
||||||
script = (GroovyObject) scriptClass.getDeclaredConstructor().newInstance();
|
script = (GroovyObject) scriptClass.getDeclaredConstructor().newInstance();
|
||||||
|
@ -37,5 +39,9 @@ public class ScriptWrapper {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version = 1.1.0
|
version = 1.1.1
|
||||||
pf4jVersion = 3.7.0
|
pf4jVersion = 3.7.0
|
||||||
slf4jVersion = 2.0.6
|
slf4jVersion = 2.0.6
|
||||||
camelVersion = 3.14.7
|
camelVersion = 3.14.7
|
||||||
|
|
|
@ -21,15 +21,6 @@ public class ServerRouteBuilder extends RouteBuilder {
|
||||||
.host(registry.lookupByNameAndType("http.host", String.class))
|
.host(registry.lookupByNameAndType("http.host", String.class))
|
||||||
.port(registry.lookupByNameAndType("http.port", Integer.class));
|
.port(registry.lookupByNameAndType("http.port", Integer.class));
|
||||||
|
|
||||||
/*
|
|
||||||
rest()
|
|
||||||
.get("/")
|
|
||||||
.produces("text/html")
|
|
||||||
.route()
|
|
||||||
.to("log:stdout")
|
|
||||||
.endRest();
|
|
||||||
*/
|
|
||||||
|
|
||||||
rest()
|
rest()
|
||||||
.post("/metrics")
|
.post("/metrics")
|
||||||
.consumes("application/json")
|
.consumes("application/json")
|
||||||
|
|
Loading…
Reference in a new issue