sourcegraph/internal/requestclient
Robert Lin f798f943b8
reqeuestclient, audit, cody-gateway: log user-agent as well (#53785)
Potentially useful context when determining the source of a request.

This change mostly just adds a field, but some additional diffs:

- rewrite the audit log tests to use autogold for in-depth assertion
- move request logging in Cody Gateway further down the stack so that we
have all context available

## Test plan

```
sg start dotcom
```

Do a cody interaction:

```
[   cody-gateway] DEBUG cody-gateway requestlogger/requestlogger.go:34 Request {"TraceId": "a2cf1a35a3094c57e3fcc9688c5c9819", "SpanId": "f38e261c6cce8687", "actor.ID": "7b823673-c9ff-46d7-a80d-e0d6ba0b3469", "actor.Source": "dotcom-product-subscriptions", "actor.AccessEnabled": true, "actor.LastUpdated": 1687281754512940000, "requestClient.ip": "127.0.0.1", "requestClient.forwardedFor": "", "requestClient.userAgent": "Sourcegraph-Bot", "method": "POST", "path": "/v1/completions/anthropic", "response.statusCode": 200, "duration": "2.342545917s"}
```

Not a terribly useful user agent but oh well
2023-06-20 22:12:11 +00:00
..
BUILD.bazel reqeuestclient, audit, cody-gateway: log user-agent as well (#53785) 2023-06-20 22:12:11 +00:00
client.go reqeuestclient, audit, cody-gateway: log user-agent as well (#53785) 2023-06-20 22:12:11 +00:00
grpc_test.go gRPC: add support for accesslog interceptor in gitserver package (#51437) 2023-05-15 16:16:42 +00:00
grpc.go reqeuestclient, audit, cody-gateway: log user-agent as well (#53785) 2023-06-20 22:12:11 +00:00
http.go reqeuestclient, audit, cody-gateway: log user-agent as well (#53785) 2023-06-20 22:12:11 +00:00