Skip to content

Commit

Permalink
Merge pull request #8 from Cervest/log-principal
Browse files Browse the repository at this point in the history
Log principal
  • Loading branch information
meraymond2 authored Sep 9, 2022
2 parents 2826bf1 + bf18b0b commit 28ec75f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

type session struct {
Catalog string
Principal string
User string
UserAgent string
}
Expand All @@ -32,6 +33,7 @@ type QueryInfo struct {
Catalog string
CreateTime time.Time
DurationMs int64
Principal string
QueryId string
QuerySizeBytes int
QueryType string
Expand Down Expand Up @@ -82,6 +84,7 @@ func FetchQueryInfo() ([]QueryInfo, error) {
Catalog: q.Session.Catalog,
CreateTime: q.QueryStats.CreateTime,
DurationMs: q.QueryStats.EndTime.Sub(q.QueryStats.CreateTime).Milliseconds(),
Principal: q.Session.Principal,
QueryId: q.QueryId,
QuerySizeBytes: len(q.Query),
QueryType: q.QueryType,
Expand Down
1 change: 1 addition & 0 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ func metricsHandler(w http.ResponseWriter, r *http.Request) {
Str("catalog", q.Catalog).
Int64("duration_ms", q.DurationMs).
Str("id", q.QueryId).
Str("principal", q.Principal).
Time("query_time", q.CreateTime).
Int("size_bytes", q.QuerySizeBytes).
Str("state", q.State).
Expand Down

0 comments on commit 28ec75f

Please sign in to comment.