Skip to content

Commit f93027b

Browse files
authored
feat(logging): add localIP and Cache fields to HTTPRequest conversion 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
1 parent 7bdebad commit f93027b

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

logging/logadmin/logadmin.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,12 @@ func toHTTPRequest(p *logtypepb.HttpRequest) (*logging.HTTPRequest, error) {
161161
Status: int(p.Status),
162162
ResponseSize: p.ResponseSize,
163163
Latency: dur,
164+
LocalIP: p.ServerIp,
164165
RemoteIP: p.RemoteIp,
165166
CacheHit: p.CacheHit,
166167
CacheValidatedWithOriginServer: p.CacheValidatedWithOriginServer,
168+
CacheFillBytes: p.CacheFillBytes,
169+
CacheLookup: p.CacheLookup,
167170
}, nil
168171
}
169172

logging/logadmin/logadmin_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,6 @@ func TestMain(m *testing.M) {
8080
return c
8181
}
8282
} else {
83-
// TODO(enocom): Delete this once we can get these tests to reliably pass.
84-
return
85-
8683
integrationTest = true
8784
ts := testutil.TokenSource(ctx, logging.AdminScope)
8885
if ts == nil {
@@ -139,9 +136,12 @@ func TestFromLogEntry(t *testing.T) {
139136
Latency: &durpb.Duration{Seconds: 100},
140137
UserAgent: "user-agent",
141138
RemoteIp: "127.0.0.1",
139+
ServerIp: "127.0.0.1",
142140
Referer: "referer",
141+
CacheLookup: true,
143142
CacheHit: true,
144143
CacheValidatedWithOriginServer: true,
144+
CacheFillBytes: 2048,
145145
},
146146
Labels: map[string]string{
147147
"a": "1",
@@ -183,9 +183,12 @@ func TestFromLogEntry(t *testing.T) {
183183
Status: 200,
184184
ResponseSize: 25,
185185
Latency: 100 * time.Second,
186+
LocalIP: "127.0.0.1",
186187
RemoteIP: "127.0.0.1",
188+
CacheLookup: true,
187189
CacheHit: true,
188190
CacheValidatedWithOriginServer: true,
191+
CacheFillBytes: 2048,
189192
},
190193
SourceLocation: &logpb.LogEntrySourceLocation{
191194
File: "some_file.go",

0 commit comments

Comments
 (0)