Skip to content

Commit 15c5ded

Browse files
authored
fix: add missing metrics and make telemetry async (#310)
* fix: add missing metrics and make telemetry async Signed-off-by: Ruben Romero Montes <[email protected]> * fix: disable provider healtchecks Signed-off-by: Ruben Romero Montes <[email protected]> * chore: add onguard and trustedcontent to the dashboard Signed-off-by: Ruben Romero Montes <[email protected]> * fix: send monitoring events encoded in Base64 Signed-off-by: Ruben Romero Montes <[email protected]> --------- Signed-off-by: Ruben Romero Montes <[email protected]>
1 parent c469d31 commit 15c5ded

File tree

10 files changed

+313
-59
lines changed

10 files changed

+313
-59
lines changed

dashboards/grafana-dashboard-exhort.configmap.yaml

Lines changed: 248 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,248 @@ data:
800800
"title": "Snyk latency",
801801
"type": "timeseries"
802802
},
803+
{
804+
"datasource": {
805+
"type": "prometheus",
806+
"uid": "${datasource}"
807+
},
808+
"description": "",
809+
"fieldConfig": {
810+
"defaults": {
811+
"color": {
812+
"mode": "palette-classic"
813+
},
814+
"custom": {
815+
"axisCenteredZero": false,
816+
"axisColorMode": "text",
817+
"axisLabel": "",
818+
"axisPlacement": "auto",
819+
"barAlignment": 0,
820+
"drawStyle": "line",
821+
"fillOpacity": 42,
822+
"gradientMode": "none",
823+
"hideFrom": {
824+
"legend": false,
825+
"tooltip": false,
826+
"viz": false
827+
},
828+
"lineInterpolation": "smooth",
829+
"lineStyle": {
830+
"fill": "solid"
831+
},
832+
"lineWidth": 2,
833+
"pointSize": 5,
834+
"scaleDistribution": {
835+
"type": "linear"
836+
},
837+
"showPoints": "never",
838+
"spanNulls": false,
839+
"stacking": {
840+
"group": "A",
841+
"mode": "none"
842+
},
843+
"thresholdsStyle": {
844+
"mode": "off"
845+
}
846+
},
847+
"mappings": [],
848+
"thresholds": {
849+
"mode": "absolute",
850+
"steps": [
851+
{
852+
"color": "green",
853+
"value": null
854+
},
855+
{
856+
"color": "red",
857+
"value": 80
858+
}
859+
]
860+
},
861+
"unit": "ms"
862+
},
863+
"overrides": []
864+
},
865+
"gridPos": {
866+
"h": 8,
867+
"w": 8,
868+
"x": 8,
869+
"y": 17
870+
},
871+
"id": 53,
872+
"options": {
873+
"legend": {
874+
"calcs": [],
875+
"displayMode": "list",
876+
"placement": "bottom",
877+
"showLegend": true
878+
},
879+
"tooltip": {
880+
"mode": "single",
881+
"sort": "none"
882+
}
883+
},
884+
"targets": [
885+
{
886+
"datasource": {
887+
"type": "prometheus",
888+
"uid": "${datasource}"
889+
},
890+
"editorMode": "code",
891+
"expr": "histogram_quantile(0.90, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"getTrustedContent\"}[2m])))",
892+
"legendFormat": "0.90",
893+
"range": true,
894+
"refId": "A"
895+
},
896+
{
897+
"datasource": {
898+
"type": "prometheus",
899+
"uid": "${datasource}"
900+
},
901+
"editorMode": "code",
902+
"expr": "histogram_quantile(0.95, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"getTrustedContent\"}[2m])))",
903+
"hide": false,
904+
"legendFormat": "0.95",
905+
"range": true,
906+
"refId": "B"
907+
},
908+
{
909+
"datasource": {
910+
"type": "prometheus",
911+
"uid": "${datasource}"
912+
},
913+
"editorMode": "code",
914+
"expr": "histogram_quantile(0.99, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"getTrustedContent\"}[2m])))",
915+
"hide": false,
916+
"legendFormat": "0.99",
917+
"range": true,
918+
"refId": "C"
919+
}
920+
],
921+
"title": "Trusted Content latency",
922+
"type": "timeseries"
923+
},
924+
{
925+
"datasource": {
926+
"type": "prometheus",
927+
"uid": "${datasource}"
928+
},
929+
"description": "",
930+
"fieldConfig": {
931+
"defaults": {
932+
"color": {
933+
"mode": "palette-classic"
934+
},
935+
"custom": {
936+
"axisCenteredZero": false,
937+
"axisColorMode": "text",
938+
"axisLabel": "",
939+
"axisPlacement": "auto",
940+
"barAlignment": 0,
941+
"drawStyle": "line",
942+
"fillOpacity": 42,
943+
"gradientMode": "none",
944+
"hideFrom": {
945+
"legend": false,
946+
"tooltip": false,
947+
"viz": false
948+
},
949+
"lineInterpolation": "smooth",
950+
"lineStyle": {
951+
"fill": "solid"
952+
},
953+
"lineWidth": 2,
954+
"pointSize": 5,
955+
"scaleDistribution": {
956+
"type": "linear"
957+
},
958+
"showPoints": "never",
959+
"spanNulls": false,
960+
"stacking": {
961+
"group": "A",
962+
"mode": "none"
963+
},
964+
"thresholdsStyle": {
965+
"mode": "off"
966+
}
967+
},
968+
"mappings": [],
969+
"thresholds": {
970+
"mode": "absolute",
971+
"steps": [
972+
{
973+
"color": "green",
974+
"value": null
975+
},
976+
{
977+
"color": "red",
978+
"value": 80
979+
}
980+
]
981+
},
982+
"unit": "ms"
983+
},
984+
"overrides": []
985+
},
986+
"gridPos": {
987+
"h": 8,
988+
"w": 8,
989+
"x": 16,
990+
"y": 17
991+
},
992+
"id": 54,
993+
"options": {
994+
"legend": {
995+
"calcs": [],
996+
"displayMode": "list",
997+
"placement": "bottom",
998+
"showLegend": true
999+
},
1000+
"tooltip": {
1001+
"mode": "single",
1002+
"sort": "none"
1003+
}
1004+
},
1005+
"targets": [
1006+
{
1007+
"datasource": {
1008+
"type": "prometheus",
1009+
"uid": "${datasource}"
1010+
},
1011+
"editorMode": "code",
1012+
"expr": "histogram_quantile(0.90, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"osvNvdRequest\"}[2m])))",
1013+
"legendFormat": "0.90",
1014+
"range": true,
1015+
"refId": "A"
1016+
},
1017+
{
1018+
"datasource": {
1019+
"type": "prometheus",
1020+
"uid": "${datasource}"
1021+
},
1022+
"editorMode": "code",
1023+
"expr": "histogram_quantile(0.95, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"osvNvdRequest\"}[2m])))",
1024+
"hide": false,
1025+
"legendFormat": "0.95",
1026+
"range": true,
1027+
"refId": "B"
1028+
},
1029+
{
1030+
"datasource": {
1031+
"type": "prometheus",
1032+
"uid": "${datasource}"
1033+
},
1034+
"editorMode": "code",
1035+
"expr": "histogram_quantile(0.99, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"osvNvdRequest\"}[2m])))",
1036+
"hide": false,
1037+
"legendFormat": "0.99",
1038+
"range": true,
1039+
"refId": "C"
1040+
}
1041+
],
1042+
"title": "ONGuard latency",
1043+
"type": "timeseries"
1044+
},
8031045
{
8041046
"collapsed": true,
8051047
"gridPos": {
@@ -859,8 +1101,7 @@ data:
8591101
"mode": "absolute",
8601102
"steps": [
8611103
{
862-
"color": "green",
863-
"value": null
1104+
"color": "green"
8641105
},
8651106
{
8661107
"color": "red",
@@ -969,8 +1210,7 @@ data:
9691210
"mode": "absolute",
9701211
"steps": [
9711212
{
972-
"color": "green",
973-
"value": null
1213+
"color": "green"
9741214
},
9751215
{
9761216
"color": "dark-red",
@@ -1095,8 +1335,7 @@ data:
10951335
"mode": "absolute",
10961336
"steps": [
10971337
{
1098-
"color": "green",
1099-
"value": null
1338+
"color": "green"
11001339
}
11011340
]
11021341
},
@@ -1188,8 +1427,7 @@ data:
11881427
"mode": "absolute",
11891428
"steps": [
11901429
{
1191-
"color": "green",
1192-
"value": null
1430+
"color": "green"
11931431
}
11941432
]
11951433
},
@@ -1481,7 +1719,7 @@ data:
14811719
"list": [
14821720
{
14831721
"current": {
1484-
"selected": true,
1722+
"selected": false,
14851723
"text": "appsrep08ue2-prometheus",
14861724
"value": "appsrep08ue2-prometheus"
14871725
},
@@ -1581,7 +1819,7 @@ data:
15811819
"timezone": "utc",
15821820
"title": "Exhort",
15831821
"uid": "trusted-content-exhort",
1584-
"version": 7,
1822+
"version": 8,
15851823
"weekStart": ""
15861824
}
15871825
kind: ConfigMap

src/main/java/com/redhat/exhort/config/metrics/CustomMetrics.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ public class CustomMetrics {
4141
List.of(
4242
"snykValidateToken",
4343
"snykRequest",
44+
"getTrustedContent",
45+
"osvNvdRequest",
4446
"ossValidateCredentials",
4547
"ossSplitReq",
4648
"ossIndexRequest",
47-
"gavRequest",
48-
"vexRequest");
49+
"analyticsIdentify",
50+
"analyticsTrackAnalysis",
51+
"analyticsTrackToken",
52+
"processFailedRequests");
4953

5054
@Produces
5155
@Singleton

src/main/java/com/redhat/exhort/integration/backend/ExhortIntegration.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@
3535

3636
import org.apache.camel.Body;
3737
import org.apache.camel.Exchange;
38+
import org.apache.camel.ExchangePattern;
3839
import org.apache.camel.ExchangeProperty;
3940
import org.apache.camel.LoggingLevel;
41+
import org.apache.camel.WaitForTaskToComplete;
4042
import org.apache.camel.builder.AggregationStrategies;
4143
import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
4244
import org.apache.camel.component.micrometer.MicrometerConstants;
@@ -202,7 +204,7 @@ public void configure() {
202204

203205
from(direct("postProcessAnalysisRequest"))
204206
.routeId("postProcessAnalysisRequest")
205-
.to(seda("analyticsTrackAnalysis"))
207+
.to(seda("analyticsTrackAnalysis").waitForTaskToComplete(WaitForTaskToComplete.Never))
206208
.setHeader(Constants.EXHORT_REQUEST_ID_HEADER, exchangeProperty(Constants.EXHORT_REQUEST_ID_HEADER))
207209
.choice()
208210
.when(exchangeProperty(Constants.GZIP_RESPONSE_PROPERTY).isNotNull()).marshal().gzipDeflater()
@@ -233,20 +235,24 @@ public void configure() {
233235
.setBody(constant("Missing provider authentication headers"))
234236
.end()
235237
.setHeader(Exchange.CONTENT_TYPE, constant(MediaType.TEXT_PLAIN))
236-
.to(seda("analyticsTrackToken"))
238+
.to(seda("analyticsTrackToken").waitForTaskToComplete(WaitForTaskToComplete.Never))
237239
.setHeader(Constants.EXHORT_REQUEST_ID_HEADER, exchangeProperty(Constants.EXHORT_REQUEST_ID_HEADER))
238240
.process(this::cleanUpHeaders);
239241

240242
from(seda("analyticsIdentify"))
241243
.routeId("analyticsIdentify")
242244
.process(monitoringProcessor::processOriginalRequest)
245+
.to(seda("analyticsAsyncIdentify").waitForTaskToComplete(WaitForTaskToComplete.Never));
246+
247+
from(seda("analyticsAsyncIdentify")).setExchangePattern(ExchangePattern.InOnly)
248+
.routeId("analyticsAsyncIdentify")
243249
.process(analytics::identify);
244250

245-
from(seda("analyticsTrackToken"))
251+
from(seda("analyticsTrackToken")).setExchangePattern(ExchangePattern.InOnly)
246252
.routeId("analyticsTrackToken")
247253
.process(analytics::trackToken);
248254

249-
from(seda("analyticsTrackAnalysis"))
255+
from(seda("analyticsTrackAnalysis")).setExchangePattern(ExchangePattern.InOnly)
250256
.routeId("analyticsTrackAnalysis")
251257
.process(analytics::trackAnalysis);
252258

0 commit comments

Comments
 (0)