Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Introduced Release Candidate v3.0 #206

Closed
wants to merge 1 commit into from
Closed

Conversation

thrawn01
Copy link
Contributor

@thrawn01 thrawn01 commented Dec 7, 2023

CHANGES:

  • Introduced HTTPClient
  • Integrating DUH-RPC
  • Updated tests with new client
  • Fixed some lint issues
  • GRPC is no more
  • OTEL tracing for new client and handler
  • Updated benchmarks
  • Isolate the trace benchmark

@thrawn01 thrawn01 requested a review from Baliedge as a code owner December 7, 2023 20:34
@thrawn01 thrawn01 force-pushed the release-candidate-v3.0 branch from ebd6407 to e885db6 Compare December 7, 2023 21:34
CHANGES:
* Introduced HTTPClient
* Integrating DUH-RPC
* Updated tests with new client
* Fixed some lint issues
* GRPC is no more
* OTEL tracing for new client and handler
* Updated benchmarks
* Isolate the trace benchmark
@thrawn01 thrawn01 force-pushed the release-candidate-v3.0 branch from e885db6 to b6caf07 Compare December 8, 2023 17:04
Copy link
Contributor

@Baliedge Baliedge left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Love it!

{HTTPAddress: "127.0.0.1:9883", DataCenter: cluster.DataCenterOne},
}); err != nil {
fmt.Println(err)
os.Exit(1)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not t.Fatal(msg)?

err := conf.SetDefaults()
require.NoError(b, err, "Error in conf.SetDefaults")

//b.Run("Forward() NO_BATCHING", func(b *testing.B) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These code blocks needed?

defer func() { tracing.EndScope(ctx, err) }()
span := trace.SpanFromContext(ctx)
span.SetAttributes(
attribute.String("peer.HTTPAddress", p.conf.Info.HTTPAddress),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure OTel/Honeycomb prefer dot.delimited.snake_case instead of PascalCase.

Suggest: peer.http_address

}()

// If config asked for no batching
if HasBehavior(r.Behavior, Behavior_NO_BATCHING) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would also like the global "Disable batching" feature here.

}

// Wait for a response or context cancel
ctx2 := tracing.StartNamedScopeDebug(ctx, "Wait for response")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: If you don't need original ctx value later, I would just overwrite it.

return err
}

// TODO: Replace this with modern error handling
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define "modern"?

@@ -289,20 +278,10 @@ Example response:
```

### Deployment
NOTE: Gubernator uses `etcd`, Kubernetes or round-robin DNS to discover peers and
NOTE: Gubernator uses `memberlist` Kubernetes or round-robin DNS to discover peers and
Copy link

@MatthewEdge MatthewEdge Dec 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
NOTE: Gubernator uses `memberlist` Kubernetes or round-robin DNS to discover peers and
NOTE: Gubernator uses `memberlist`, Kubernetes, or round-robin DNS to discover peers and

Just to make it clear that memberlist != K8S

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would go as far as adding the Oxford comma, too.

@@ -59,7 +60,7 @@ $ curl http://localhost:9080/v1/GetRateLimits \

### ProtoBuf Structure

An example rate limit request sent via GRPC might look like the following

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's strictly necessary but it may be worth adding a note that gRPC was dropped? Just for anyone who may have been using Gub with gRPC has an explicit warning

func (c *client) Forward(ctx context.Context, req *ForwardRequest, resp *ForwardResponse) error {
payload, err := proto.Marshal(req)
if err != nil {
return duh.NewClientError(fmt.Errorf("while marshaling request payload: %w", err), nil)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More a suggestion for duh - it might be helpful for this method to accept the error and wrap for you, like: duh.NewClientError(err, "while marshaling request payload"). Tiny tiny stylistic item for reducing code read time (and absolutely not required!)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This. ☝🏻

@@ -97,7 +101,7 @@ func Start(numInstances int) error {
// Restart the cluster
func Restart(ctx context.Context) error {
for i := 0; i < len(daemons); i++ {
daemons[i].Close()
daemons[i].Close(context.Background())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For both Restart() and Close() (and the others, it seems) - do these ctx instances need timeouts?

)

func main() {
url := os.Getenv("GUBER_HTTP_ADDRESS")
if url == "" {
url = "localhost:80"
}
resp, err := http.DefaultClient.Get(fmt.Sprintf("http://%s/v1/HealthCheck", url))
resp, err := http.DefaultClient.Get(fmt.Sprintf("http://%s/healthz", url))

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be /health.check? README mentions /health.check

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think those are two different endpoints. Could we document the purpose of each?

require.NoError(t, err)
reqNoClientCertRequired, err := http.NewRequest(http.MethodGet, fmt.Sprintf("https://%s/v1/HealthCheck", conf.HTTPStatusListenAddress), nil)
reqNoClientCertRequired, err := http.NewRequest(http.MethodGet, fmt.Sprintf("https://%s/healthz", conf.HTTPStatusListenAddress), nil)
require.NoError(t, err)

// Test that a client without a cert can access /v1/HealthCheck at status address

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here for if this should be /health.check for README consistency


# Make a rate limit request
$ curl http://localhost:9080/v1/GetRateLimits \
$ curl http://localhost:9080/v1/rate-limits.check \

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$ curl http://localhost:9080/v1/rate-limits.check \
$ curl http://localhost:9080/v1/rate-limit.check \

According to handler.go, at least :D

@Baliedge
Copy link
Contributor

PR moved to new repo at: gubernator-io/gubernator#8.

@Baliedge Baliedge closed this Apr 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants