From 03efa9b651288d71e7993fbf0b675a2e4717264d Mon Sep 17 00:00:00 2001 From: Matthieu Vachon Date: Fri, 19 Jan 2024 12:12:40 -0500 Subject: [PATCH] The various health endpoint now sets `Content-Type: application/json` header prior sending back their response to the client Fixes #8 --- CHANGELOG.md | 2 ++ go.mod | 2 +- go.sum | 4 ++-- jsonencoder/marshallers.go | 2 +- protoregistry/registry.go | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f42cd8..0b74ef3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ If you were at `firehose-core` version `1.0.0` and are bumping to `1.1.0`, you s ## Unreleased +* The various health endpoint now sets `Content-Type: application/json` header prior sending back their response to the client. + * The `firehose`, `substreams-tier1` and `substream-tier2` health endpoint now respects the `common-system-shutdown-signal-delay` configuration value meaning that the health endpoint will return `false` now if `SIGINT` has been received but we are still in the shutdown unready period defined by the config value. If you use some sort of load balancer, you should make sure they are configured to use the health endpoint and you should `common-system-shutdown-signal-delay` to something like `15s`. * The `firecore.ConsoleReader` gained the ability to print stats as it ingest blocks. diff --git a/go.mod b/go.mod index 737b521..e4c2a61 100644 --- a/go.mod +++ b/go.mod @@ -21,7 +21,7 @@ require ( github.com/streamingfast/dauth v0.0.0-20231120142446-843f4e045cc2 github.com/streamingfast/dbin v0.9.1-0.20231117225723-59790c798e2c github.com/streamingfast/derr v0.0.0-20230515163924-8570aaa43fe1 - github.com/streamingfast/dgrpc v0.0.0-20230929132851-893fc52687fa + github.com/streamingfast/dgrpc v0.0.0-20240119162453-69517bcc1a7f github.com/streamingfast/dmetering v0.0.0-20231120142327-a3405f0eed83 github.com/streamingfast/dmetrics v0.0.0-20230919161904-206fa8ebd545 github.com/streamingfast/dstore v0.1.1-0.20230620124109-3924b3b36c77 diff --git a/go.sum b/go.sum index 51c3604..4b54e75 100644 --- a/go.sum +++ b/go.sum @@ -588,8 +588,8 @@ github.com/streamingfast/dbin v0.9.1-0.20231117225723-59790c798e2c h1:6WjE2yInE+ github.com/streamingfast/dbin v0.9.1-0.20231117225723-59790c798e2c/go.mod h1:dbfiy9ORrL8c6ldSq+L0H9pg8TOqqu/FsghsgUEWK54= github.com/streamingfast/derr v0.0.0-20230515163924-8570aaa43fe1 h1:xJB7rXnOHLesosMjfwWsEL2i/40mFSkzenEb3M0qTyM= github.com/streamingfast/derr v0.0.0-20230515163924-8570aaa43fe1/go.mod h1:QSm/AfaDsE0k1xBYi0lW580YJ/WDV/FKZI628tkZR0Y= -github.com/streamingfast/dgrpc v0.0.0-20230929132851-893fc52687fa h1:L/Ipge5pkZtyHucT7c8F/PiCitiNqQxjoUuxyzWKZew= -github.com/streamingfast/dgrpc v0.0.0-20230929132851-893fc52687fa/go.mod h1:AcY2kk28XswihgU6z37288a3ZF4gGGO7nNwlTI/vET4= +github.com/streamingfast/dgrpc v0.0.0-20240119162453-69517bcc1a7f h1:WDURSuig53yVdqSZDsIpOr/510oGqEtawosa9DtRO6A= +github.com/streamingfast/dgrpc v0.0.0-20240119162453-69517bcc1a7f/go.mod h1:AzMcSri68b21YwdAOw3j4Sq84N/JQ6ONM0B29NSVGyY= github.com/streamingfast/dmetering v0.0.0-20231120142327-a3405f0eed83 h1:IbIUT85146duL9EKwMiiW0HH1djpm8plmJOo+YZbO5U= github.com/streamingfast/dmetering v0.0.0-20231120142327-a3405f0eed83/go.mod h1:3XggUfQMyciaue133qhbIkFqJQqNzozGpa/gI3sdwac= github.com/streamingfast/dmetrics v0.0.0-20230919161904-206fa8ebd545 h1:SUl04bZKGAv207lp7/6CHOJIRpjUKunwItrno3K463Y= diff --git a/jsonencoder/marshallers.go b/jsonencoder/marshallers.go index d338c3a..b0e8071 100644 --- a/jsonencoder/marshallers.go +++ b/jsonencoder/marshallers.go @@ -15,7 +15,7 @@ import ( ) func (e *Encoder) anypb(encoder *jsontext.Encoder, t *anypb.Any, options json.Options) error { - msg, err := e.protoRegistry.Unmarshall(t) + msg, err := e.protoRegistry.Unmarshal(t) if err != nil { return fmt.Errorf("unmarshalling proto any: %w", err) } diff --git a/protoregistry/registry.go b/protoregistry/registry.go index e8b7775..ae024d0 100644 --- a/protoregistry/registry.go +++ b/protoregistry/registry.go @@ -39,7 +39,7 @@ func (r *Registry) RegisterFileDescriptor(f *desc.FileDescriptor) { r.filesDescriptors = append(r.filesDescriptors, f) } -func (r *Registry) Unmarshall(t *anypb.Any) (*dynamic.Message, error) { +func (r *Registry) Unmarshal(t *anypb.Any) (*dynamic.Message, error) { for _, fd := range r.filesDescriptors { md := fd.FindSymbol(cleanTypeURL(t.TypeUrl)) if md != nil {