opentelemetry-js/examples/http
Marc Pichler 06e919d6c9
chore: prepare release 1.15 / 0.41 (#3963)
2023-07-06 13:06:26 +02:00
..
images feat(plugin-http): add example (#318) 2019-09-25 13:36:28 -07:00
README.md typo on example link (#3083) 2022-07-11 08:57:33 -04:00
client.js chore: update http example (#3651) 2023-03-02 09:36:24 -05:00
package.json chore: prepare release 1.15 / 0.41 (#3963) 2023-07-06 13:06:26 +02:00
server.js chore: update http example (#3651) 2023-03-02 09:36:24 -05:00
tracer.js chore: rename sdks to better represent what they are [#2146] (#2340) 2021-08-05 21:13:18 +02:00

README.md

Overview

OpenTelemetry HTTP 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

  • 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)

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)

LICENSE

Apache License 2.0