Skip to content

Commit 28ec75f

Browse files
authored
Merge pull request #8 from Cervest/log-principal
Log principal
2 parents 2826bf1 + bf18b0b commit 28ec75f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/api.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010

1111
type session struct {
1212
Catalog string
13+
Principal string
1314
User string
1415
UserAgent string
1516
}
@@ -32,6 +33,7 @@ type QueryInfo struct {
3233
Catalog string
3334
CreateTime time.Time
3435
DurationMs int64
36+
Principal string
3537
QueryId string
3638
QuerySizeBytes int
3739
QueryType string
@@ -82,6 +84,7 @@ func FetchQueryInfo() ([]QueryInfo, error) {
8284
Catalog: q.Session.Catalog,
8385
CreateTime: q.QueryStats.CreateTime,
8486
DurationMs: q.QueryStats.EndTime.Sub(q.QueryStats.CreateTime).Milliseconds(),
87+
Principal: q.Session.Principal,
8588
QueryId: q.QueryId,
8689
QuerySizeBytes: len(q.Query),
8790
QueryType: q.QueryType,

src/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ func metricsHandler(w http.ResponseWriter, r *http.Request) {
2828
Str("catalog", q.Catalog).
2929
Int64("duration_ms", q.DurationMs).
3030
Str("id", q.QueryId).
31+
Str("principal", q.Principal).
3132
Time("query_time", q.CreateTime).
3233
Int("size_bytes", q.QuerySizeBytes).
3334
Str("state", q.State).

0 commit comments

Comments
 (0)