monasca-docker icon indicating copy to clipboard operation
monasca-docker copied to clipboard

Additional log upload improvements

Open timothyb89 opened this issue 8 years ago • 5 comments

#211 adds log uploads to a GCS bucket. We can make a few more small improvements that would improve quality of life a lot:

  • [x] Compress (gzip) logs over a certain size, say 1 KiB. Files should be named .log.gz versus .log and have their Content-Encoding set to gzip.
  • [ ] CI should post a comment on the PR that shows log status and links to files
  • [ ] Add a small dashboard for each run using the manifest file. We could provide some basic info about the build and link directly to each container log.
  • [ ] Look at including docker's json logs as well. They include timestamps and the stream name for each message so we could have a nice preview in the browser.

timothyb89 avatar Sep 18 '17 16:09 timothyb89

  • [x] An easier way to get timestamps in logs: add -t to the docker logs call

timothyb89 avatar Sep 18 '17 17:09 timothyb89

See https://github.com/monasca/monasca-docker/pull/211/commits/72e5ee14cdc7021fe41b57e9c610bf10bb6da832 for compress and timestamp fixes

aadams19 avatar Sep 18 '17 19:09 aadams19

@aadams19 do you want to implement all those points in #211 ?

kornicameister avatar Sep 19 '17 05:09 kornicameister

No, our plan is just do those two changes in https://github.com/monasca/monasca-docker/commit/72e5ee14cdc7021fe41b57e9c610bf10bb6da832 for now since they were fairly simple changes with high rewards. The rest we will have to revisit sometime in the future

aadams19 avatar Sep 19 '17 15:09 aadams19

So it looks like we failed to account for situations where secure environment variables aren't available, that is, any PR from a branch that isn't this repo (i.e. a fork, where most PRs should come from). For example: https://travis-ci.org/monasca/monasca-docker/jobs/277478462#L649

Turns out this is a fairly significant issue (really always the case with 3rd party CI). I think the quick solution is:

  • Use travis's JWT addon: https://docs.travis-ci.com/user/jwt
  • Make a tiny log ingester on Cloud Functions to take 1+ logs and a JWT. Post logs to that endpoint instead of uploading to GCS directly.

...that said, short term we can just print out the logs when secure vars aren't available.

timothyb89 avatar Sep 19 '17 21:09 timothyb89