Skip to content

uptrace/examples

Repository files navigation

Uptrace examples

This repository contains examples that show how to instrument applications with OpenTelemetry and various SDKs and ship the resulting traces, metrics, and logs to Uptrace.

Get an Uptrace DSN

Most examples export data to Uptrace Cloud. Create an Uptrace project to obtain a DSN and pass it via the UPTRACE_DSN environment variable:

export UPTRACE_DSN="https://<token>@api.uptrace.dev/<project_id>"

The OTLP endpoints used by the examples are:

  • OTLP/gRPC: api.uptrace.dev:4317 (TLS)
  • OTLP/HTTP: https://api.uptrace.dev with the paths /v1/traces, /v1/logs, /v1/metrics

The DSN is always passed to the exporter through the uptrace-dsn header.

Note. The kvrocks example also starts a local Kvrocks server via Docker Compose (the service it monitors); telemetry still goes to Uptrace Cloud.

Examples

Go

  • go-slog — bridge Go's log/slog to OpenTelemetry.
  • gin-gorm — instrument Gin and GORM with OpenTelemetry.
  • go-zero — use go-zero's built-in OpenTelemetry support.
  • kvrocks — monitor Apache Kvrocks with go-redis.

Python

  • django — instrument a Django application.
  • flask — instrument Flask with SQLAlchemy.

Ruby

  • rails — instrument a minimal Rails application.

Node.js

  • express — instrument Express with the OpenTelemetry SDK.

Sentry-compatible SDKs

Uptrace is compatible with the Sentry SDKs, so you can point a Sentry DSN at your Uptrace project.

Logs, Collector, and demos

Running an example

Each example is self-contained and exposes a default make target that runs it:

cd <example>
make

See the README.md in each directory for prerequisites and details.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors