Skip to content

simonwhitaker/otel-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenTelemetry Demo Web App

A creative web application that generates OpenTelemetry metrics, traces, and logs for testing telemetry backends.

Features

  • Page Load Metrics: Tracks page loads with browser and referrer attributes
  • Fortune Cookies: Serves developer-themed fortunes with custom counters
  • Error Simulation: Randomly triggers different HTTP errors for alerting tests
  • Slow Operations: Simulates multi-step operations with timing metrics
  • Mood Tracking: Records user mood scores in a histogram
  • Active Users: Tracks concurrent users with an up/down counter
  • Auto-Refresh: Built-in page refresh options for continuous metric generation

Setup

  1. Install dependencies:
npm install
  1. Configure your OTLP endpoint (for Datadog, New Relic, Honeycomb, etc.):
# For Datadog
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://trace.agent.datadoghq.com/v0.7/traces"
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="https://api.datadoghq.com/v1/series"

# For New Relic
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://otlp.nr-data.net:4318/v1/traces"
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="https://otlp.nr-data.net:4318/v1/metrics"

# For Honeycomb
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="https://api.honeycomb.io/v1/traces"
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT="https://api.honeycomb.io/v1/metrics"
  1. Add your API key/headers as needed by your provider

  2. Start the app:

npm start
  1. Visit http://localhost:3000 and interact with the features!

Metrics Generated

  • page_loads: Counter with browser and referrer labels
  • http_request_duration: Histogram of request durations
  • active_users: UpDown counter for concurrent users
  • fortune_cookies_served: Counter with fortune type labels
  • user_mood_score: Histogram of mood ratings (1-10)

Traces

Every endpoint creates spans with relevant attributes and events:

  • Home page loads
  • Fortune cookie selections
  • Error simulations
  • Slow operation steps
  • Mood recordings

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published