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.
|
||||
|
||||
## [1.1.1] - 2023-01-xx
|
||||
## [1.1.1] - 2023-01-22
|
||||
- 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
|
||||
- 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
|
||||
- Updated 3rd party dependencies.
|
||||
|
||||
<!--
|
||||
[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.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.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
|
||||
-->
|
||||
|
|
|
@ -85,7 +85,7 @@ public class Application implements Callable<Integer> {
|
|||
try {
|
||||
configuration.parse(configurationFile.toPath());
|
||||
} catch (Exception e) {
|
||||
System.err.println(e.getMessage());
|
||||
System.err.println("Could not parse configuration file: " + e.getMessage());
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -62,6 +62,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
|||
}
|
||||
|
||||
from("seda:metrics?purgeWhenStopping=true")
|
||||
.routeId("aggregation")
|
||||
.aggregate(constant(true), AggregationStrategies.beanAllowNull(ComboAppender.class, "append"))
|
||||
.completionTimeout(5000L)
|
||||
.doTry()
|
||||
|
@ -72,6 +73,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
|||
.end();
|
||||
|
||||
from("seda:outbound?purgeWhenStopping=true")
|
||||
.routeId("outbound")
|
||||
.setHeader(Exchange.HTTP_METHOD, constant("POST"))
|
||||
.doTry()
|
||||
.marshal(new JacksonDataFormat(ComboResult.class))
|
||||
|
@ -108,6 +110,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
|||
Registry registry = getContext().getRegistry();
|
||||
|
||||
from("timer:scripts?fixedRate=true&period=30s")
|
||||
.routeId(script.toString())
|
||||
.bean(script, "run")
|
||||
.outputType(MetricResult.class)
|
||||
.process(new MetricEnrichProcessor(registry))
|
||||
|
@ -129,6 +132,7 @@ public class ClientRouteBuilder extends RouteBuilder {
|
|||
String timerName = ext.isThreaded() ? ext.getName() : "default";
|
||||
String timerInterval = (ext.getInterval() != null) ? ext.getInterval() : "30s";
|
||||
from("timer:" + timerName + "?fixedRate=true&period=" + timerInterval)
|
||||
.routeId(ext.getName())
|
||||
.bean(ext, "getMetrics")
|
||||
.outputType(MetricResult.class)
|
||||
.process(new MetricEnrichProcessor(registry))
|
||||
|
|
|
@ -67,6 +67,10 @@ public final class Configuration {
|
|||
|
||||
|
||||
String getScriptPath() {
|
||||
if(result == null) {
|
||||
log.debug("No configuration file loaded ...");
|
||||
return null;
|
||||
}
|
||||
return result.getString("scripts");
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,10 @@ public class ScriptWrapper {
|
|||
private final static GroovyClassLoader loader = new GroovyClassLoader();
|
||||
|
||||
private GroovyObject script;
|
||||
private final String name;
|
||||
|
||||
public ScriptWrapper(String scriptPath, String scriptFile) {
|
||||
name = scriptFile;
|
||||
try {
|
||||
Class<?> scriptClass = loader.parseClass(new File(scriptPath, scriptFile));
|
||||
script = (GroovyObject) scriptClass.getDeclaredConstructor().newInstance();
|
||||
|
@ -37,5 +39,9 @@ public class ScriptWrapper {
|
|||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
version = 1.1.0
|
||||
version = 1.1.1
|
||||
pf4jVersion = 3.7.0
|
||||
slf4jVersion = 2.0.6
|
||||
camelVersion = 3.14.7
|
||||
|
|
|
@ -21,15 +21,6 @@ public class ServerRouteBuilder extends RouteBuilder {
|
|||
.host(registry.lookupByNameAndType("http.host", String.class))
|
||||
.port(registry.lookupByNameAndType("http.port", Integer.class));
|
||||
|
||||
/*
|
||||
rest()
|
||||
.get("/")
|
||||
.produces("text/html")
|
||||
.route()
|
||||
.to("log:stdout")
|
||||
.endRest();
|
||||
*/
|
||||
|
||||
rest()
|
||||
.post("/metrics")
|
||||
.consumes("application/json")
|
||||
|
|
Loading…
Reference in a new issue