Skip to content

Commit

Permalink
chore: update segment data model
Browse files Browse the repository at this point in the history
Signed-off-by: Ruben Romero Montes <[email protected]>
  • Loading branch information
ruromero committed Sep 11, 2023
1 parent 88acfbc commit 7f2ee0a
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/main/java/com/redhat/exhort/analytics/AnalyticsService.java
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,18 @@ public void trackAnalysis(Exchange exchange) {
if (report != null) {
Map<String, Object> providers = new HashMap<>();
Map<String, Object> 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<String, Object> 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());
Expand Down

0 comments on commit 7f2ee0a

Please sign in to comment.