• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

supabase / auth / 9112884321
69%

Build:
DEFAULT BRANCH: master
Ran 16 May 2024 01:13PM UTC
Jobs 1
Files 117
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

16 May 2024 01:08PM UTC coverage: 65.836% (+0.4%) from 65.47%
9112884321

push

github

web-flow
fix: improve logging structure (#1583)

## What kind of change does this PR introduce?
* Remove unformatted logs which do not confirm to JSON
* Previously, we were logging both `time` (not UTC) and `timestamp` (in
UTC) which is redundant. I've opted to remove `timestamp` and just log
the UTC time as the `time` field, which is supported by logrus
* Previously, the `request_id` was not being logged because it was
unable to retrieve the context properly. Now, the `request_id` field is
added to every log entry, which allows us to filter by `request_id` to
see the entire lifecycle of the request
* Previously, panics weren't being handled properly and they were just
logged as text instead of JSON. The server would return an empty reply,
which leads to ugly responses like "Unexpected token < in JSON..." if
using fetch in JS. Now, the server returns a proper 500 error response:
`{"code":500,"error_code":"unexpected_failure","msg":"Internal Server
Error"}`
* Added tests for `recoverer` and `NewStructuredLogger` to prevent
regression
* Remove "request started" log since the `request_id` can be used to
keep track of the entire request lifecycle. This cuts down on the noise
to signal ratio as well.


## Log format
* Panics are now logged like this (note the additional fields like
`panic` and `stack` - which is a dump of the stack trace):
```json
{
  "component":"api",
  "duration":6065700500,
  "level":"info",
  "method":"GET",
  "msg":"request completed",
  "panic":"test panic",
  "path":"/panic",
  "referer":"http://localhost:3001",
  "remote_addr":"127.0.0.1",
  "request_id":"4cde5f20-2c3c-4645-bc75-52d6231e22e2",
  "stack":"goroutine 82 [running]:...rest of stack trace omitted for brevity",
  "status":500,
  "time":"2024-05-15T09:37:42Z"
}
```

* Requests that call `NewAuditLogEntry` will be logged with the
`auth_event` payload in this format (note that the timestamp field no
longer exists)
```json
{
  "auth_eve... (continued)

98 of 111 new or added lines in 14 files covered. (88.29%)

7 existing lines in 3 files now uncovered.

8423 of 12794 relevant lines covered (65.84%)

64.35 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
1
73.4
1.53% internal/api/auth.go
1
4.31
0.0% internal/api/samlacs.go
1
73.86
0.0% internal/api/token.go
2
84.17
0.0% internal/api/middleware.go
2
0.0
0.0% internal/api/token_oidc.go
3
70.35
5.2% internal/api/errors.go
3
75.0
internal/utilities/context.go

Uncovered Existing Lines

Lines Coverage ∆ File
1
86.28
-0.24% internal/api/api.go
3
45.45
-9.09% internal/hooks/auth_hooks.go
3
45.59
-4.41% internal/models/errors.go
Jobs
ID Job ID Ran Files Coverage
1 9112884321.1 16 May 2024 01:13PM UTC 117
65.84
GitHub Action Run
Source Files on build 9112884321
  • Tree
  • List 117
  • Changed 19
  • Source Changed 0
  • Coverage Changed 9
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • c22fc15d on github
  • Prev Build on master (#9065702589)
  • Next Build on master (#9124532276)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc