Git Product home page Git Product logo

gwr's Introduction

GWR: Get / Watch / Report -ing of operational data

GWR provides on demand access to operational data:

  • define your data sources
  • poll and/or watch them over HTTP or Redis Protocol

Status: beta

GWR is currently in beta devolopment:

  • basic support for get and watch are done, with a couple simple sources; these interfaces are not likely to change before 1.0
  • reporting is not yet started, and is the major blocker before 1.0

Using

GWR exposes a dual HTTP and RESP (Redis Protocol) interface. Integrators may specify the port, the example below uses 4040.

The following examples are against a running instance of example_server/.

HTTP

Example for http:

$ curl localhost:4040/meta/nouns
- /meta/nouns formats: <no value>
- /request_log formats: <no value>
- /response_log formats: <no value>

$ curl -X WATCH localhost:4040/request_log&
$ curl -X WATCH localhost:4040/response_log&

$ curl localhost:8080/foo
404 page not found                                         # this is the normal curl output
GET /foo                                                   # this comes from the first watch-curl
404 19 text/plain; charset=utf-8                           # this comes from the first watch-curl

Resp

$ redis-cli -p 4040 ls                                     # this is a convenience alias for "get /meta/nouns"
1) - /meta/nouns formats: <no value>
2) - /request_log formats: <no value>
3) - /response_log formats: <no value>

$ redis-cli -p 4040 monitor /request_log text /response_log text&
OK

$ curl localhost:8080/bar
404 page not found                                         # this is the curl output
/request_log> GET /bar                                     # this is from redis-cli
/response_log> 404 19 text/plain; charset=utf-8            # so is this, ordering not guaranteed

Integration

To add gwr to a program, all you need to do is call:

gwrProto.ListenAndServe(":4040", nil)

This hosts dual protocol HTTP and RESP server on port 4040.

Defining data sources

To define a data source, the easiest way is to implement the gwr.GenericDataSource interface.

TODO: example

For now see example_server/req_logger.go and example_server/res_logger.go

Running the example server

Should work by:

$ go run example_server/*.go

The example server hosts a dummy 404-ing web server on port 8080 and exposes a request and response log GWR noun. The HTTP and Resp usage examples above are against it.

gwr's People

Contributors

jcorbin avatar jra3 avatar

Watchers

 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.