npm
dependency manager.
For instructions with yarn
or if using TypeScript, read our OpenTelemetry Node.js documentation.Acquire Dependencies
Open your terminal, navigate to the location of your project on your drive, and install OpenTelemetry’s automatic instrumentation meta package:
npm install --save @opentelemetry/auto-instrumentations-node
Module | Description |
---|---|
auto-instrumentations-node |
OpenTelemetry’s meta package that provides a way to add automatic instrumentation to any Node application to capture telemetry data from a number of popular libraries and frameworks, like express , dns , http , and more. |
Alternatively, install individual instrumentation packages.
Initialize
Create an initialization file, commonly known as the tracing.js
file:
// Example filename: tracing.js
'use strict';
const opentelemetry = require('@opentelemetry/sdk-node');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter(),
instrumentations: [
getNodeAutoInstrumentations({
// we recommend disabling fs autoinstrumentation since it can be noisy
// and expensive during startup
'@opentelemetry/instrumentation-fs': {
enabled: false,
},
}),
],
});
sdk.start();
Configure the OpenTelemetry SDK
Use environment variables to configure the OpenTelemetry SDK:
export OTEL_SERVICE_NAME="your-service-name"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io:443" # US instance
#export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.eu1.honeycomb.io:443" # EU instance
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=your-api-key"
Variable | Description |
---|---|
OTEL_SERVICE_NAME |
Service name. When you send data, Honeycomb creates a dataset in which to store your data and uses this as the name. Can be any string. |
OTEL_EXPORTER_OTLP_PROTOCOL |
The data format that the SDK uses to send telemetry to Honeycomb. For more on data format configuration options, read Choosing between gRPC and HTTP. |
OTEL_EXPORTER_OTLP_ENDPOINT |
Honeycomb endpoint to which you want to send your data. |
OTEL_EXPORTER_OTLP_HEADERS |
Adds your Honeycomb API Key to the exported telemetry headers for authorization. Learn how to find your Honeycomb API Key. |
If you use Honeycomb Classic, you must also specify the Dataset using the x-honeycomb-dataset
header.
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=your-api-key,x-honeycomb-dataset=your-dataset"
Run Your Application
Run the Node.js app and include the initialization file you created:
node -r ./tracing.js YOUR_APPLICATION_NAME.js
Be sure to replace YOUR_APPLICATION_NAME
with the name of your application’s main file.
Alternatively, you can import the initialization file as the first step in your application lifecycle.
In Honeycomb’s UI, you should now see your application’s incoming requests and outgoing HTTP calls generate traces.
pip
package manager.
For instructions with poetry
, read our OpenTelemetry Python documentation.Acquire Dependencies
-
Install the OpenTelemetry Python packages:
python -m pip install opentelemetry-instrumentation \ opentelemetry-distro \ opentelemetry-exporter-otlp
-
Install instrumentation libraries for the packages used by your application. We recommend using the
opentelemetry-bootstrap
tool that comes with the OpenTelemetry SDK to scan your application packages and print out a list of available instrumentation libraries. You should then add these libraries to yourrequirements.txt
file:opentelemetry-bootstrap >> requirements.txt pip install -r requirements.txt
If you do not use a
requirements.txt
file, you can install the libraries directly in your current environment:opentelemetry-bootstrap --action=install
Configure the OpenTelemetry SDK
Use environment variables to configure the OpenTelemetry SDK:
export OTEL_SERVICE_NAME="your-service-name"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io:443" # US instance
#export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.eu1.honeycomb.io:443" # EU instance
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=<your-api-key>"
Variable | Description |
---|---|
OTEL_SERVICE_NAME |
Service name. When you send data, Honeycomb creates a dataset in which to store your data and uses this as the name. Can be any string. |
OTEL_EXPORTER_OTLP_PROTOCOL |
The data format that the SDK uses to send telemetry to Honeycomb. For more on data format configuration options, read Choosing between gRPC and HTTP. |
OTEL_EXPORTER_OTLP_ENDPOINT |
Honeycomb endpoint to which you want to send your data. |
OTEL_EXPORTER_OTLP_HEADERS |
Adds your Honeycomb API Key to the exported telemetry headers for authorization. Learn how to find your Honeycomb API Key. |
To learn more about configuration options, visit Agent Configuration in the OpenTelemetry documentation.
If you use Honeycomb Classic, you must also specify the Dataset using the x-honeycomb-dataset
header.
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=your-api-key,x-honeycomb-dataset=your-dataset"
Run Your Application
Run your Python application using the OpenTelemetry Python automatic instrumentation tool opentelemetry-instrument
, which configures the OpenTelemetry SDK:
opentelemetry-instrument python YOUR_APPLICATION_NAME.py
Be sure to replace YOUR_APPLICATION_NAME
with the name of your application’s main file.
In Honeycomb’s UI, you should now see your application’s incoming requests and outgoing HTTP calls generate traces.
Acquire Dependencies
The automatic instrumentation agent for OpenTelemetry Java will automatically generate trace data from your application. The agent is packaged as a JAR file and is run alongside your app.
In order to use the automatic instrumentation agent, you must first download it:
curl -L -O https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
Configure the OpenTelemetry SDK
As per the OpenTelemetry specification, you must set a service.name
resource in your SDK configuration.
The service name is used as the name of a dataset to store trace data in Honeycomb.
When using OpenTelemetry for Java, all of the following configuration properties are required:
System Property / Environment Variable |
Value |
---|---|
otel.traces.exporter OTEL_TRACES_EXPORTER |
otlp |
otel.metrics.exporter OTEL_METRICS_EXPORTER |
otlp (*) |
otel.exporter.otlp.endpoint OTEL_EXPORTER_OTLP_ENDPOINT |
https://api.honeycomb.io (US instance)https://api.eu1.honeycomb.io (EU instance) |
otel.exporter.otlp.traces.endpoint OTEL_EXPORTER_OTLP_TRACES_ENDPOINT |
https://api.honeycomb.io/v1/traces (defaults to value of OTEL_EXPORTER_OTLP_ENDPOINT ) |
otel.exporter.otlp.metrics.endpoint OTEL_EXPORTER_OTLP_METRICS_ENDPOINT |
https://api.honeycomb.io/v1/metrics (US instance) https://api.eu1.honeycomb.io/v1/metrics (EU instance)(*) |
otel.exporter.otlp.headers OTEL_EXPORTER_OTLP_HEADERS |
x-honeycomb-team=HONEYCOMB_API_KEY |
otel.exporter.otlp.traces.headers OTEL_EXPORTER_OTLP_TRACES_HEADERS |
x-honeycomb-team=HONEYCOMB_API_KEY (defaults to value of OTEL_EXPORTER_OTLP_HEADERS ) |
otel.exporter.otlp.metrics.headers OTEL_EXPORTER_OTLP_METRICS_HEADERS |
x-honeycomb-team=HONEYCOMB_API_KEY,x-honeycomb-dataset=HONEYCOMB_DATASET (*) |
otel.service.name OTEL_SERVICE_NAME |
service.name attribute to be used for all spans |
Fields marked with an asterisk (*) are required for exporting metrics to Honeycomb.
To learn more about configuration options, visit the OpenTelemetry SDK Autoconfigure GitHub repository.
Run Your Application
Run your application with the automatic instrumentation agent as a sidecar:
java -javaagent:opentelemetry-javaagent.jar -jar /path/to/myapp.jar
You can also include configuration values with an invocation of your application:
java \
-Dotel.javaagent.configuration-file=/path/to/properties/file \
-javaagent:opentelemetry-javaagent.jar \
-jar /path/to/myapp.jar
In Honeycomb’s UI, you should now see your application’s incoming requests and outgoing HTTP calls generate traces.
Acquire Dependencies
Install the OpenTelemetry .NET packages. For example, with the .NET CLI, use:
dotnet add package OpenTelemetry
dotnet add package OpenTelemetry.Extensions.Hosting
dotnet add package OpenTelemetry.Instrumentation.AspNetCore
dotnet add package OpenTelemetry.Instrumentation.Http
Initialize
Initialize the TracerProvider during application setup.
services.AddOpenTelemetry().WithTracing(builder => builder
.AddAspNetCoreInstrumentation()
.AddHttpClientInstrumentation()
.AddOtlpExporter());
Configure
Use environment variables to configure the OpenTelemetry SDK:
export OTEL_SERVICE_NAME="your-service-name"
export OTEL_EXPORTER_OTLP_PROTOCOL="http/protobuf"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io:443" # US instance
#export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.eu1.honeycomb.io:443" # EU instance
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=<your-api-key>"
Variable | Description |
---|---|
OTEL_SERVICE_NAME |
Service name. When you send data, Honeycomb creates a dataset in which to store your data and uses this as the name. Can be any string. |
OTEL_EXPORTER_OTLP_PROTOCOL |
The data format that the SDK uses to send telemetry to Honeycomb. For more on data format configuration options, read Choosing between gRPC and HTTP. |
OTEL_EXPORTER_OTLP_ENDPOINT |
Honeycomb endpoint to which you want to send your data. |
OTEL_EXPORTER_OTLP_HEADERS |
Adds your Honeycomb API Key to the exported telemetry headers for authorization. Learn how to find your Honeycomb API Key. |
Run
Run your application. You will see the incoming requests and outgoing HTTP calls generate traces.
dotnet run
In Honeycomb’s UI, you should now see your application’s incoming requests and outgoing HTTP calls generate traces.
Acquire Dependencies
Install OpenTelemetry Go packages:
go get \
github.com/honeycombio/otel-config-go/otelconfig \
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp
Initialize
Prepare your application to send spans to Honeycomb.
Open or create a file called main.go
:
package main
import (
"fmt"
"log"
"net/http"
"github.com/honeycombio/otel-config-go/otelconfig"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
)
// Implement an HTTP Handler function to be instrumented
func httpHandler(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "Hello, World")
}
func main() {
// use otelconfig to set up OpenTelemetry SDK
otelShutdown, err := otelconfig.ConfigureOpenTelemetry()
if err != nil {
log.Fatalf("error setting up OTel SDK - %e", err)
}
defer otelShutdown()
// Initialize HTTP handler instrumentation
handler := http.HandlerFunc(httpHandler)
wrappedHandler := otelhttp.NewHandler(handler, "hello")
http.Handle("/hello", wrappedHandler)
// Serve HTTP server
log.Fatal(http.ListenAndServe(":3030", nil))
}
Configure the OpenTelemetry SDK
Once you have acquired the necessary dependencies, you can configure your SDK to send events to Honeycomb, and then run your application to see traces.
export OTEL_SERVICE_NAME="your-service-name"
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io:443" # US instance
#export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.eu1.honeycomb.io:443" # EU instance
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=your-api-key"
Variable | Description |
---|---|
OTEL_EXPORTER_OTLP_ENDPOINT |
Honeycomb endpoint to which you want to send your data. |
OTEL_EXPORTER_OTLP_HEADERS |
Header containing x-honeycomb-team= , plus your API Key generated in Honeycomb. |
OTEL_SERVICE_NAME |
Service name. When you send data, Honeycomb creates a dataset in which to store your data and uses this as the name. Can be any string. |
Run Your Application
Run your application:
go run YOUR_APPLICATION_NAME.go
Be sure to replace YOUR_APPLICATION_NAME
with the name of your application’s main file.
In Honeycomb’s UI, you should now see your application’s incoming requests and outgoing HTTP calls generate traces.
Acquire Dependencies
Add these gems to your Gemfile:
gem 'opentelemetry-sdk'
gem 'opentelemetry-exporter-otlp'
gem 'opentelemetry-instrumentation-all'
Gem | Description |
---|---|
opentelemetry-sdk |
Required to create spans |
opentelemetry-exporter-otlp |
An exporter to send data in the OTLP format |
opentelemetry-instrumentation-all |
A meta package that provides instrumentation for Rails, Sinatra, several HTTP libraries, and more |
Install the gems using your terminal:
bundle install
Initialize
Initialize OpenTelemetry early in your application lifecycle. For Rails applications, we recommend that you use a Rails initializer. For other Ruby services, initialize as early as possible in the startup process.
# config/initializers/opentelemetry.rb
require 'opentelemetry/sdk'
require 'opentelemetry/exporter/otlp'
require 'opentelemetry/instrumentation/all'
OpenTelemetry::SDK.configure do |c|
c.use_all() # enables all instrumentation!
end
Configure the OpenTelemetry SDK
Use environment variables to configure OpenTelemetry to send events to Honeycomb:
export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.honeycomb.io" # US instance
#export OTEL_EXPORTER_OTLP_ENDPOINT="https://api.eu1.honeycomb.io" # EU instance
export OTEL_EXPORTER_OTLP_HEADERS="x-honeycomb-team=your-api-key"
export OTEL_SERVICE_NAME="your-service-name"
Variable | Description |
---|---|
OTEL_EXPORTER_OTLP_ENDPOINT |
Base endpoint to which you want to send your telemetry data. |
OTEL_EXPORTER_OTLP_HEADERS |
List of headers to apply to all outgoing telemetry data. Place your API Key generated in Honeycomb in the x-honeycomb-team header. Learn how to find your Honeycomb API Key. |
OTEL_SERVICE_NAME |
Service name. When you send data, Honeycomb creates a dataset in which to store your data and uses this as the name. Can be any string. |
Run Your Application
Run your Ruby application.
In Honeycomb’s UI, you should now see your application’s incoming requests and outgoing HTTP calls generate traces.
If your preferred language is not covered here, you can find relevant instrumentation information in the OpenTelemetry community documentation.
For any required configuration values, see Using the Honeycomb OpenTelemetry Endpoint.