### Install go-version Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/NOTICES/amd64/github.com/hashicorp/go-version/README.md Install the go-version library using the standard go get command. ```bash $ go get github.com/hashicorp/go-version ``` -------------------------------- ### Memcached Protocol Example: Get Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/protocols/tcp/memcached.md A simple example demonstrating a 'get' request and its corresponding 'VALUE' response, including the data payload and the 'END' marker. ```text get session-key VALUE session-key 0 5 value END ``` -------------------------------- ### Memcached Protocol Example: Noreply and Get Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/protocols/tcp/memcached.md This example shows a 'set' command with the 'noreply' option, followed by a 'get' command for the same key. The 'noreply' command does not produce a direct response. ```text set a 0 0 1 noreply x get a VALUE a 0 1 x END ``` -------------------------------- ### Build and Deploy Kubernetes Example Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/nginx/README.md Builds a local Docker image for the traffic generator, loads it into Kind, and applies Kubernetes manifests. It then installs the OpenTelemetry eBPF Instrumentation using Helm. ```bash docker build -t obi-nginx-traffic:local -f examples/nginx/traffic-runner/Dockerfile examples/nginx kind load docker-image obi-nginx-traffic:local kubectl apply -f examples/nginx/k8s/00-namespace.yaml kubectl apply -k examples/nginx/k8s helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts helm repo update helm upgrade --install obi open-telemetry/opentelemetry-ebpf-instrumentation \ --namespace obi-nginx-example \ -f examples/nginx/k8s/03-obi-values.yaml ``` -------------------------------- ### Start NGINX Instances on Dedicated Host Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/nginx/README.md Starts three host NGINX instances for the edge, recommendations-v1, and recommendations-v2 services on a dedicated Linux host. Ensure NGINX is installed and logs directories are created. ```bash mkdir -p "$PWD/examples/nginx/standalone/edge/logs" mkdir -p "$PWD/examples/nginx/standalone/recommendations-v1/logs" mkdir -p "$PWD/examples/nginx/standalone/recommendations-v2/logs" nginx -p "$PWD/examples/nginx" -c standalone/edge/nginx.conf nginx -p "$PWD/examples/nginx" -c standalone/recommendations-v1/nginx.conf nginx -p "$PWD/examples/nginx" -c standalone/recommendations-v2/nginx.conf ``` -------------------------------- ### Example: Prepare Release for 'obi' Module Set Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/RELEASING.md An example of running the 'prerelease' make target to prepare a release specifically for the 'obi' module set. ```console make prerelease MODSET=obi ``` -------------------------------- ### Start Standalone Apache Instances Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/apache/README.md Starts three Apache HTTP Server instances directly on the host machine. This is part of the setup for running OBI on a dedicated Linux host. ```bash ./examples/apache/start-standalone.sh ``` -------------------------------- ### Install OBI Binaries to System PATH Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/README.md Copy the OBI and k8s-cache binaries to a directory in your system's PATH for global access. Verify the installation by checking the version. ```bash sudo cp obi /usr/local/bin/ sudo cp k8s-cache /usr/local/bin/ # Verify installation obi --version ``` -------------------------------- ### Install Python Server Prerequisites Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/integration/components/pythonserver/README.md Installs the Flask and Gunicorn libraries required for the Python Ping Server. ```bash pip install flask pip install gunicorn ``` -------------------------------- ### Start Observability Backend (Standalone) Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/apache/README.md Runs the Grafana OTEL LGTM backend as a Docker container. This backend collects and visualizes telemetry data for the standalone setup. ```bash docker run -d --name lgtm --restart unless-stopped \ -p 3000:3000 -p 4317:4317 -p 4318:4318 \ grafana/otel-lgtm:0.23.0 ``` -------------------------------- ### Example: Add Tags for 'obi' Module Set Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/RELEASING.md An example of adding release tags for the 'obi' module set using the 'add-tags' make target for the latest commit. ```console make add-tags MODSET=obi ``` -------------------------------- ### Start Simple HTTP Server for Testing Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/otel-collector/README.md Launch a basic HTTP server on port 8000 to generate test traffic for tracing. ```bash python3 -m http.server 8000 ``` -------------------------------- ### Start Docker Compose Services Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/http-header-enrichment-demo/README.md Build and start all services defined in the Docker Compose file. Wait for OBI to instrument services before viewing traces. ```sh docker compose up --build -d ``` -------------------------------- ### Start Docker Compose Stack Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/apache/README.md Builds and starts the full observability stack locally using Docker Compose. This is the fastest way to try the full stack on Linux. ```bash docker compose up -d ``` -------------------------------- ### Couchbase Connection Setup Commands Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/protocols/tcp/couchbase.md Lists connection setup commands that are tracked for state but do not generate spans, used for enriching subsequent operations. ```plaintext | Opcode | Name | Purpose | |:-------|:------------------|:-------------------------------------------| | 0x89 | SELECT_BUCKET | Selects the bucket for the connection | | 0xbb | GET_COLLECTION_ID | Resolves scope.collection to collection ID | ``` -------------------------------- ### Immutable Go Tool Installation Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/dependency-integrity-policy.md Avoid installing Go tools with '@latest'. Pin exact module versions or copy tools from a pinned builder image. ```Go go install ...@latest ``` -------------------------------- ### Basic LRU Cache Example Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/NOTICES/amd64/github.com/hashicorp/golang-lru/v2/README.md Demonstrates the creation and basic usage of a fixed-size LRU cache. The cache evicts the least recently used items when its capacity is exceeded. ```go package main import ( "fmt" "github.com/hashicorp/golang-lru/v2" ) func main() { l, _ := lru.New[int, any](128) for i := 0; i < 256; i++ { l.Add(i, nil) } if l.Len() != 128 { panic(fmt.Sprintf("bad len: %v", l.Len())) } } ``` -------------------------------- ### Memcached Protocol Example: Set Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/protocols/tcp/memcached.md Illustrates a 'set' command followed by the 'STORED' confirmation. This shows a basic storage operation. ```text set session-key 0 300 5 value STORED ``` -------------------------------- ### Build Ad Service Locally Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/store-demo/app/src/adservice/README.md Use Gradle to compile, install, and distribute the Ad Service. This command creates an executable script. ```bash gradle installDist ``` -------------------------------- ### Install OBI With Helm Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/store-demo/README.md Install the OpenTelemetry eBPF Instrumentation chart using Helm. This configuration enables Kubernetes-aware discovery and exports traces/metrics to the in-cluster LGTM service. Wait for OBI pods to become ready. ```bash helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts helm repo update helm upgrade --install obi open-telemetry/opentelemetry-ebpf-instrumentation \ --namespace obi-store-demo \ -f examples/store-demo/k8s/03-obi-values.yaml ``` ```bash kubectl -n obi-store-demo wait --for=condition=Ready pod \ -l app.kubernetes.io/instance=obi \ --timeout=120s ``` -------------------------------- ### Run OBI for Performance Measurement Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/benchmarks/goshorturl/README.md Start the OBI tool in non-exporting mode to measure the BPF overhead. Ensure the correct port and trace printer are configured. ```bash sudo OTEL_EBPF_OPEN_PORT=8081 OTEL_EBPF_TRACE_PRINTER=counter bin/obi ``` -------------------------------- ### Run Ping Server Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/cmd/pingserver/README.md Execute the compiled ping server application. This starts the server in its default mode. ```bash ./server ``` -------------------------------- ### Memcached Protocol Example: Increment Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/protocols/tcp/memcached.md Demonstrates an 'incr' command to atomically increment a counter, showing the new value as the response. ```text incr counter 1 42 ``` -------------------------------- ### Run All Benchmarks with Gradle Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/pkg/internal/java/README.md Execute all JMH benchmarks for the agent module using Gradle. Ensure you have Gradle installed and the project is set up correctly. ```bash gradle :agent:jmh ``` -------------------------------- ### Run OBI on Dedicated Host Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/nginx/README.md Starts the OpenTelemetry eBPF Instrumentation agent on the host. It requires OTLP endpoint configuration and a path to the OBI configuration file. ```bash sudo OTLP_ENDPOINT=http://127.0.0.1:4318 \ obi --config="$PWD/examples/nginx/standalone/obi-config.yaml" ``` -------------------------------- ### Generate Traffic on Dedicated Host Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/nginx/README.md Generates traffic to test the OpenTelemetry eBPF Instrumentation setup on a dedicated Linux host. This command should be run after NGINX and OBI are started. ```bash ./examples/nginx/generate-traffic.sh --base-url http://127.0.0.1:8080 ``` -------------------------------- ### Hash-Locked Python Installs Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/dependency-integrity-policy.md Use a committed requirements file with hashes and enforce them during installation to prevent supply-chain risks. ```Python pip install --require-hashes -r requirements.txt ``` -------------------------------- ### Install Git Pre-commit Hooks for Formatting Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/CONTRIBUTING.md Run 'make install-hooks' to set up the pre-commit git hook. This automatically formats C code during the commit process, ensuring code style consistency. ```makefile make install-hooks ``` -------------------------------- ### Lockfile-Enforced Node Installs Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/dependency-integrity-policy.md Use 'npm ci' for installing Node.js dependencies in Dockerfiles and commit lockfiles to ensure reproducible builds. ```Shell npm ci ``` -------------------------------- ### Create Kind Kubernetes Cluster Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/store-demo/README.md Sets up a local Kubernetes cluster using kind and configures kubectl to use the created cluster context. Ensure Docker is running. ```bash export KIND_CLUSTER_NAME=obi-store-demo kind create cluster --name "${KIND_CLUSTER_NAME}" kubectl config use-context "kind-${KIND_CLUSTER_NAME}" ``` -------------------------------- ### Example Collector Log Output with Traces Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/otel-collector/README.md This is an example of the log output from the OpenTelemetry Collector, showing received traces from the eBPF instrumentation. ```text 2026-01-05T23:18:08.379+0200 info ResourceSpans #0 Resource SchemaURL: Resource attributes: -> service.name: Str(python3.12) -> telemetry.sdk.language: Str(python) -> telemetry.sdk.name: Str(opentelemetry-ebpf-instrumentation) -> telemetry.sdk.version: Str(unset) -> host.name: Str(lima-coralogix-vm-24) -> host.id: Str(a998876e9a2642d8a1a9b8a0030c786e) -> os.type: Str(linux) -> service.instance.id: Str(lima-coralogix-vm-24:295419) -> otel.scope.name: Str(go.opentelemetry.io/obi) ScopeSpans #0 ScopeSpans SchemaURL: InstrumentationScope Span #0 Trace ID : 8c28f3b6817dfc2e629612dc39952fef Parent ID : 9adcce7d3501ea15 ID : 511fc600e31636db Name : in queue Kind : Internal Start time : 2026-01-05 21:17:58.465955692 +0000 UTC End time : 2026-01-05 21:17:58.468910267 +0000 UTC Status code : Unset Status message : DroppedAttributesCount: 0 DroppedEventsCount: 0 DroppedLinksCount: 0 Span #1 Trace ID : 8c28f3b6817dfc2e629612dc39952fef Parent ID : 9adcce7d3501ea15 ID : 302aa18decfd48f3 Name : processing Kind : Internal Start time : 2026-01-05 21:17:58.468910267 +0000 UTC End time : 2026-01-05 21:17:58.496701454 +0000 UTC Status code : Unset Status message : DroppedAttributesCount: 0 DroppedEventsCount: 0 DroppedLinksCount: 0 Span #2 Trace ID : 8c28f3b6817dfc2e629612dc39952fef Parent ID : ID : 9adcce7d3501ea15 Name : GET / Kind : Server Start time : 2026-01-05 21:17:58.465955692 +0000 UTC End time : 2026-01-05 21:17:58.496701454 +0000 UTC Status code : Unset Status message : DroppedAttributesCount: 0 DroppedEventsCount: 0 DroppedLinksCount: 0 Attributes: -> http.request.method: Str(GET) -> http.response.status_code: Int(200) -> url.path: Str(/) -> client.address: Str(127.0.0.1) -> server.address: Str(python3.12) -> server.port: Int(8000) -> http.request.body.size: Int(77) -> http.response.body.size: Int(11187) -> http.route: Str(/) {"resource": {"service.instance.id": "7e92d7ee-5866-4d53-8025-75c0d250e8cf", "service.name": "otelcol-dev", "service.version": ""}, "otelcol.component.id": "debug", "otelcol.component.kind": "exporter", "otelcol.signal": "traces"} ``` -------------------------------- ### Uvicorn Package Specification Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/integration/components/ai/anthropic/requirements.txt Specifies the `uvicorn` package version and its SHA256 hashes for installation. This ensures that the exact version of `uvicorn` is installed, along with its verified integrity. ```text uvicorn==0.41.0 \ --hash=sha256:09d11cf7008da33113824ee5a1c6422d89fbc2ff476540d69a34c87fab8b571a \ --hash=sha256:29e35b1d2c36a04b9e180d4007ede3bcb32a85fbdfd6c6aeb3f26839de088187 # via -r requirements.in ``` -------------------------------- ### Create Branch, Make Changes, and Push Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/CONTRIBUTING.md Create a new branch for your changes, make modifications, run linters and tests, and push the branch to your fork. ```sh git checkout -b # edit files make fmt make lint git add -p git commit git push ``` -------------------------------- ### Build and Load Docker Images for Services Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/store-demo/README.md Builds Docker images for each Online Boutique service and loads them into the kind Kubernetes cluster. This script iterates through a predefined list of services, builds their images with a local tag, and then loads them into the specified kind cluster. ```bash services=( "adservice:examples/store-demo/app/src/adservice" "cartservice:examples/store-demo/app/src/cartservice/src" "checkoutservice:examples/store-demo/app/src/checkoutservice" "currencyservice:examples/store-demo/app/src/currencyservice" "emailservice:examples/store-demo/app/src/emailservice" "frontend:examples/store-demo/app/src/frontend" "loadgenerator:examples/store-demo/app/src/loadgenerator" "paymentservice:examples/store-demo/app/src/paymentservice" "productcatalogservice:examples/store-demo/app/src/productcatalogservice" "recommendationservice:examples/store-demo/app/src/recommendationservice" "shippingservice:examples/store-demo/app/src/shippingservice" ) for service_context in "${services[@]}"; do service="${service_context%%:*}" context="${service_context#*:}" image="obi-store-demo-${service}:local" docker build -t "${image}" "${context}" kind load docker-image "${image}" --name "${KIND_CLUSTER_NAME}" done ``` -------------------------------- ### Expirable LRU Cache Example Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/NOTICES/amd64/github.com/hashicorp/golang-lru/v2/README.md Illustrates the usage of an expirable LRU cache, where items are automatically removed after a specified time-to-live (TTL). This example shows adding items, retrieving them before expiration, and observing their removal after the TTL has passed. ```go package main import ( "fmt" "time" "github.com/hashicorp/golang-lru/v2/expirable" ) func main() { // make cache with 10ms TTL and 5 max keys cache := expirable.NewLRU[string, string](5, nil, time.Millisecond*10) // set value under key1. cache.Add("key1", "val1") // get value under key1 r, ok := cache.Get("key1") // check for OK value if ok { fmt.Printf("value before expiration is found: %v, value: %q\n", ok, r) } // wait for cache to expire time.Sleep(time.Millisecond * 12) // get value under key1 after key expiration r, ok = cache.Get("key1") fmt.Printf("value after expiration is found: %v, value: %q\n", ok, r) // set value under key2, would evict old entry because it is already expired. cache.Add("key2", "val2") fmt.Printf("Cache len: %d\n", cache.Len()) // Output: // value before expiration is found: true, value: "val1" // value after expiration is found: false, value: "" // Cache len: 1 } ``` -------------------------------- ### Go HTTP Context Propagation Flow (Approach 1) Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/context-propagation.md Demonstrates the flow for Go HTTP traffic using the uprobe approach for direct buffer injection, preventing tpinjector from running. ```text 1. uprobe_persistConnRoundTrip sets valid=1, written=0 in outgoing_trace_map 2. uprobe_writeSubset attempts bpf_probe_write_user: - If successful: deletes outgoing_trace_map entry - If failed: entry remains for tpinjector 3. tpinjector runs (only if entry still exists): - Schedules TCP options - Injects HTTP headers via sk_msg, sets written=1 4. protocol_http runs: - If written=1: reuses trace, deletes outgoing_trace_map - If written=0: creates new trace Result: HTTP headers (via uprobe OR sk_msg) + TCP options ✓ ``` -------------------------------- ### Run OBI on Host (Standalone) Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/apache/README.md Starts the OpenTelemetry eBPF instrumentation (OBI) agent on the host machine. It requires sufficient privileges and is configured to send data to the local OTLP endpoint. ```bash sudo OTLP_ENDPOINT=http://127.0.0.1:4318 \ obi --config="$PWD/examples/apache/standalone/obi-config.yaml" ``` -------------------------------- ### Run Python Server in Debug Mode Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/integration/components/pythonserver/README.md Starts the Python Ping Server in debug mode using the main.py script. ```bash python main.py ``` -------------------------------- ### Build Ping Wrapper Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/cmd/pingwrapper/README.md Compiles the Go source file into an executable binary named 'wrapper'. ```bash go build -o wrapper wrapper.go ``` -------------------------------- ### Configure Network Metric Attributes Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/devdocs/metrics.md Example of configuring which attributes are included for a specific network metric. This is done in the `attributes` field of the configuration. ```yaml attributes: select: obi_network_flow_bytes: include: - obi.ip - src.address - dst.address ... ``` -------------------------------- ### Run gRPC Client Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/cmd/grpc/README.md Compile and run the gRPC client. Assumes you are in the root of the grpc folder. ```sh go run client/client.go ``` -------------------------------- ### Run gRPC Server Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/internal/test/cmd/grpc/README.md Compile and run the gRPC server. Assumes you are in the root of the grpc folder. ```sh go run server/server.go ``` -------------------------------- ### Run Go Tests Source: https://github.com/open-telemetry/opentelemetry-ebpf-instrumentation/blob/main/examples/store-demo/app/src/shippingservice/README.md Executes the Go tests for the Shipping Service. Run this command from the project's root directory. ```bash go test . ```