From 7f2ee0a89f493ab0cd11f6c17eec82db136eaf46 Mon Sep 17 00:00:00 2001 From: Ruben Romero Montes Date: Mon, 11 Sep 2023 08:57:24 +0200 Subject: [PATCH] chore: update segment data model Signed-off-by: Ruben Romero Montes --- .../redhat/exhort/analytics/AnalyticsService.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/redhat/exhort/analytics/AnalyticsService.java b/src/main/java/com/redhat/exhort/analytics/AnalyticsService.java index 0f0fcf62..a86ee352 100644 --- a/src/main/java/com/redhat/exhort/analytics/AnalyticsService.java +++ b/src/main/java/com/redhat/exhort/analytics/AnalyticsService.java @@ -120,17 +120,18 @@ public void trackAnalysis(Exchange exchange) { if (report != null) { Map providers = new HashMap<>(); Map reportProps = new HashMap<>(); + properties.put( + "requestType", exchange.getProperty(Constants.REQUEST_CONTENT_PROPERTY, String.class)); + properties.put("sbom", exchange.getProperty(Constants.SBOM_TYPE_PARAM, String.class)); // TODO: Adapt after multi-source is implemented + Map snykReport = new HashMap<>(); reportProps.put("dependencies", report.getSummary().getDependencies()); reportProps.put("vulnerabilities", report.getSummary().getVulnerabilities()); - providers.put("report", reportProps); - providers.put("provider", Constants.SNYK_PROVIDER); - providers.put("recommendations", countRecommendations(report)); - providers.put("remediations", countRemediations(report)); - properties.put( - "requestType", exchange.getProperty(Constants.REQUEST_CONTENT_PROPERTY, String.class)); + snykReport.put("report", reportProps); + snykReport.put("recommendations", countRecommendations(report)); + snykReport.put("remediations", countRemediations(report)); + providers.put(Constants.SNYK_PROVIDER, snykReport); properties.put("providers", providers); - properties.put("sbom", exchange.getProperty(Constants.SBOM_TYPE_PARAM, String.class)); } try { Response response = segmentService.track(builder.properties(properties).build());