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

Compliance dashboard does not show the Overall Compliance Trend #138

Closed
ppraghu opened this issue Feb 26, 2019 · 5 comments
Closed

Compliance dashboard does not show the Overall Compliance Trend #138

ppraghu opened this issue Feb 26, 2019 · 5 comments
Labels
duplicate This issue or pull request already exists

Comments

@ppraghu
Copy link

ppraghu commented Feb 26, 2019

Micro services

  • Spring boot Applications:
  • Compliance Service

  • OS Type: Windows/Linux/MacOS

  • Java version:

  • 1.9
  • 1.8
  • 1.7

Summary

In the Compliance landing page of PacBot, the "Overall Compliance Trend" and the "Trend of Number of Policy Violations" show an error message "Uh-oh! Something went wrong while we were fetching your data.".

What I observed in the Firefox browser:

In the browser, these are the API calls that are going and they both show HTTP Code 400:
http://pacbot-xxxxxxx.us-west-2.elb.amazonaws.com/api/compliance/v1/trend/compliance
http://pacbot-xxxxxxx.us-west-2.elb.amazonaws.com/api/compliance/v1/trend/issues
(URL masked for security purposes)

HTTP Params:
ag: aws
from: 2019-1-26
filters {domain Infra & Platforms}

HTTP Response:
timestamp: 2019-02-26T15:14:34.869+0000
status: 400
error : Bad Request
message: JSON parse error: Cannot deserialize value of type java.util.Date from String "2019-1-26": not a valid representation (error: Failed to parse Date value '2019-1-26': Cannot parse date "2019-1-26": while it seems to fit format 'yyyy-MM-dd', parsing fails (leniency? null)); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.util.Date from String "2019-1-26": not a valid representation (error: Failed to parse Date value '2019-1-26': Cannot parse date "2019-1-26": while it seems to fit format 'yyyy-MM-dd', parsing fails (leniency? null)) at [Source: (PushbackInputStream); line: 1, column: 20] (through reference chain: com.tmobile.pacman.api.compliance.domain.CompliantTrendRequest["from"]))
path /api/compliance/v1/trend/compliance

What I saw in the Cloudwatch logs:
In the Cloudwatch events of Compliance API, I see these error messages.

o.s.w.s.m.s.DefaultHandlerExceptionResolver.handleHttpMessageNotReadable - Failed to read HTTP message: org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot deserialize value of type java.util.Date from String "2019-1-26": not a valid representation (error: Failed to parse Date value '2019-1-26': Cannot parse date "2019-1-26": while it seems to fit format 'yyyy-MM-dd', parsing fails (leniency? null)); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type java.util.Date from String "2019-1-26": not a valid representation (error: Failed to parse Date value '2019-1-26': Cannot parse date "2019-1-26": while it seems to fit format 'yyyy-MM-dd', parsing fails (leniency? null))

I do not know why the date "2019-1-26" was used as the "From" date to display the Compliance Trend report. I installed the PacBot afresh yesterday.

Everything else seems to be working, such as "Policy Compliance Overview" and "Overall Compliance" graphics in the "Compliance" landing page.

Reproduce steps

Expected Results

Actual Results

@ppraghu
Copy link
Author

ppraghu commented Feb 26, 2019

Screenshots of the browser and the cloudwatch log attached...

pacbot compliance screenshot

pacbot api cloudwatch logs

@ppraghu
Copy link
Author

ppraghu commented Feb 27, 2019

Additional details:

I tried Postman to submit the POST request to the "/api/compliance/v1/trend/compliance" API with:
(1) The {"ag":"aws","from":"2019-1-26","filters":{"domain":"Infra & Platforms"}} as the POST request payload. I got the same error that I posted in the original issue request.

  1. The same payload as above, except for the "from" field to be "2019-02-26T00:00:00.000". The POST call gave the correct response as expected. This was what I got:
    {"data":{"response":{"ag":"aws","compliance_info":[{"date":"2019-02-26","tagging":5.0,"security":96.0,"overall":87.0,"costOptimization":100.0,"governance":96.0},{"date":"2019-02-27","tagging":5.0,"security":97.0,"overall":88.0,"costOptimization":100.0,"governance":96.0}]}},"message":"success"}

It looks like the Angular Code is not sending the "from" parameter in the ISO 8601 date format yyyy-MM-dd'T'HH:mm:ss.SSS. The Angular code "compliance-overview-trend.component.ts" seems to be generating the "from" string only in the yyyy-MM-dd format which is a different format from the Date parser is expecting. This could be the reason why I am not able to see the "Overall Compliance Trend" and "Trend of Number of Policy Violations" sections.

I am curious to know if others are facing the same problem where they are not able to see the "Overall Compliance Trend" and "Trend of Number of Policy Violations" sections in the Compliance landing page.

I have tried both Firefox and Chrome, and got the same error. Not tried in IE or Microsoft Edge.

@timwea
Copy link

timwea commented Feb 27, 2019

I'm having the same exact issue. Does not work in Safari either.

@santhoshigorle
Copy link
Collaborator

This is due to Date format issue, we will be release fix for this as part PacBot 1.2 release and it's coming soon.

@santhoshigorle santhoshigorle added the duplicate This issue or pull request already exists label Mar 4, 2019
@santhoshigorle
Copy link
Collaborator

PacBot 1.2 version is released. Please check and feel free to re-open if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

3 participants