Structured and versatile traffic tracing instrumentation
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
_examples
.editorconfig
.gitignore
.travis.yml
History.md
LICENSE
README.md
trace.go
trace_test.go
version.go

README.md

trace Build Status GoDoc Coverage Status Go Report Card

Traffic tracing instrumentation for your proxies. Designed to be extended to trace custom data or modify the request/response.

Relies on log package to write structured traces and optionally send them via hooks to different storage services.

Installation

go get -u gopkg.in/vinxi/trace.v0

API

See godoc reference.

Example

Default tracing

package main

import (
  "fmt"
  "net/http"

  "gopkg.in/vinxi/trace.v0"
  "gopkg.in/vinxi/vinxi.v0"
)

const port = 3100

func main() {
  // Create a new vinxi proxy
  vs := vinxi.NewServer(vinxi.ServerOptions{Port: port})

  // Instrument the proxy with trace middleware 
  // Now all the incoming traffic will be registered. 
  vs.Use(trace.Default)

  // Target server to forward
  vs.Forward("http://httpbin.org")

  fmt.Printf("Server listening on port: %d\n", port)
  err := vs.Listen()
  if err != nil {
    fmt.Errorf("Error: %s\n", err)
  }
}

License

MIT