Coder Social home page Coder Social logo

lookout-sdk's Introduction

lookout-sdk GitHub version PyPI version Build Status GoDoc

Toolkit for writing new analyzers for source{d} Lookout.

What Does the SDK Provide?

For the complete documentation of source{d} Lookout, please take a look at https://docs.sourced.tech/lookout.

For detailed information about the different parts of Lookout, and how they interact you can go to the Lookout architecture guide.

lookout-sdk provides:

  • proto definitions.
  • pre-generated libraries for Golang and Python, offering:
    • an easy access to the DataService API though a gRPC service. Lookout will take care of dealing with Git repositories, UAST extraction, programming language detection, etc.
    • low-level helpers to work around some protobuf/gRPC caveats.
  • quickstart examples of an Analyzer that detects language and number of functions (written in Go and in Python).

Caveats

For the gRPC client and server please follow these requirements:

  • set a common maximum gRPC message size in gRPC servers and clients. This is required to avoid hitting different gRPC limits when handling UASTs, that can be huge โ€”see grpc/grpc#7927โ€”. To do so use the included helpers in lookout-sdk:
    • go: using pb.NewServer and pb.DialContext.
    • python: using lookout.sdk.grpc.create_server and lookout.sdk.grpc.create_channel.
  • support RFC 3986 URI scheme; lookout-sdk includes helpers for this:
    • go: using pb.ToGoGrpcAddress and pb.Listen.
    • python: using lookout.sdk.grpc.to_grpc_address.
  • use insecure connection:
    • currently lookout expects to use insecure gRPC connections, as provided by pb.DialContext
    • python: run server using server.add_insecure_port(address) (example).

DataService

When DataService is being dialed, you should:

  • turn on gRPC Wait for Ready mode if your analyzer creates a connection to DataServer before it was actually started. This way the RPCs are queued until the chanel is ready:
  • golang: reset connection backoff to DataServer on event: if you keep the connection to DataServer open you need to reset the backoff when your analyzer receives a new event. Use the conn.ResetConnectBackoff method in your event handlers. It's needed to avoid broken connections after a lookoutd redeployment. In case of a long restart of lookoutd gRPC server, the backoff timeout may increase so much that the analyzer will not be able to reconnect before it makes the new request to DataServer.

Contributing

Contributions are welcome and very much appreciated ๐Ÿ™Œ

Please refer to our Contribution Guide for more details.

Community

source{d} has an amazing community of developers and contributors who are interested in Code As Data and/or Machine Learning on Code. Please join us! ๐Ÿ‘‹

Code of Conduct

All activities under source{d} projects are governed by the source{d} code of conduct.

License

Apache License Version 2.0, see LICENSE

lookout-sdk's People

Contributors

smacker avatar bzz avatar se7entyse7en avatar carlosms avatar dpordomingo avatar vmarkovtsev avatar meyskens avatar agarwalrounak avatar zurk avatar epicalyx avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.