Skip to content

Releases: src-d/lookout-sdk

v0.6.3

03 Apr 12:39
Compare
Choose a tag to compare

Identical to v0.6.2.
This release fixes a build problem with the python sdk library.

v0.6.2

03 Apr 12:19
8de6a00
Compare
Choose a tag to compare

Bug Fixes

The Go gRPC interceptors were executed in an order that did not allow to use pb.AddFields inside a client interceptor (#85).

v0.6.1

20 Mar 15:44
Compare
Choose a tag to compare

New Features

This release includes the following:

Audit trail for GetChanges and GetFiles calls

The SDK library now provides a mechanism to keep log fields during the message exchange between lookoutd and your analyzer.

An example of the logs fields that are kept in the message exchange would be:

{
    "repository": "github.com/src-d/lookout-sdk",
    "github.pr": 17
}

In practice this means that your analyzer will be able to easily add relevant information to its logs, and lookoutd will have a context for each call you make. A sort of audit trail for each GetChanges or GetFiles call.

This mechanism is implemented differently in the Go SDK and in the Python SDK

Go SDK

The above mentioned mechanism is implemented by using gRPC interceptors:

  • pb.CtxlogUnaryClientInterceptor,
  • pb.CtxlogStreamClientInterceptor,
  • pb.CtxlogUnaryServerInterceptor,
  • pb.CtxlogStreamServerInterceptor.

These interceptors are added automatically using pb.DialContext and pb.NewServer. There are also pb.DialContextWithInterceptors and pb.NewServerWithInterceptors respectively in case you want to add other interceptors. See examples/language-analyzer.go.

In your analyzer you can then use the pb.GetLogFields and pb.AddLogFields to read and add log fields to the context. The log fields that you add will be available to lookoutd.

Python SDK

The above mentioned mechanism is implemented by passing a wrapped context to each analyzer call (Notify{Review,Push}Event), and by changing the base class of your analyzer:

  • in version v0.5.0: lookout.sdk.pb.AnalyzerServicer -> lookout.sdk.service_analyzer_pb2_grpc.AnalyzerServicer,
    in version v0.6.1: lookout.sdk.pb.AnalyzerServicer -> lookout.sdk.service_analyzer.AnalyzerServicer.

The wrapped context is a proxy to the gRPC one. It additionally provides functionalities for adding and reading log fields that will be available to lookoutd, once you "activate" the audit trail (see later). See lookout.sdk.grpc.log_fields.LogFieldsContext.

This change is not a breaking change. Without updating anything the code is expected to work as before the update. In order to "activate" the audit trail you have to follow some steps. See the migration guide.

Logger interceptors

The SDK library now provides gRPC interceptors both for Go SDK and Python SDK for logging client calls and server request. See examples/language-analyzer.go and examples/language-analyzer.py to see how to use them.

Python SDK

An extra note must be added for the Python SDK. At time of writing gRPC for Python doesn't provide an api to add server interceptors for diffenret method types, so an api on top of that has been added to provide the user the capability to also add custom server interceptors. See lookout.sdk.grpc.interceptors.base.

[Python SDK] Default message size for gRPC server

A new create_server function creates a server with default values for gRPC max send and max receive message length.

Migration Guide: v0.5.0 => v0.6.1

You might want to check out the changes made to examples/language-analyzer.go and examples/language-analyzer.py in the comparison view.

Go SDK

Except for using pb.DialContext and pb.NewServer or their corresponding pb.DialContextWithInterceptors and pb.NewServerWithInterceptors, you don't have anything else to do in order to activate the audit trail.

Python SDK

Follow these steps to activate the audit trail.

  1. Rename the following:
  • NotifyReviewEvent -> notify_review_event,
  • NotifyPushEvent -> notify_push_event.
  1. Use create_server.
  2. Use DataStub imported from lookout.sdk.service_data and not from pb. The returned stub has a more pythonic api. You have to rename the following calls:
    • GetChanges -> get_changes,
    • GetFiles -> get_files.
      Both methods needs as first positional argument the context.

v0.6.0

19 Mar 17:38
Compare
Choose a tag to compare

Not recommended

This release brings new functionality that breaks compatibility with v0.5.0. Please use the v0.6.1 release instead, that includes the same new features but in a backwards-compatible way.

Breaking Changes

#71: The SDK library now applies gRPC interceptors to the gRPC client and server. These connectors allow to keep log fields during the message exchange between lookoutd and your analyzer.

An example of the logs fields that are kept in the message exchange would be

{
    "repository": "github.com/src-d/lookout-sdk",
    "github.pr": 17
}

In practice this means that your analyzer will be able to add relevant information to its logs; and lookoutd will have a context for each call you make. A sort of audit trail for each GetChanges or GetFiles call.

You might want to check out the changes made to examples/language-analyzer.go and examples/language-analyzer.py in the comparison view.

v0.5.0

21 Feb 09:49
Compare
Choose a tag to compare

Breaking Changes

This release removes the merge field from ReviewEvent (#74).
When a pull request is created on GitHub, they create a merge commit to test whether the head branch can be automatically merged into the base branch. The merge field stored a reference pointer to this merge.
This field is specific to GitHub, and is only present when the pull request is mergeable. We have removed it to make the SDK easier to use.

v0.4.1

18 Jan 17:25
Compare
Choose a tag to compare

New Features

Go

  • In previous versions we instructed analyzer authors to disable secure connections to source{d} Lookout using grpc.WithInsecure(). This is not needed anymore because the SDK library performs it when you use pb.DialContext (#67).
  • New instructions to use conn.ResetConnectBackoff to reset the gRPC backoff when your analyzer receives a new event. See the documentation here (#66).

Python

  • The library is now also published as a Source Distribution, sdist (#68).

v0.3.1

09 Jan 17:34
Compare
Choose a tag to compare

This release includes more comprehensive documentation for the .proto files and the GoDoc reference.

v0.3.0

27 Dec 11:01
33a9075
Compare
Choose a tag to compare

New Features

  • New field include_languages for ChangesRequest and FilesRequest protobuf messages (#36).

Python

  • Don't import anything grpc related in sdk/__init__, use sdk/pb.py instead (#43).
  • Add package to namespace lokoout (#48).
  • Define package version in sdk/__init__.py __version__ (#55).
  • Use a range instead of a fixed version for grpcio dependency (#54).

Internal

  • Make code generation more robust, fixing problems with maOS and virtualenv (#47)
  • Use a locked gogofaster version for consistent builds (#50).

v0.2.0

28 Nov 12:42
Compare
Choose a tag to compare

Features

  • Add gRPC helpers:
    • Create connection with DataServer with increased message size (go: #35 python: #37)
    • Convert URI in RFC 3986 format to understandable by grpc (go: #35 python: #37)
    • Go: add map to grpc.Struct convertor (#33)

Fixes

  • Update/fix example analyzers
  • Improve CI

v0.1.2

14 Nov 11:19
Compare
Choose a tag to compare

Go

Fix: Allow file schema for repositories #27

Python

No changes