Skip to content

Latest commit

 

History

History
79 lines (52 loc) · 2.14 KB

File metadata and controls

79 lines (52 loc) · 2.14 KB

Overview

OpenTelemetry Hapi Instrumentation allows the user to automatically collect trace data and export them to the backend of choice (we can use Zipkin or Jaeger for this example), to give observability to distributed systems.

This is a simple example that demonstrates tracing calls made in a Hapi application. The example shows key aspects of tracing such as

  • Root Span (on Client)
  • Child Span (on Client)
  • Span Attributes
  • Instrumentation for routes and request extension points
  • Instrumentation of Hapi plugins

Installation

# from this directory
npm install

Setup Zipkin Tracing or Setup Jaeger Tracing

Run the Application

Zipkin

  • Run the server

    # from this directory
    $ npm run zipkin:server
  • Run the client

    # from this directory
    npm run zipkin:client

Zipkin UI

zipkin:server script should output the traceid in the terminal (e.g traceid: 4815c3d576d930189725f1f1d1bdfcc6). Go to Zipkin with your browser http://localhost:9411/zipkin/traces/(your-trace-id) (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)

Zipkin UI with trace

Jaeger

  • Run the server

    # from this directory
    $ npm run jaeger:server
  • Run the client

    # from this directory
    npm run jaeger:client

Jaeger UI

jaeger:server script should output the traceid in the terminal (e.g traceid: 4815c3d576d930189725f1f1d1bdfcc6). Go to Jaeger with your browser http://localhost:16686/trace/(your-trace-id) (e.g http://localhost:16686/trace/4815c3d576d930189725f1f1d1bdfcc6)

Jaeger UI with trace

Useful links

LICENSE

Apache License 2.0