Skip to content

v0.19.0

Compare
Choose a tag to compare
@mwhittaker mwhittaker released this 11 Aug 19:31
· 201 commits to main since this release

To use v0.19.0 of Service Weaver, run the following commands in the root of your application's module:

go get github.com/ServiceWeaver/weaver@v0.19.0                # Update the weaver module.
go install github.com/ServiceWeaver/weaver/cmd/weaver@v0.19.0 # Update the weaver command line tool.

Logging

Service Weaver v0.19.0 introduces a small breaking change to the logging API. The Logger method on weaver.Implements now has a context.Context argument. Here's an example:

type Adder interface {
    Add(context.Context, int, int) (int, error) 
}

type adder struct {
    weaver.Implements[Adder]
}

func (a *adder) Add(ctx context.Context, x, y int) (int, error) {
    // NOTE that the Logger method now takes a context. 
    a.Logger(ctx).Debug("Add", "x", x, "y", y) 
    return x + y, nil
}

The logger returned by Logger now includes labels for any OpenTelemetry trace and span ids that are stored in the provided context. This allows you to correlate logs and traces, which makes debugging much easier. We also slightly changed how logs are pretty printed:

Before After
before

See #495, #496, and #512 for details.

RPC Health Checking

We added more sophisticated health checking to our RPC implementation, which is used to remotely execute component method calls. With this change, fewer method calls should fail when a component replica fails. See #498 for details.

Validations

We try to detect invalid Service Weaver applications at compile time (see https://serviceweaver.dev/blog/weaver_generate.html, for example), but some checks have to be done at runtime. We have introduced a number of new validation checks in v0.19.0. Specifically, we check that every component has been registered correctly (#500) and that all listener names are valid (#501). We also report more error messages when things go wrong to make it easier to debug issues (#493).

Full Changelog: v0.18.0...v0.19.0