Skip to content

Commit

Permalink
feat(logging): add localIP and Cache fields to HTTPRequest conversion…
Browse files Browse the repository at this point in the history
… from proto (#3600)

Fix #3588 

Changes: 
- Turned integration test back on for `logadmin`. According to previous comments, this may be flakey so I will closely monitor and debug. 
- Added fields LocalIP, CacheLookup, and CacheFillBytes back to httprequest conversion from proto to logging.httprequest
  • Loading branch information
0xSage committed Jan 25, 2021
1 parent 7bdebad commit f93027b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions logging/logadmin/logadmin.go
Expand Up @@ -161,9 +161,12 @@ func toHTTPRequest(p *logtypepb.HttpRequest) (*logging.HTTPRequest, error) {
Status: int(p.Status),
ResponseSize: p.ResponseSize,
Latency: dur,
LocalIP: p.ServerIp,
RemoteIP: p.RemoteIp,
CacheHit: p.CacheHit,
CacheValidatedWithOriginServer: p.CacheValidatedWithOriginServer,
CacheFillBytes: p.CacheFillBytes,
CacheLookup: p.CacheLookup,
}, nil
}

Expand Down
9 changes: 6 additions & 3 deletions logging/logadmin/logadmin_test.go
Expand Up @@ -80,9 +80,6 @@ func TestMain(m *testing.M) {
return c
}
} else {
// TODO(enocom): Delete this once we can get these tests to reliably pass.
return

integrationTest = true
ts := testutil.TokenSource(ctx, logging.AdminScope)
if ts == nil {
Expand Down Expand Up @@ -139,9 +136,12 @@ func TestFromLogEntry(t *testing.T) {
Latency: &durpb.Duration{Seconds: 100},
UserAgent: "user-agent",
RemoteIp: "127.0.0.1",
ServerIp: "127.0.0.1",
Referer: "referer",
CacheLookup: true,
CacheHit: true,
CacheValidatedWithOriginServer: true,
CacheFillBytes: 2048,
},
Labels: map[string]string{
"a": "1",
Expand Down Expand Up @@ -183,9 +183,12 @@ func TestFromLogEntry(t *testing.T) {
Status: 200,
ResponseSize: 25,
Latency: 100 * time.Second,
LocalIP: "127.0.0.1",
RemoteIP: "127.0.0.1",
CacheLookup: true,
CacheHit: true,
CacheValidatedWithOriginServer: true,
CacheFillBytes: 2048,
},
SourceLocation: &logpb.LogEntrySourceLocation{
File: "some_file.go",
Expand Down

0 comments on commit f93027b

Please sign in to comment.