Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing metrics and make telemetry async #310

Merged
merged 4 commits into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
258 changes: 248 additions & 10 deletions dashboards/grafana-dashboard-exhort.configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,248 @@ data:
"title": "Snyk latency",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 42,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 8,
"y": 17
},
"id": 53,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.90, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"getTrustedContent\"}[2m])))",
"legendFormat": "0.90",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.95, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"getTrustedContent\"}[2m])))",
"hide": false,
"legendFormat": "0.95",
"range": true,
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.99, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"getTrustedContent\"}[2m])))",
"hide": false,
"legendFormat": "0.99",
"range": true,
"refId": "C"
}
],
"title": "Trusted Content latency",
"type": "timeseries"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisCenteredZero": false,
"axisColorMode": "text",
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 42,
"gradientMode": "none",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "none"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
},
{
"color": "red",
"value": 80
}
]
},
"unit": "ms"
},
"overrides": []
},
"gridPos": {
"h": 8,
"w": 8,
"x": 16,
"y": 17
},
"id": 54,
"options": {
"legend": {
"calcs": [],
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "single",
"sort": "none"
}
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.90, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"osvNvdRequest\"}[2m])))",
"legendFormat": "0.90",
"range": true,
"refId": "A"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.95, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"osvNvdRequest\"}[2m])))",
"hide": false,
"legendFormat": "0.95",
"range": true,
"refId": "B"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"editorMode": "code",
"expr": "histogram_quantile(0.99, sum by (le) (rate(camel_route_policy_seconds_bucket{routeId=\"osvNvdRequest\"}[2m])))",
"hide": false,
"legendFormat": "0.99",
"range": true,
"refId": "C"
}
],
"title": "ONGuard latency",
"type": "timeseries"
},
{
"collapsed": true,
"gridPos": {
Expand Down Expand Up @@ -859,8 +1101,7 @@ data:
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "red",
Expand Down Expand Up @@ -969,8 +1210,7 @@ data:
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
},
{
"color": "dark-red",
Expand Down Expand Up @@ -1095,8 +1335,7 @@ data:
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
},
Expand Down Expand Up @@ -1188,8 +1427,7 @@ data:
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
"color": "green"
}
]
},
Expand Down Expand Up @@ -1481,7 +1719,7 @@ data:
"list": [
{
"current": {
"selected": true,
"selected": false,
"text": "appsrep08ue2-prometheus",
"value": "appsrep08ue2-prometheus"
},
Expand Down Expand Up @@ -1581,7 +1819,7 @@ data:
"timezone": "utc",
"title": "Exhort",
"uid": "trusted-content-exhort",
"version": 7,
"version": 8,
"weekStart": ""
}
kind: ConfigMap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,15 @@ public class CustomMetrics {
List.of(
"snykValidateToken",
"snykRequest",
"getTrustedContent",
"osvNvdRequest",
"ossValidateCredentials",
"ossSplitReq",
"ossIndexRequest",
"gavRequest",
"vexRequest");
"analyticsIdentify",
"analyticsTrackAnalysis",
"analyticsTrackToken",
"processFailedRequests");

@Produces
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@

import org.apache.camel.Body;
import org.apache.camel.Exchange;
import org.apache.camel.ExchangePattern;
import org.apache.camel.ExchangeProperty;
import org.apache.camel.LoggingLevel;
import org.apache.camel.WaitForTaskToComplete;
import org.apache.camel.builder.AggregationStrategies;
import org.apache.camel.builder.endpoint.EndpointRouteBuilder;
import org.apache.camel.component.micrometer.MicrometerConstants;
Expand Down Expand Up @@ -202,7 +204,7 @@ public void configure() {

from(direct("postProcessAnalysisRequest"))
.routeId("postProcessAnalysisRequest")
.to(seda("analyticsTrackAnalysis"))
.to(seda("analyticsTrackAnalysis").waitForTaskToComplete(WaitForTaskToComplete.Never))
.setHeader(Constants.EXHORT_REQUEST_ID_HEADER, exchangeProperty(Constants.EXHORT_REQUEST_ID_HEADER))
.choice()
.when(exchangeProperty(Constants.GZIP_RESPONSE_PROPERTY).isNotNull()).marshal().gzipDeflater()
Expand Down Expand Up @@ -233,20 +235,24 @@ public void configure() {
.setBody(constant("Missing provider authentication headers"))
.end()
.setHeader(Exchange.CONTENT_TYPE, constant(MediaType.TEXT_PLAIN))
.to(seda("analyticsTrackToken"))
.to(seda("analyticsTrackToken").waitForTaskToComplete(WaitForTaskToComplete.Never))
.setHeader(Constants.EXHORT_REQUEST_ID_HEADER, exchangeProperty(Constants.EXHORT_REQUEST_ID_HEADER))
.process(this::cleanUpHeaders);

from(seda("analyticsIdentify"))
.routeId("analyticsIdentify")
.process(monitoringProcessor::processOriginalRequest)
.to(seda("analyticsAsyncIdentify").waitForTaskToComplete(WaitForTaskToComplete.Never));

from(seda("analyticsAsyncIdentify")).setExchangePattern(ExchangePattern.InOnly)
.routeId("analyticsAsyncIdentify")
.process(analytics::identify);

from(seda("analyticsTrackToken"))
from(seda("analyticsTrackToken")).setExchangePattern(ExchangePattern.InOnly)
.routeId("analyticsTrackToken")
.process(analytics::trackToken);

from(seda("analyticsTrackAnalysis"))
from(seda("analyticsTrackAnalysis")).setExchangePattern(ExchangePattern.InOnly)
.routeId("analyticsTrackAnalysis")
.process(analytics::trackAnalysis);

Expand Down
Loading
Loading