Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(logging): add localIP and Cache fields to HTTPRequest conversion from proto #3600

Merged
merged 3 commits into from Jan 25, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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