I am unsure what I did wrong... but I could not get it to work.
I created a new project and imported the two microservices in my project. Renamed the namespaces and they compile.
In the MetricMonitorService, instead of using app config, I changed it to use the threshold document as follows:
/**
The threshold document to read to generate alerts
*/
expression $thresholdDocument : getSubmissionTimeValue("thresholdDocument", "");
/**
The MetricsMonitor compares the metric tuple's values against the threshold rules
defined in the application configuration's thresholdDocument property. It outputs
an alert whenever any threshold rules are violated.
*/
stream AlertMessage = MetricsMonitor(Metrics) {
param
// applicationConfigurationName : $applicationConfigurationName ;
thresholdDocumentPath: $thresholdDocument;
}
At submission time, I specified "etc/threshold.json" as the submission parameter.
I made sure that the threshold.json document is in the etc directory. I also added the etc resources to be packaged as part of the bundle. I checked that the bundle has the etc/threshold.json using spl-app-info.
When I run the application, I can never get any alert generated. In addition, I have the following errors:
The documentation does not indicate if I have a relative path, what it is relative to. Looking at the code, I assume it's the root directory of the application.
I am unsure what I did wrong... but I could not get it to work.
I created a new project and imported the two microservices in my project. Renamed the namespaces and they compile.
In the MetricMonitorService, instead of using app config, I changed it to use the threshold document as follows:
/**
expression
/**
At submission time, I specified "etc/threshold.json" as the submission parameter.
I made sure that the threshold.json document is in the etc directory. I also added the etc resources to be packaged as part of the bundle. I checked that the bundle has the etc/threshold.json using spl-app-info.
When I run the application, I can never get any alert generated. In addition, I have the following errors:
04 Dec 2017 13:18:36.192 [4543] ERROR #splapptrc,J[36],P[36],AlertMessage M[MetricsMonitor.java:com.ibm.streamsx.monitoring.metrics.MetricsMonitor.processPunctuation:285] - java.io.IOException: File thresholdDocument parse error: java.nio.file.NoSuchFileException: etc/threshold.json
The documentation does not indicate if I have a relative path, what it is relative to. Looking at the code, I assume it's the root directory of the application.