opentelemetry-js/examples/https
OpenTelemetry Bot 9dbd1e446b
chore: prepare next release (#5696)
2025-05-19 09:14:41 +00:00
..
docker chore: update `https` example (#3152) 2022-08-09 08:40:02 -04:00
images feat(plugin-https): patch https requests (#379) 2019-10-03 14:43:09 -07:00
README.md chore(lint): refactor Markdown linting to use markdownlint-cli2 (#4713) 2024-05-21 14:44:23 +02:00
client.js chore: update `https` example (#3152) 2022-08-09 08:40:02 -04:00
package.json chore: prepare next release (#5696) 2025-05-19 09:14:41 +00:00
server-cert.pem tests: regenerate recently-expired test TLS certs (#4777) 2024-06-10 10:54:49 +00:00
server-key.pem tests: regenerate recently-expired test TLS certs (#4777) 2024-06-10 10:54:49 +00:00
server.js chore: update `https` example (#3152) 2022-08-09 08:40:02 -04:00
tracer.js docs: update from deprecated SEMRESATTRS_SERVICE_NAME to ATTR_SERVICE_NAME (#5604) 2025-04-10 07:35:26 +00:00

README.md

Overview

OpenTelemetry HTTPS Instrumentation allows the user to automatically collect trace data and export them to the backend of choice. This example exports directly to Zipkin or Jaeger.

This is a simple example that demonstrates tracing HTTPS 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 or

# from this directory, requires docker and docker-compose
npm run docker:start
# Zipkin UI will be available at http://localhost:9411/zipkin/
# Jaeger UI will be available at http://localhost:16686/

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 showing a 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 showing a trace

LICENSE

Apache License 2.0