opentelemetry-js/examples/postgres
Mayur Kale c6b29233d4
chore: post release update (#766)
2020-02-06 10:59:56 -08:00
..
images feat: add example for postgres plugin (#542) 2019-12-23 15:15:49 -08:00
README.md feat: add example for postgres plugin (#542) 2019-12-23 15:15:49 -08:00
client.js feat: lint examples (#649) 2020-01-24 08:03:04 -05:00
package.json chore: post release update (#766) 2020-02-06 10:59:56 -08:00
server.js update examples and getting started for provider and api package (#750) 2020-02-05 10:44:05 -08:00
setupPsql.js feat: lint examples (#649) 2020-01-24 08:03:04 -05:00
tracer.js update examples and getting started for provider and api package (#750) 2020-02-05 10:44:05 -08:00

README.md

Overview

OpenTelemetry PostgreSQL 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 HTTP request from client to server. The example shows key aspects of tracing such as

  • Root Span (on Client)
  • Child Span (on Client)
  • Child Span from a Remote Parent (on Server)
  • SpanContext Propagation (from Client to Server)
  • Span Events
  • Span Attributes

Installation

$ # from this directory
$ npm install

Setup Zipkin Tracing or Setup Jaeger Tracing

Run the Application

Zipkin

  • Start postgres via docker

    # from this directory
    npm run docker:start
    
  • Run the server

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

    $ # from this directory
    $ npm run zipkin:client
    
  • Cleanup docker

    # from this directory
    npm run docker:stop
    

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)

Jaeger

  • Start postgres via docker

    # from this directory
    npm run docker:start
    
  • Run the server

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

    $ # from this directory
    $ npm run jaeger:client
    
  • Cleanup docker

    # from this directory
    npm run docker:stop
    

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)

LICENSE

Apache License 2.0