Yet another Go Agent

Yet another Go Agent

Data collection with superpowers for Go.

A few days ago we released Hypertrace's newest Go Agent. This is not yet another agent, Go Agent provides a set of advanced features that play very well with the amazing features brought by Hypertrace keeping a ridiculously simple API aimed to users of all levels.

Trace representation in Hypertrace

Go Agent is built on top of OpenTelemetry, and hence, supports all the frameworks and libraries that it supports. The additional features supported by our agent are:

  • Full data capture of HTTP request/response elements: By default we capture the request/response body and headers, this allows users to have at hand the full information about a request/response, being this feature backed by PII filters and other security aspects in the platform.
  • Full data capture of RPC request/response elements: Same as in the HTTP case, however the particularity of this feature is that GRPC messages are being serialized as JSON with the respective field keys from the proto definition.
  • Full data capture of SQL statements and database information: Elements like the database query and the connection details are being captured.
  • OpenTelemetry standard tags for all instrumentations.

User experience is another foundational pillar on the design of our agents.

Go agent not only enriches all the features brought by OpenTelemetry but also hides the complexity around configuration so developers can focus on the features that matter for them.

Also, part of the great user experience we want to provide comes from the fact that we want to support those applications that are already instrumented without asking them to change the entire instrumentation. In that sense, Go Agent can perfectly work with applications already instrumented with OpenTelemetry and OpenCensus (and there are more to come!)

Getting started

Bootstrapping Go Agent is crazy simple. You can setup values directly and also read environment values

func main() {
    cfg := config.Load() // load env values
    cfg.ServiceName = config.String("my-app")

    shutdown := hypertrace.Init(cfg)
    defer shutdown() // force to flush traces when application finishes.

or you can also set configuration values either from a config file

func main() {
    cfg := config.LoadFromFile("./config.yaml") // load file and env values
    cfg.ServiceName = config.String("my-app")

Then you just need to instrument your app like any other one:

client := http.Client{
    Transport: hyperhttp.NewTransport(http.DefaultTransport),

and data will show up in Hypertrace:

Attributes collected by Go Agent

You can see a full example in action in this example repo.

About the author
JC is a Software Engineer at Traceable, working on data collection and contributing to Hypertrace. He is also a Zipkin maintainer and a loving father. While not working with code, you can find him sipping on craft beers or ranting on twitter @jcchavezs.
AgentsHypertraceDistributed TracingGoOpenTelemetryObservability