mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-07-30 14:22:01 +08:00
feat: added docker instructions
This commit is contained in:
parent
f4e94c0ad1
commit
22d8889a07
@ -0,0 +1,106 @@
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
Run the below commands after navigating to the application source folder:
|
||||
```bash
|
||||
dotnet add package OpenTelemetry
|
||||
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
|
||||
dotnet add package OpenTelemetry.Extensions.Hosting
|
||||
dotnet add package OpenTelemetry.Instrumentation.Runtime
|
||||
dotnet add package OpenTelemetry.Instrumentation.AspNetCore
|
||||
dotnet add package OpenTelemetry.AutoInstrumentation
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Adding OpenTelemetry as a service and configuring exporter options
|
||||
|
||||
In your `Program.cs` file, add OpenTelemetry as a service. Here, we are configuring these variables:
|
||||
|
||||
`serviceName` - It is the name of your service.
|
||||
|
||||
`otlpOptions.Endpoint` - It is the endpoint for your OTel Collector agent.
|
||||
|
||||
|
||||
|
||||
Here’s a sample `Program.cs` file with the configured variables:
|
||||
|
||||
```bash
|
||||
using System.Diagnostics;
|
||||
using OpenTelemetry.Exporter;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Configure OpenTelemetry with tracing and auto-start.
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.ConfigureResource(resource =>
|
||||
resource.AddService(serviceName: "{{MYAPP}}"))
|
||||
.WithTracing(tracing => tracing
|
||||
.AddAspNetCoreInstrumentation()
|
||||
.AddOtlpExporter(otlpOptions =>
|
||||
{
|
||||
//sigNoz Cloud Endpoint
|
||||
otlpOptions.Endpoint = new Uri("https://ingest.{{REGION}}.signoz.cloud:443");
|
||||
|
||||
otlpOptions.Protocol = OtlpExportProtocol.Grpc;
|
||||
|
||||
//SigNoz Cloud account Ingestion key
|
||||
string headerKey = "signoz-access-token";
|
||||
string headerValue = "{{SIGNOZ_INGESTION_KEY}}";
|
||||
|
||||
string formattedHeader = $"{headerKey}={headerValue}";
|
||||
otlpOptions.Headers = formattedHeader;
|
||||
}));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
//The index route ("/") is set up to write out the OpenTelemetry trace information on the response:
|
||||
app.MapGet("/", () => $"Hello World! OpenTelemetry Trace: {Activity.Current?.Id}");
|
||||
|
||||
app.Run();
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
||||
The OpenTelemetry.Exporter.Options get or set the target to which the exporter is going to send traces. Here, we’re configuring it to send traces to the OTel Collector agent. The target must be a valid Uri with the scheme (http or https) and host and may contain a port and a path.
|
||||
|
||||
This is done by configuring an OpenTelemetry [TracerProvider](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/trace/customizing-the-sdk#readme) using extension methods and setting it to auto-start when the host is started.
|
||||
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Since the crucial environment variables like SIGNOZ_INGESTION_KEY, Ingestion Endpoint and Service name are set in the `program.cs` file, you don't need to add any additional steps in your Dockerfile.
|
||||
|
||||
An **example** of a Dockerfile could look like this:
|
||||
|
||||
```bash
|
||||
|
||||
# Use the Microsoft official .NET SDK image to build the application
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the CSPROJ file and restore any dependencies (via NUGET)
|
||||
COPY *.csproj ./
|
||||
RUN dotnet restore
|
||||
|
||||
# Copy the rest of the project files and build the application
|
||||
COPY . ./
|
||||
RUN dotnet publish -c Release -o out
|
||||
|
||||
# Generate the runtime image
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/out .
|
||||
|
||||
# Expose port 5145 for the application
|
||||
EXPOSE 5145
|
||||
|
||||
# Set the ASPNETCORE_URLS environment variable to listen on port 5145
|
||||
ENV ASPNETCORE_URLS=http://+:5145
|
||||
|
||||
ENTRYPOINT ["dotnet", "YOUR-APPLICATION.dll"]
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,101 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your .NET Application
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Install the following dependencies in your application.
|
||||
|
||||
```bash
|
||||
dotnet add package OpenTelemetry
|
||||
dotnet add package OpenTelemetry.Exporter.OpenTelemetryProtocol
|
||||
dotnet add package OpenTelemetry.Extensions.Hosting
|
||||
dotnet add package OpenTelemetry.Instrumentation.Runtime
|
||||
dotnet add package OpenTelemetry.Instrumentation.AspNetCore
|
||||
dotnet add package OpenTelemetry.AutoInstrumentation
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2: Adding OpenTelemetry as a service and configuring exporter options
|
||||
|
||||
In your `Program.cs` file, add OpenTelemetry as a service. Here, we are configuring these variables:
|
||||
|
||||
`serviceName` - It is the name of your service.
|
||||
|
||||
`otlpOptions.Endpoint` - It is the endpoint for your OTel Collector agent.
|
||||
|
||||
|
||||
|
||||
Here’s a sample `Program.cs` file with the configured variables:
|
||||
|
||||
```bash
|
||||
using System.Diagnostics;
|
||||
using OpenTelemetry.Exporter;
|
||||
using OpenTelemetry.Resources;
|
||||
using OpenTelemetry.Trace;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
// Configure OpenTelemetry with tracing and auto-start.
|
||||
builder.Services.AddOpenTelemetry()
|
||||
.ConfigureResource(resource =>
|
||||
resource.AddService(serviceName: "{{MYAPP}}"))
|
||||
.WithTracing(tracing => tracing
|
||||
.AddAspNetCoreInstrumentation()
|
||||
.AddOtlpExporter(otlpOptions =>
|
||||
{
|
||||
otlpOptions.Endpoint = new Uri("http://localhost:4317");
|
||||
|
||||
otlpOptions.Protocol = OtlpExportProtocol.Grpc;
|
||||
}));
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
//The index route ("/") is set up to write out the OpenTelemetry trace information on the response:
|
||||
app.MapGet("/", () => $"Hello World! OpenTelemetry Trace: {Activity.Current?.Id}");
|
||||
|
||||
app.Run();
|
||||
```
|
||||
|
||||
|
||||
The OpenTelemetry.Exporter.Options get or set the target to which the exporter is going to send traces. Here, we’re configuring it to send traces to the OTel Collector agent. The target must be a valid Uri with the scheme (http or https) and host and may contain a port and a path.
|
||||
|
||||
This is done by configuring an OpenTelemetry [TracerProvider](https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/docs/trace/customizing-the-sdk#readme) using extension methods and setting it to auto-start when the host is started.
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Since the crucial environment variables like SIGNOZ_INGESTION_KEY, Ingestion Endpoint and Service name are set in the `program.cs` file, you don't need to add any additional steps in your Dockerfile.
|
||||
|
||||
An **example** of a Dockerfile could look like this:
|
||||
|
||||
```bash
|
||||
|
||||
# Use the Microsoft official .NET SDK image to build the application
|
||||
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the CSPROJ file and restore any dependencies (via NUGET)
|
||||
COPY *.csproj ./
|
||||
RUN dotnet restore
|
||||
|
||||
# Copy the rest of the project files and build the application
|
||||
COPY . ./
|
||||
RUN dotnet publish -c Release -o out
|
||||
|
||||
# Generate the runtime image
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||
WORKDIR /app
|
||||
COPY --from=build-env /app/out .
|
||||
|
||||
# Expose port 5145 for the application
|
||||
EXPOSE 5145
|
||||
|
||||
# Set the ASPNETCORE_URLS environment variable to listen on port 5145
|
||||
ENV ASPNETCORE_URLS=http://+:5145
|
||||
|
||||
ENTRYPOINT ["dotnet", "YOUR-APPLICATION.dll"]
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
@ -0,0 +1,135 @@
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
Run the below commands after navigating to the application source folder:
|
||||
```bash
|
||||
go get go.opentelemetry.io/otel \
|
||||
go.opentelemetry.io/otel/trace \
|
||||
go.opentelemetry.io/otel/sdk \
|
||||
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin \
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace \
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
|
||||
```
|
||||
|
||||
**Note:** We are assuming you are using gin request router. If you are using other request routers, check out the [corresponding package](https://signoz.io/docs/instrumentation/golang/#request-routers).
|
||||
|
||||
|
||||
|
||||
### Step 2: Declare environment variables for configuring OpenTelemetry
|
||||
Declare the following global variables in **`main.go`** which we will use to configure OpenTelemetry:
|
||||
```bash
|
||||
var (
|
||||
serviceName = os.Getenv("SERVICE_NAME")
|
||||
collectorURL = os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
|
||||
insecure = os.Getenv("INSECURE_MODE")
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Instrument your Go application
|
||||
To configure your application to send data we will need a function to initialize OpenTelemetry. Add the following snippet of code in your **`main.go`** file.
|
||||
|
||||
```bash
|
||||
|
||||
import (
|
||||
.....
|
||||
|
||||
"google.golang.org/grpc/credentials"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
|
||||
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
)
|
||||
|
||||
func initTracer() func(context.Context) error {
|
||||
|
||||
var secureOption otlptracegrpc.Option
|
||||
|
||||
if strings.ToLower(insecure) == "false" || insecure == "0" || strings.ToLower(insecure) == "f" {
|
||||
secureOption = otlptracegrpc.WithTLSCredentials(credentials.NewClientTLSFromCert(nil, ""))
|
||||
} else {
|
||||
secureOption = otlptracegrpc.WithInsecure()
|
||||
}
|
||||
|
||||
exporter, err := otlptrace.New(
|
||||
context.Background(),
|
||||
otlptracegrpc.NewClient(
|
||||
secureOption,
|
||||
otlptracegrpc.WithEndpoint(collectorURL),
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create exporter: %v", err)
|
||||
}
|
||||
resources, err := resource.New(
|
||||
context.Background(),
|
||||
resource.WithAttributes(
|
||||
attribute.String("service.name", serviceName),
|
||||
attribute.String("library.language", "go"),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not set resources: %v", err)
|
||||
}
|
||||
|
||||
otel.SetTracerProvider(
|
||||
sdktrace.NewTracerProvider(
|
||||
sdktrace.WithSampler(sdktrace.AlwaysSample()),
|
||||
sdktrace.WithBatcher(exporter),
|
||||
sdktrace.WithResource(resources),
|
||||
),
|
||||
)
|
||||
return exporter.Shutdown
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Step 4: Initialise the tracer in **`main.go`**
|
||||
Modify the main function to initialise the tracer in **`main.go`**. Initiate the tracer at the very beginning of our main function.
|
||||
```bash
|
||||
func main() {
|
||||
cleanup := initTracer()
|
||||
defer cleanup(context.Background())
|
||||
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Step 5: Add the OpenTelemetry Gin middleware
|
||||
Configure Gin to use the middleware by adding the following lines in **`main.go`**
|
||||
```bash
|
||||
import (
|
||||
....
|
||||
"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
......
|
||||
r := gin.Default()
|
||||
r.Use(otelgin.Middleware(serviceName))
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 6: Dockerize your application
|
||||
|
||||
Set the environment variables in your Dockerfile.
|
||||
|
||||
```bash
|
||||
...
|
||||
# Set environment variables
|
||||
ENV SERVICE_NAME={{MYAPP}} \
|
||||
INSECURE_MODE=false \
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=b{{SIGNOZ_INGESTION_KEY}}" \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=ingest.{{REGION}}.signoz.cloud:443
|
||||
...
|
||||
```
|
||||
|
@ -0,0 +1,21 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,137 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Go Application
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
Run the below commands after navigating to the application source folder:
|
||||
```bash
|
||||
go get go.opentelemetry.io/otel \
|
||||
go.opentelemetry.io/otel/trace \
|
||||
go.opentelemetry.io/otel/sdk \
|
||||
go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin \
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace \
|
||||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc
|
||||
```
|
||||
|
||||
**Note:** We are assuming you are using gin request router. If you are using other request routers, check out the [corresponding package](https://signoz.io/docs/instrumentation/golang/#request-routers).
|
||||
|
||||
|
||||
|
||||
### Step 2: Declare environment variables for configuring OpenTelemetry
|
||||
Declare the following global variables in **`main.go`** which we will use to configure OpenTelemetry:
|
||||
```bash
|
||||
var (
|
||||
serviceName = os.Getenv("SERVICE_NAME")
|
||||
collectorURL = os.Getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
|
||||
insecure = os.Getenv("INSECURE_MODE")
|
||||
)
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Instrument your Go application
|
||||
To configure your application to send data we will need a function to initialize OpenTelemetry. Add the following snippet of code in your **`main.go`** file.
|
||||
|
||||
```bash
|
||||
|
||||
import (
|
||||
.....
|
||||
|
||||
"google.golang.org/grpc/credentials"
|
||||
"github.com/gin-gonic/gin"
|
||||
"go.opentelemetry.io/otel"
|
||||
"go.opentelemetry.io/otel/attribute"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
|
||||
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
|
||||
|
||||
"go.opentelemetry.io/otel/sdk/resource"
|
||||
sdktrace "go.opentelemetry.io/otel/sdk/trace"
|
||||
)
|
||||
|
||||
func initTracer() func(context.Context) error {
|
||||
|
||||
var secureOption otlptracegrpc.Option
|
||||
|
||||
if strings.ToLower(insecure) == "false" || insecure == "0" || strings.ToLower(insecure) == "f" {
|
||||
secureOption = otlptracegrpc.WithTLSCredentials(credentials.NewClientTLSFromCert(nil, ""))
|
||||
} else {
|
||||
secureOption = otlptracegrpc.WithInsecure()
|
||||
}
|
||||
|
||||
exporter, err := otlptrace.New(
|
||||
context.Background(),
|
||||
otlptracegrpc.NewClient(
|
||||
secureOption,
|
||||
otlptracegrpc.WithEndpoint(collectorURL),
|
||||
),
|
||||
)
|
||||
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to create exporter: %v", err)
|
||||
}
|
||||
resources, err := resource.New(
|
||||
context.Background(),
|
||||
resource.WithAttributes(
|
||||
attribute.String("service.name", serviceName),
|
||||
attribute.String("library.language", "go"),
|
||||
),
|
||||
)
|
||||
if err != nil {
|
||||
log.Fatalf("Could not set resources: %v", err)
|
||||
}
|
||||
|
||||
otel.SetTracerProvider(
|
||||
sdktrace.NewTracerProvider(
|
||||
sdktrace.WithSampler(sdktrace.AlwaysSample()),
|
||||
sdktrace.WithBatcher(exporter),
|
||||
sdktrace.WithResource(resources),
|
||||
),
|
||||
)
|
||||
return exporter.Shutdown
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Step 4: Initialise the tracer in **`main.go`**
|
||||
Modify the main function to initialise the tracer in **`main.go`**. Initiate the tracer at the very beginning of our main function.
|
||||
```bash
|
||||
func main() {
|
||||
cleanup := initTracer()
|
||||
defer cleanup(context.Background())
|
||||
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### Step 5: Add the OpenTelemetry Gin middleware
|
||||
Configure Gin to use the middleware by adding the following lines in **`main.go`**
|
||||
```bash
|
||||
import (
|
||||
....
|
||||
"go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin"
|
||||
)
|
||||
|
||||
func main() {
|
||||
......
|
||||
r := gin.Default()
|
||||
r.Use(otelgin.Middleware(serviceName))
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 6: Dockerize your application
|
||||
|
||||
Set the environment variables in your Dockerfile.
|
||||
|
||||
```bash
|
||||
...
|
||||
# Set environment variables
|
||||
ENV SERVICE_NAME={{MYAPP}} \
|
||||
INSECURE_MODE=true \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=localhost:4317
|
||||
...
|
||||
```
|
@ -0,0 +1,21 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
@ -1,7 +1,3 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Go Application
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Go Application
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Go Application
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
|
@ -1,7 +1,3 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your Go Application
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry Dependencies
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first.
|
||||
|
||||
|
@ -0,0 +1,71 @@
|
||||
|
||||
#### Requirements
|
||||
- Supported Versions ^4.0.0
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
// tracing.js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
// do not set headers in exporterOptions, the OTel spec recommends setting headers through ENV variables
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
|
||||
|
||||
const exporterOptions = {
|
||||
url: 'https://ingest.{{REGION}}.signoz.cloud:443/v1/traces'
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and update your run command to include the `-r` flag and `./tracing.js` file in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Use an environment variable for the Signoz Ingestion Key
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token={{SIGNOZ_INGESTION_KEY}}"
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration. app.js is your application main file.
|
||||
CMD ["node", "-r", "./tracing.js", "app.js"]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/express/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,66 @@
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your JavaScript Application
|
||||
|
||||
#### Requirements
|
||||
- Supported Versions ^4.0.0
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
// tracing.js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and update your run command to include the `-r` flag and `./tracing.js` file in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Run the app with the required OpenTelemetry configuration. app.js is your application main file.
|
||||
CMD ["node", "-r", "./tracing.js", "app.js"]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/express/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,103 @@
|
||||
#### Requirements
|
||||
- Supported Versions >= `4.0.0`
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```javascript
|
||||
'use strict';
|
||||
|
||||
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import * as opentelemetry from '@opentelemetry/sdk-node';
|
||||
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
||||
|
||||
// Configure the SDK to export telemetry data to the console
|
||||
// Enable all auto-instrumentations from the meta package
|
||||
const exporterOptions = {
|
||||
url: 'https://ingest.{{REGION}}.signoz.cloud:443/v1/traces',
|
||||
};
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}',
|
||||
}),
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start();
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
|
||||
export default sdk;
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Import tracer in the `main.js file`
|
||||
|
||||
**Important Note**: The below import should be the first line in the main file of your application (Ex -> `main.ts`)
|
||||
```bash
|
||||
const tracer = require('./tracer')
|
||||
```
|
||||
|
||||
|
||||
### Step 4: Start the tracer
|
||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
||||
|
||||
```javascript
|
||||
const tracer = require('./tracer')
|
||||
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
// All of your application code and any imports that should leverage
|
||||
// OpenTelemetry automatic instrumentation must go here.
|
||||
|
||||
async function bootstrap() {
|
||||
await tracer.start();
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(3001);
|
||||
}
|
||||
bootstrap();
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 5: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and expose port 3001 in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Use an environment variable for the Signoz Ingestion Key
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token={{SIGNOZ_INGESTION_KEY}}"
|
||||
|
||||
# In step 4 above, you are configuring your NestJS application to listen on port 3001
|
||||
EXPOSE 3001
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration.
|
||||
CMD [ "nest", "start" ]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/nestjs/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,104 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your JavaScript Application
|
||||
|
||||
#### Requirements
|
||||
- Supported Versions >= `4.0.0`
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
'use strict';
|
||||
|
||||
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import * as opentelemetry from '@opentelemetry/sdk-node';
|
||||
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
||||
|
||||
// Configure the SDK to export telemetry data to the console
|
||||
// Enable all auto-instrumentations from the meta package
|
||||
const exporterOptions = {
|
||||
url: 'http://localhost:4318/v1/traces',
|
||||
};
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}',
|
||||
}),
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start();
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
|
||||
export default sdk;
|
||||
```
|
||||
|
||||
|
||||
### Step 3: Import tracer in the `main.js file`
|
||||
|
||||
**Important Note**: The below import should be the first line in the main file of your application (Ex -> `main.ts`)
|
||||
```bash
|
||||
const tracer = require('./tracer')
|
||||
```
|
||||
|
||||
|
||||
### Step 4: Start the tracer
|
||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
||||
|
||||
```bash
|
||||
const tracer = require('./tracer')
|
||||
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
// All of your application code and any imports that should leverage
|
||||
// OpenTelemetry automatic instrumentation must go here.
|
||||
|
||||
async function bootstrap() {
|
||||
await tracer.start();
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(3001);
|
||||
}
|
||||
bootstrap();
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 5: Dockerize your application
|
||||
|
||||
Expose port 3001 in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# In step 4 above, you are configuring your NestJS application to listen on port 3001
|
||||
EXPOSE 3001
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration.
|
||||
CMD [ "nest", "start" ]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/nestjs/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,70 @@
|
||||
|
||||
#### Requirements
|
||||
- NodeJS Version 14 or newer
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
// tracing.js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
// do not set headers in exporterOptions, the OTel spec recommends setting headers through ENV variables
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
|
||||
|
||||
const exporterOptions = {
|
||||
url: 'https://ingest.{{REGION}}.signoz.cloud:443/v1/traces'
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
```
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and update your run command to include the `-r` flag and `./tracing.js` file in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Use an environment variable for the Signoz Ingestion Key
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token={{SIGNOZ_INGESTION_KEY}}"
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration. app.js is your application main file.
|
||||
CMD ["node", "-r", "./tracing.js", "app.js"]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/javascript/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your JavaScript Application
|
||||
|
||||
#### Requirements
|
||||
- NodeJS Version 14 or newer
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
// tracing.js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
```
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and update your run command to include the `-r` flag and `./tracing.js` file in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Run the app with the required OpenTelemetry configuration. app.js is your application main file.
|
||||
CMD ["node", "-r", "./tracing.js", "app.js"]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/javascript/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,70 @@
|
||||
|
||||
#### Requirements
|
||||
- NodeJS Version 14 or newer
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
// tracing.js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
// do not set headers in exporterOptions, the OTel spec recommends setting headers through ENV variables
|
||||
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
|
||||
|
||||
const exporterOptions = {
|
||||
url: 'https://ingest.{{REGION}}.signoz.cloud:443/v1/traces'
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
```
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and update your run command to include the `-r` flag and `./tracing.js` file in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Use an environment variable for the Signoz Ingestion Key
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token={{SIGNOZ_INGESTION_KEY}}"
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration. app.js is your application main file.
|
||||
CMD ["node", "-r", "./tracing.js", "app.js"]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/javascript/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,67 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to instrument your JavaScript Application
|
||||
|
||||
#### Requirements
|
||||
- NodeJS Version 14 or newer
|
||||
|
||||
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.6.0
|
||||
npm install --save @opentelemetry/sdk-node@^0.45.0
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.39.4
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.45.0
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```bash
|
||||
// tracing.js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||
const { Resource } = require('@opentelemetry/resources');
|
||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
```
|
||||
|
||||
### Step 3: Dockerize your application
|
||||
|
||||
Set the SigNoz ingestion key Environment variable and update your run command to include the `-r` flag and `./tracing.js` file in Dockerfile as:
|
||||
|
||||
```bash
|
||||
...
|
||||
# Run the app with the required OpenTelemetry configuration. app.js is your application main file.
|
||||
CMD ["node", "-r", "./tracing.js", "app.js"]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/javascript/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,85 @@
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/context-zone
|
||||
npm install --save @opentelemetry/instrumentation
|
||||
npm install --save @opentelemetry/auto-instrumentations-web
|
||||
npm install --save @opentelemetry/sdk-trace-base
|
||||
npm install --save @opentelemetry/sdk-trace-web
|
||||
npm install --save @opentelemetry/resources
|
||||
npm install --save @opentelemetry/semantic-conventions
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```javascript
|
||||
// tracing.js
|
||||
import { ZoneContextManager } from '@opentelemetry/context-zone';
|
||||
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
||||
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web';
|
||||
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
||||
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
||||
|
||||
const provider = new WebTracerProvider({
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}',
|
||||
}),
|
||||
});
|
||||
const exporter = new OTLPTraceExporter({
|
||||
url: 'https://ingest.{{REGION}}.signoz.cloud:443/v1/traces',
|
||||
headers: {
|
||||
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}",
|
||||
},
|
||||
});
|
||||
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
|
||||
|
||||
provider.register({
|
||||
// Changing default contextManager to use ZoneContextManager - supports asynchronous operations so that traces are not broken
|
||||
contextManager: new ZoneContextManager(),
|
||||
});
|
||||
|
||||
// Registering instrumentations
|
||||
registerInstrumentations({
|
||||
instrumentations: [
|
||||
getWebAutoInstrumentations({
|
||||
|
||||
'@opentelemetry/instrumentation-xml-http-request': {
|
||||
propagateTraceHeaderCorsUrls: [
|
||||
/.+/g, //Regex to match your backend urls.
|
||||
],
|
||||
},
|
||||
'@opentelemetry/instrumentation-fetch': {
|
||||
propagateTraceHeaderCorsUrls: [
|
||||
/.+/g, //Regex to match your backend urls.
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
```
|
||||
### Step 3: Import tracer in main file
|
||||
|
||||
**Important Note**: The below import should be the first line in the main file of your application (Ex -> `index.js`)
|
||||
```bash
|
||||
import './tracing.js'
|
||||
|
||||
// ...rest of the app's entry point code
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 4: Dockerize your application
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration.
|
||||
CMD [ "npm", "start" ]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult this [documentation](https://signoz.io/docs/instrumentation/reactjs/) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,79 @@
|
||||
|
||||
### Step 1: Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/context-zone
|
||||
npm install --save @opentelemetry/instrumentation
|
||||
npm install --save @opentelemetry/auto-instrumentations-web
|
||||
npm install --save @opentelemetry/sdk-trace-base
|
||||
npm install --save @opentelemetry/sdk-trace-web
|
||||
npm install --save @opentelemetry/resources
|
||||
npm install --save @opentelemetry/semantic-conventions
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http
|
||||
```
|
||||
|
||||
|
||||
### Step 2: Create tracing.js file
|
||||
|
||||
```javascript
|
||||
// tracing.js
|
||||
import { ZoneContextManager } from '@opentelemetry/context-zone';
|
||||
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
||||
import { getWebAutoInstrumentations } from '@opentelemetry/auto-instrumentations-web';
|
||||
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
||||
import { WebTracerProvider } from '@opentelemetry/sdk-trace-web';
|
||||
import { Resource } from '@opentelemetry/resources';
|
||||
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
|
||||
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
||||
|
||||
const provider = new WebTracerProvider({
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: '{{MYAPP}}',
|
||||
}),
|
||||
});
|
||||
const exporter = new OTLPTraceExporter({
|
||||
url: 'http://localhost:4318/v1/traces',
|
||||
});
|
||||
provider.addSpanProcessor(new BatchSpanProcessor(exporter));
|
||||
|
||||
provider.register({
|
||||
// Changing default contextManager to use ZoneContextManager - supports asynchronous operations so that traces are not broken
|
||||
contextManager: new ZoneContextManager(),
|
||||
});
|
||||
|
||||
// Registering instrumentations
|
||||
registerInstrumentations({
|
||||
instrumentations: [
|
||||
getWebAutoInstrumentations({
|
||||
|
||||
'@opentelemetry/instrumentation-xml-http-request': {
|
||||
propagateTraceHeaderCorsUrls: [
|
||||
/.+/g, //Regex to match your backend urls.
|
||||
],
|
||||
},
|
||||
'@opentelemetry/instrumentation-fetch': {
|
||||
propagateTraceHeaderCorsUrls: [
|
||||
/.+/g, //Regex to match your backend urls.
|
||||
],
|
||||
},
|
||||
}),
|
||||
],
|
||||
});
|
||||
```
|
||||
### Step 3: Import tracer in main file
|
||||
|
||||
**Important Note**: The below import should be the first line in the main file of your application (Ex -> `index.js`)
|
||||
```bash
|
||||
import './tracing.js'
|
||||
// ...rest of the app's entry point code
|
||||
```
|
||||
|
||||
### Step 4: Dockerize your application
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Run the app with the required OpenTelemetry configuration.
|
||||
CMD [ "npm", "start" ]
|
||||
...
|
||||
```
|
@ -0,0 +1,28 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
```bash
|
||||
docker run <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
|
||||
If you encounter any difficulties, please consult this [documentation](https://signoz.io/docs/instrumentation/reactjs/) for assistance.
|
@ -0,0 +1,54 @@
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
- for Django, you must define `DJANGO_SETTINGS_MODULE` correctly. If your project is called `mysite`, something like following should work:
|
||||
```bash
|
||||
export DJANGO_SETTINGS_MODULE=mysite.settings
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{REGION}.signoz.cloud:443
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}}
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/django/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,59 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to Dockerize your Python Application
|
||||
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
- for Django, you must define `DJANGO_SETTINGS_MODULE` correctly. If your project is called `mysite`, something like following should work:
|
||||
```bash
|
||||
export DJANGO_SETTINGS_MODULE=mysite.settings
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your Dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/django/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,51 @@
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{REGION}.signoz.cloud:443
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}}
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py`
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/falcon/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to Dockerize your Python Application
|
||||
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your Dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/falcon/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,51 @@
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{REGION}.signoz.cloud:443
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}}
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/fastapi/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to Dockerize your Python Application
|
||||
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your Dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/fastapi/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,50 @@
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
#(Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{REGION}.signoz.cloud:443
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}}
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py` or `flask run`
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/flask/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to Dockerize your Python Application
|
||||
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your Dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py` or `flask run`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/flask/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,51 @@
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{REGION}.signoz.cloud:443
|
||||
ENV OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}}
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py`
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,29 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/python/#troubleshooting-your-installation) for assistance.
|
@ -0,0 +1,12 @@
|
||||
## Setup OpenTelemetry Binary as an agent
|
||||
|
||||
|
||||
|
||||
As a first step, you should install the OTel collector Binary according to the instructions provided on [this link](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
|
||||
|
||||
Once you are done setting up the OTel collector binary, you can follow the next steps.
|
||||
|
||||
|
||||
|
@ -0,0 +1,56 @@
|
||||
|
||||
|
||||
After setting up the Otel collector agent, follow the steps below to Dockerize your Python Application
|
||||
|
||||
#### Requirements
|
||||
- Python 3.8 or newer
|
||||
|
||||
|
||||
|
||||
|
||||
### Step 1 : Add OpenTelemetry dependencies
|
||||
|
||||
In your `requirements.txt` file, add these two OpenTelemetry dependencies:
|
||||
|
||||
|
||||
```bash
|
||||
opentelemetry-distro==0.43b0
|
||||
opentelemetry-exporter-otlp==1.22.0
|
||||
|
||||
```
|
||||
|
||||
|
||||
|
||||
### Step 2 : Dockerize your application
|
||||
|
||||
Update your Dockerfile along with OpenTelemetry instructions as shown below:
|
||||
|
||||
```bash
|
||||
...
|
||||
|
||||
# Install any needed packages specified in requirements.txt
|
||||
# And install OpenTelemetry packages
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
RUN opentelemetry-bootstrap --action=install
|
||||
|
||||
# (Optional) Make port 5000 available to the world outside this container (You can choose your own port for this)
|
||||
EXPOSE 5000
|
||||
|
||||
# Set environment variables for OpenTelemetry
|
||||
ENV OTEL_RESOURCE_ATTRIBUTES=service.name={{MYAPP}}
|
||||
ENV OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
|
||||
ENV OTEL_EXPORTER_OTLP_PROTOCOL=grpc
|
||||
|
||||
# Run app.py with OpenTelemetry instrumentation when the container launches
|
||||
CMD ["opentelemetry-instrument", "<your_run_command>"]
|
||||
...
|
||||
```
|
||||
|
||||
- <your_run_command> can be `python3 app.py`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -0,0 +1,25 @@
|
||||
Once you update your Dockerfile, you can build and run it using the commands below.
|
||||
|
||||
### Step 1: Build your dockerfile
|
||||
|
||||
Build your docker image
|
||||
|
||||
```bash
|
||||
docker build -t <your-image-name> .
|
||||
```
|
||||
|
||||
- `<<your-image-name>` is the name of your Docker Image
|
||||
|
||||
|
||||
|
||||
### Step 2: Run your docker image
|
||||
|
||||
The Docker run command starts a container in detached mode (-d) and maps port 5000 of the host to port 5000 of the container.
|
||||
|
||||
```bash
|
||||
docker run -d -p 5000:5000 <your-image-name>
|
||||
```
|
||||
|
||||
**Note**
|
||||
|
||||
If you encounter any difficulties, please consult the [troubleshooting section](https://signoz.io/docs/instrumentation/python/#troubleshooting-your-installation) for assistance.
|
@ -30,6 +30,10 @@ const supportedEnvironments: SupportedEnvironmentsProps[] = [
|
||||
name: 'MacOS ARM64',
|
||||
id: 'macOsARM64',
|
||||
},
|
||||
{
|
||||
name: 'Docker',
|
||||
id: 'docker',
|
||||
},
|
||||
];
|
||||
|
||||
export default function EnvironmentDetails(): JSX.Element {
|
||||
@ -55,6 +59,18 @@ export default function EnvironmentDetails(): JSX.Element {
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (
|
||||
selectedModule?.id !== useCases.APM.id &&
|
||||
environment.id === 'docker'
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (
|
||||
selectedModule?.id !== useCases.APM.id &&
|
||||
environment.id === 'docker'
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Card
|
||||
|
@ -403,6 +403,11 @@ import APM_javascript_reactjs_macOsARM64_quickStart_runApplication from '../Modu
|
||||
import APM_javascript_reactjs_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Javascript/md-docs/ReactJS/MacOsARM64/Recommended/reactjs-macosarm64-recommended-installOtelCollector.md';
|
||||
import APM_javascript_reactjs_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Javascript/md-docs/ReactJS/MacOsARM64/Recommended/reactjs-macosarm64-recommended-instrumentApplication.md';
|
||||
import APM_javascript_reactjs_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Javascript/md-docs/ReactJS/MacOsARM64/Recommended/reactjs-macosarm64-recommended-runApplication.md';
|
||||
import APM_python_django_docker_quickStart_instrumentApplication from '../Modules/APM/Python/md-docs/Django/Docker/QuickStart/django-docker-quickStart-instrumentApplication.md';
|
||||
import APM_python_django_docker_quickStart_runApplication from '../Modules/APM/Python/md-docs/Django/Docker/QuickStart/django-docker-quickStart-runApplication.md';
|
||||
import APM_python_django_docker_recommendedSteps_setupOtelCollector from '../Modules/APM/Python/md-docs/Django/Docker/Recommended/django-docker-recommended-installOtelCollector.md';
|
||||
import APM_python_django_docker_recommendedSteps_instrumentApplication from '../Modules/APM/Python/md-docs/Django/Docker/Recommended/django-docker-recommended-instrumentApplication.md';
|
||||
import APM_python_django_docker_recommendedSteps_runApplication from '../Modules/APM/Python/md-docs/Django/Docker/Recommended/django-docker-recommended-runApplication.md';
|
||||
/// ////// Javascript Done
|
||||
/// ///// Python Start
|
||||
// Django
|
||||
@ -903,6 +908,14 @@ export const ApmDocFilePaths = {
|
||||
APM_python_django_macOsARM64_quickStart_instrumentApplication,
|
||||
APM_python_django_macOsARM64_quickStart_runApplication,
|
||||
|
||||
// Django Docker
|
||||
APM_python_django_docker_quickStart_instrumentApplication,
|
||||
APM_python_django_docker_quickStart_runApplication,
|
||||
|
||||
APM_python_django_docker_recommendedSteps_setupOtelCollector,
|
||||
APM_python_django_docker_recommendedSteps_instrumentApplication,
|
||||
APM_python_django_docker_recommendedSteps_runApplication,
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
||||
// Flask
|
||||
|
@ -14,6 +14,7 @@ export function extractDomain(email: string): string {
|
||||
|
||||
export const isCloudUser = (): boolean => {
|
||||
const { hostname } = window.location;
|
||||
return true;
|
||||
|
||||
return hostname?.endsWith('signoz.cloud');
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user