Skip to content
/ trace Public

Structured and versatile traffic tracing instrumentation

License

Notifications You must be signed in to change notification settings

vinxi/trace

Repository files navigation

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

About

Structured and versatile traffic tracing instrumentation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages