otel-sample-app

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

README

Open Telemetry (OTEL) Sample App

Install

using golang 1.18+

Locally

go install fortio.org/otel-sample-app@latest

Or Docker - optimized for istio kubernetes cluster

Testing:

Start a local jaeger with otel receiver:

docker run -p 16686:16686 -p 4317:4317 jaegertracing/all-in-one:latest --collector.otlp.enabled=true
fortio server & # echo/debug server
OTEL_SERVICE_NAME=local-test go run . -b3multi -listen :8000 -url http://localhost:8080/debug &
curl -v localhost:8000

Get traces: http://localhost:16686/search

See also Makefile for examples.

The Dockerfile is setup for istio/envoy 1.15.x config with b3 multi headers (what istio envoy uses by default).

Documentation

Initially loosely based on

https://github.com/open-telemetry/opentelemetry-go-contrib/tree/main/instrumentation/net/http/httptrace/otelhttptrace

and

https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/net/http/otelhttp/example/client/client.go

and

https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/instrumentation/net/http/otelhttp/example/server/server.go

all combined

(which doesn't work without an outer span setup first in the context, see fortio/fortiotel/simple)

Documentation

Overview

Simple example of getting an incomping request and propagating traces to outgoing request while adding its own spans (like ../simple/)

Meant to be used inside k8s with istio (envoy generating the outside/incoming trace headers)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL