mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-13 03:09:06 +08:00
docs: updated APM docs (#3548)
* docs: updated APM docs * feat: signoz cloud - update logs management and infra monitoring docs --------- Co-authored-by: Yunus A M <myounis.ar@live.com>
This commit is contained in:
parent
ed809474d6
commit
2fc82ffa59
@ -1,7 +1,6 @@
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
<Tabs>
|
||||
<TabItem value="vm" label="VM" default>
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
@ -11,6 +10,7 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
1. **Install Dependencies**<br></br>
|
||||
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first. Note that we are assuming you are using `gin` request router. If you are using other request routers, check out the [corresponding package](#request-routers).
|
||||
|
||||
Run the below commands after navigating to the application source folder:
|
||||
@ -25,6 +25,7 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
```
|
||||
|
||||
2. **Declare environment variables for configuring OpenTelemetry**<br></br>
|
||||
|
||||
Declare the following global variables in `main.go` which we will use to configure OpenTelemetry:
|
||||
|
||||
```bash
|
||||
@ -36,6 +37,7 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
```
|
||||
|
||||
3. **Instrument your Go application with OpenTelemetry**<br></br>
|
||||
|
||||
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.
|
||||
|
||||
```go
|
||||
@ -97,7 +99,9 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
```
|
||||
|
||||
4. **Initialize the tracer in main.go**<br></br>
|
||||
|
||||
Modify the main function to initialise the tracer in `main.go`. Initiate the tracer at the very beginning of our main function.
|
||||
|
||||
```go
|
||||
func main() {
|
||||
cleanup := initTracer()
|
||||
@ -106,7 +110,9 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
5. **Add the OpenTelemetry Gin middleware**<br></br>
|
||||
|
||||
Configure Gin to use the middleware by adding the following lines in `main.go`.
|
||||
|
||||
```go
|
||||
@ -124,6 +130,7 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
```
|
||||
|
||||
6. **Set environment variables and run your Go Gin application**<br></br>
|
||||
|
||||
The run command must have some environment variables to send data to SigNoz cloud. The run command:
|
||||
|
||||
```bash
|
||||
@ -138,11 +145,13 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
`OTEL_EXPORTER_OTLP_ENDPOINT`: ingest.{region}.signoz.cloud:443. Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
|
||||
---
|
||||
|
||||
@ -153,6 +162,7 @@ OTel Collector binary helps to collect logs, hostmetrics, resource and infra att
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Golang application.
|
||||
|
||||
1. **Install Dependencies**<br></br>
|
||||
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first. Note that we are assuming you are using `gin` request router. If you are using other request routers, check out the [corresponding package](#request-routers).
|
||||
|
||||
Run the below commands after navigating to the application source folder:
|
||||
@ -167,6 +177,7 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
||||
```
|
||||
|
||||
2. **Declare environment variables for configuring OpenTelemetry**<br></br>
|
||||
|
||||
Declare the following global variables in `main.go` which we will use to configure OpenTelemetry:
|
||||
|
||||
```go
|
||||
@ -178,6 +189,7 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
||||
```
|
||||
|
||||
3. **Instrument your Go application with OpenTelemetry**<br></br>
|
||||
|
||||
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.
|
||||
|
||||
```go
|
||||
@ -237,10 +249,10 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
||||
return exporter.Shutdown
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
4. **Initialize the tracer in main.go**<br></br>
|
||||
|
||||
Modify the main function to initialise the tracer in `main.go`. Initiate the tracer at the very beginning of our main function.
|
||||
|
||||
```go
|
||||
func main() {
|
||||
cleanup := initTracer()
|
||||
@ -249,8 +261,11 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
5. **Add the OpenTelemetry Gin middleware**<br></br>
|
||||
|
||||
Configure Gin to use the middleware by adding the following lines in `main.go`.
|
||||
|
||||
```go
|
||||
import (
|
||||
....
|
||||
@ -264,7 +279,9 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
6. **Set environment variables and run your Go Gin application**<br></br>
|
||||
|
||||
The run command must have some environment variables to send data to SigNoz. The run command:
|
||||
|
||||
```bash
|
||||
@ -274,17 +291,16 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
||||
If you want to update your `service_name`, you can modify the `SERVICE_NAME` variable.<br></br>
|
||||
`SERVICE_NAME`: goGinApp (you can name it whatever you want)
|
||||
|
||||
7. You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
---
|
||||
|
||||
</TabItem>
|
||||
|
||||
<TabItem value="k8s" label="Kubernetes">
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Golang application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Golang instrumentation by following the below steps:
|
||||
|
||||
1. **Install Dependencies**<br></br>
|
||||
|
||||
Dependencies related to OpenTelemetry exporter and SDK have to be installed first. Note that we are assuming you are using `gin` request router. If you are using other request routers, check out the [corresponding package](#request-routers).
|
||||
|
||||
Run the below commands after navigating to the application source folder:
|
||||
@ -299,6 +315,7 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Go
|
||||
```
|
||||
|
||||
2. **Declare environment variables for configuring OpenTelemetry**<br></br>
|
||||
|
||||
Declare the following global variables in `main.go` which we will use to configure OpenTelemetry:
|
||||
|
||||
```go
|
||||
@ -310,6 +327,7 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Go
|
||||
```
|
||||
|
||||
3. **Instrument your Go application with OpenTelemetry**<br></br>
|
||||
|
||||
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.
|
||||
|
||||
```go
|
||||
@ -369,10 +387,10 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Go
|
||||
return exporter.Shutdown
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
4. **Initialize the tracer in main.go**<br></br>
|
||||
|
||||
Modify the main function to initialise the tracer in `main.go`. Initiate the tracer at the very beginning of our main function.
|
||||
|
||||
```go
|
||||
func main() {
|
||||
cleanup := initTracer()
|
||||
@ -381,8 +399,11 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Go
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
5. **Add the OpenTelemetry Gin middleware**<br></br>
|
||||
|
||||
Configure Gin to use the middleware by adding the following lines in `main.go`.
|
||||
|
||||
```go
|
||||
import (
|
||||
....
|
||||
@ -396,7 +417,9 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Go
|
||||
......
|
||||
}
|
||||
```
|
||||
|
||||
6. **Set environment variables and run your Go Gin application**<br></br>
|
||||
|
||||
The run command must have some environment variables to send data to SigNoz. The run command:
|
||||
|
||||
```bash
|
||||
@ -405,8 +428,3 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Go
|
||||
|
||||
If you want to update your `service_name`, you can modify the `SERVICE_NAME` variable.<br></br>
|
||||
`SERVICE_NAME`: goGinApp (you can name it whatever you want)
|
||||
|
||||
7. You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
@ -1,9 +1,15 @@
|
||||
## Requirements
|
||||
|
||||
Java 8 or higher
|
||||
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
OpenTelemetry provides a handy Java JAR agent that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks.
|
||||
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
@ -33,11 +39,12 @@ java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <my-app>.jar
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
|
||||
---
|
||||
|
||||
@ -62,6 +69,10 @@ java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <myapp>.jar
|
||||
- `<myapp>` is the name of your application jar file
|
||||
- In case you download `opentelemetry-javaagent.jar` file in different directory than that of the project, replace `$PWD` with the path of the otel jar file.
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Java application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||
@ -83,4 +94,3 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry ja
|
||||
|
||||
3. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
||||
|
||||
You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
|
@ -1,5 +1,21 @@
|
||||
## Send traces directly to SigNoz Cloud
|
||||
## Requirements
|
||||
|
||||
Java 8 or higher
|
||||
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
OpenTelemetry provides a handy Java JAR agent that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks.
|
||||
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
OpenTelemetry Java agent can send traces directly to SigNoz Cloud.
|
||||
|
||||
Step 1. Download otel java binary agent
|
||||
@ -24,7 +40,6 @@ JAVA_OPTS="-javaagent:/path/opentelemetry-javaagent.jar
|
||||
-Dotel.exporter.otlp.headers="signoz-access-token=SIGNOZ_INGESTION_KEY"
|
||||
-Dotel.resource.attributes="service.name=<app_name>""
|
||||
```
|
||||
|
||||
You need to replace the following things based on your environment:<br></br>
|
||||
|
||||
- `path` - Update it to the path of your downloaded Java JAR agent.<br></br>
|
||||
@ -33,18 +48,19 @@ You need to replace the following things based on your environment:<br></br>
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
|
||||
Step 4. [Optional] Write the output/logs of standalone.sh script to a file nohup.out as a background thread
|
||||
|
||||
```bash
|
||||
/opt/jboss-eap-7.1/bin/standalone.sh > /opt/jboss-eap-7.1/bin/nohup.out &
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
#### **Send traces via OTel Collector binary**
|
||||
@ -54,11 +70,11 @@ OTel Collector binary helps to collect logs, hostmetrics, resource and infra att
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Java application.
|
||||
|
||||
Step 1. Download OTel java binary agent<br></br>
|
||||
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
|
||||
```
|
||||
|
||||
|
||||
Step 2. Open the configuration file
|
||||
|
||||
```bash
|
||||
@ -74,9 +90,12 @@ JAVA_OPTS="-javaagent:/path/opentelemetry-javaagent.jar"
|
||||
```
|
||||
|
||||
where,
|
||||
|
||||
- `path` - Update it to the path of your downloaded Java JAR agent.<br></br>
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Java application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||
@ -102,9 +121,7 @@ JAVA_OPTS="-javaagent:/path/opentelemetry-javaagent.jar"
|
||||
```
|
||||
|
||||
where,
|
||||
|
||||
- `path` - Update it to the path of your downloaded Java JAR agent.<br></br>
|
||||
|
||||
Step 4. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
||||
|
||||
You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
Step 4. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
@ -1,5 +1,21 @@
|
||||
## Send traces directly to SigNoz Cloud
|
||||
## Requirements
|
||||
|
||||
Java 8 or higher
|
||||
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
OpenTelemetry provides a handy Java JAR agent that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks.
|
||||
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
OpenTelemetry Java agent can send traces directly to SigNoz Cloud.
|
||||
|
||||
Step 1. Download otel java binary agent
|
||||
@ -16,17 +32,16 @@ OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443 \
|
||||
java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <my-app>.jar
|
||||
```
|
||||
|
||||
- `<app_name>` is the name for your application
|
||||
- `SIGNOZ_INGESTION_KEY` is the API token provided by SigNoz. You can find your ingestion key from SigNoz cloud account details sent on your email.
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
---
|
||||
|
||||
@ -37,7 +52,6 @@ OTel Collector binary helps to collect logs, hostmetrics, resource and infra att
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Java application.
|
||||
|
||||
Step 1. Download OTel java binary agent<br></br>
|
||||
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
|
||||
```
|
||||
@ -51,8 +65,9 @@ java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <myapp>.jar
|
||||
- `<myapp>` is the name of your application jar file
|
||||
- In case you download `opentelemetry-javaagent.jar` file in different directory than that of the project, replace `$PWD` with the path of the otel jar file.
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="k8s" label="Kubernetes">
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Java application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
@ -74,8 +89,3 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry ja
|
||||
- In case you download `opentelemetry-javaagent.jar` file in different directory than that of the project, replace `$PWD` with the path of the otel jar file.
|
||||
|
||||
3. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
||||
|
||||
You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
|
||||
</TabItem>
|
||||
</Tabs>
|
||||
|
@ -1,16 +1,21 @@
|
||||
## Requirements
|
||||
|
||||
Java 8 or higher
|
||||
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
OpenTelemetry provides a handy Java JAR agent that can be attached to any Java 8+ application and dynamically injects bytecode to capture telemetry from a number of popular libraries and frameworks.
|
||||
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
OpenTelemetry Java agent can send traces directly to SigNoz Cloud.
|
||||
|
||||
Step 1. Download otel java binary agent
|
||||
@ -25,6 +30,7 @@ If you run your `.war` package by putting in `webapps` folder, just add `setenv.
|
||||
|
||||
This should set these environment variables and start sending telemetry data to SigNoz Cloud.
|
||||
|
||||
|
||||
```bash
|
||||
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
|
||||
export OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY"
|
||||
@ -37,11 +43,11 @@ export OTEL_RESOURCE_ATTRIBUTES=service.name=<app_name>
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
---
|
||||
|
||||
@ -52,7 +58,6 @@ OTel Collector binary helps to collect logs, hostmetrics, resource and infra att
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Java application.
|
||||
|
||||
Step 1. Download OTel java binary agent<br></br>
|
||||
|
||||
```bash
|
||||
wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
|
||||
```
|
||||
@ -63,12 +68,17 @@ If you run your `.war` package by putting in `webapps` folder, just add `setenv.
|
||||
|
||||
This should set these environment variables and start sending telemetry data to SigNoz Cloud.
|
||||
|
||||
|
||||
```bash
|
||||
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
|
||||
```
|
||||
|
||||
- path/to - Update it to the path of your downloaded Java JAR agent.
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Java application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||
|
@ -6,7 +6,6 @@ import Header from 'container/OnboardingContainer/common/Header/Header';
|
||||
import { useState } from 'react';
|
||||
|
||||
import ConnectionStatus from '../common/ConnectionStatus/ConnectionStatus';
|
||||
import AngularDocs from './md-docs/angular.md';
|
||||
import ExpressDocs from './md-docs/express.md';
|
||||
import JavascriptDocs from './md-docs/javascript.md';
|
||||
import NestJsDocs from './md-docs/nestjs.md';
|
||||
@ -14,8 +13,7 @@ import NestJsDocs from './md-docs/nestjs.md';
|
||||
const frameworksMap = {
|
||||
express: 'Express',
|
||||
nestjs: 'Nest JS',
|
||||
angular: 'Angular',
|
||||
other: 'Others',
|
||||
nodejs: 'Nodejs',
|
||||
};
|
||||
|
||||
export default function Javascript({
|
||||
@ -23,20 +21,18 @@ export default function Javascript({
|
||||
}: {
|
||||
activeStep: number;
|
||||
}): JSX.Element {
|
||||
const [selectedFrameWork, setSelectedFrameWork] = useState('express');
|
||||
const [selectedFrameWork, setSelectedFrameWork] = useState('nodejs');
|
||||
|
||||
const [form] = Form.useForm();
|
||||
|
||||
const renderDocs = (): JSX.Element => {
|
||||
switch (selectedFrameWork) {
|
||||
case 'express':
|
||||
return <ExpressDocs />;
|
||||
case 'nodejs':
|
||||
return <JavascriptDocs />;
|
||||
case 'nestjs':
|
||||
return <NestJsDocs />;
|
||||
case 'angular':
|
||||
return <AngularDocs />;
|
||||
default:
|
||||
return <JavascriptDocs />;
|
||||
return <ExpressDocs />;
|
||||
}
|
||||
};
|
||||
|
||||
@ -62,6 +58,10 @@ export default function Javascript({
|
||||
placeholder="Select Framework"
|
||||
onChange={(value): void => setSelectedFrameWork(value)}
|
||||
options={[
|
||||
{
|
||||
value: 'nodejs',
|
||||
label: frameworksMap.nodejs,
|
||||
},
|
||||
{
|
||||
value: 'express',
|
||||
label: frameworksMap.express,
|
||||
@ -70,14 +70,6 @@ export default function Javascript({
|
||||
value: 'nestjs',
|
||||
label: frameworksMap.nestjs,
|
||||
},
|
||||
{
|
||||
value: 'angular',
|
||||
label: frameworksMap.angular,
|
||||
},
|
||||
{
|
||||
value: 'other',
|
||||
label: frameworksMap.other,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
|
@ -1,57 +0,0 @@
|
||||
## Instrumenting your Angular App with OpenTelemetry 🛠
|
||||
|
||||
#### Pre-requisites
|
||||
|
||||
Enable CORS in the OTel Receiver. Inside `docker/clickhouse-setup/otel-collector-config.yaml` add the following CORS config. You can view the file at [SigNoz GitHub repo](https://github.com/SigNoz/signoz/blob/develop/deploy/docker/clickhouse-setup/otel-collector-config.yaml).
|
||||
|
||||
```yml
|
||||
http:
|
||||
+ cors:
|
||||
+ allowed_origins:
|
||||
+ - https://netflix.com # URL of your Frontend application
|
||||
```
|
||||
|
||||
> Make sure to restart the container after making the config changes
|
||||
|
||||
Now let's get back to instrumenting our Angular Application. Let's start by installing a couple of dependencies.
|
||||
|
||||
```sh
|
||||
npm i @jufab/opentelemetry-angular-interceptor && npm i @opentelemetry/api @opentelemetry/sdk-trace-web @opentelemetry/sdk-trace-base @opentelemetry/core @opentelemetry/semantic-conventions @opentelemetry/resources @opentelemetry/exporter-trace-otlp-http @opentelemetry/exporter-zipkin @opentelemetry/propagator-b3 @opentelemetry/propagator-jaeger @opentelemetry/context-zone-peer-dep @opentelemetry/instrumentation @opentelemetry/instrumentation-document-load @opentelemetry/instrumentation-fetch @opentelemetry/instrumentation-xml-http-request @opentelemetry/propagator-aws-xray --save-dev
|
||||
```
|
||||
|
||||
Not let's import OTel module in `app.module.ts`
|
||||
|
||||
```ts
|
||||
import {
|
||||
OpenTelemetryInterceptorModule,
|
||||
OtelColExporterModule,
|
||||
CompositePropagatorModule,
|
||||
} from '@jufab/opentelemetry-angular-interceptor';
|
||||
|
||||
@NgModule({
|
||||
...
|
||||
imports: [
|
||||
...
|
||||
OpenTelemetryInterceptorModule.forRoot({
|
||||
commonConfig: {
|
||||
console: true, // Display trace on console (only in DEV env)
|
||||
production: false, // Send Trace with BatchSpanProcessor (true) or SimpleSpanProcessor (false)
|
||||
serviceName: 'Angular Sample App', // Service name send in trace
|
||||
probabilitySampler: '1',
|
||||
},
|
||||
otelcolConfig: {
|
||||
url: 'http://127.0.0.1:4318/v1/traces', // URL of opentelemetry collector
|
||||
},
|
||||
}),
|
||||
//Insert OtelCol exporter module
|
||||
OtelColExporterModule,
|
||||
//Insert propagator module
|
||||
CompositePropagatorModule,
|
||||
],
|
||||
...
|
||||
})
|
||||
```
|
||||
|
||||
This config would be enough to get you up and running. For more tweaks refer to [this](https://github.com/jufab/opentelemetry-angular-interceptor#readme) detailed documentation of the instrumentation library.
|
||||
|
||||
Facing difficulties with instrumenting your application? Check out this video tutorial 👇
|
@ -1,132 +1,213 @@
|
||||
## Send Traces Directly to SigNoz
|
||||
## Requirements
|
||||
|
||||
### Using the all-in-one auto-instrumentation library
|
||||
Supported Versions
|
||||
|
||||
The recommended way to instrument your Express application is to use the all-in-one auto-instrumentation library - `@opentelemetry/auto-instrumentations-node`. It provides a simple way to initialize multiple Nodejs instrumentations.
|
||||
^4.0.0
|
||||
|
||||
Internally, it calls the specific auto-instrumentation library for components used in the application. You can see the complete list [here](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#supported-instrumentations).
|
||||
## Send traces to SigNoz Cloud
|
||||
|
||||
#### Steps to auto-instrument Express application
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
1. Install the dependencies<br></br>
|
||||
We start by installing the relevant dependencies.
|
||||
### Application on VMs
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/sdk-node
|
||||
npm install --save @opentelemetry/auto-instrumentations-node
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http
|
||||
```
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
The dependencies included are briefly explained below:<br></br>
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
`@opentelemetry/sdk-node` - This package provides the full OpenTelemetry SDK for Node.js including tracing and metrics.<br></br>
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
`@opentelemetry/auto-instrumentations-node` - This module provides a simple way to initialize multiple Node instrumentations.<br></br>
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
`@opentelemetry/exporter-trace-otlp-http` - This module provides the exporter to be used with OTLP (`http/json`) compatible receivers.<br></br>
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
<VersionPin />
|
||||
Step 2. Create tracing.js file<br></br>
|
||||
|
||||
2. **Create a `tracing.js` file**<br></br>
|
||||
The `tracing.js` file will contain the tracing setup code. Notice, that we have set some environment variables in the code(highlighted). You can update these variables based on your environment.
|
||||
You need to configure the endpoint for SigNoz cloud in this file. You can find your ingestion key from SigNoz cloud account details sent on your email.
|
||||
|
||||
````jsx
|
||||
// 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');
|
||||
```js
|
||||
// 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 = {
|
||||
// highlight-next-line
|
||||
url: 'http://localhost:4318/v1/traces'
|
||||
}
|
||||
// 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 traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
// highlight-start
|
||||
const exporterOptions = {
|
||||
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
||||
}
|
||||
// highlight-end
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
// highlight-start
|
||||
resource: new Resource({
|
||||
// highlight-next-line
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||
})
|
||||
// highlight-end
|
||||
});
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
// 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', () => {
|
||||
// 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));
|
||||
});
|
||||
```
|
||||
});
|
||||
```
|
||||
|
||||
OpenTelemetry Node SDK currently does not detect the `OTEL_RESOURCE_ATTRIBUTES` from `.env` files as of today. That’s why we need to include the variables in the `tracing.js` file itself.
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
About environment variables:
|
||||
US - ingest.us.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
`service_name` : node_app (you can give whatever name that suits you)
|
||||
IN - ingest.in.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
`http://localhost:4318/v1/traces` is the default url for sending your tracing data. We are assuming you have installed SigNoz on your `localhost`. Based on your environment, you can update it accordingly. It should be in the following format:
|
||||
EU - ingest.eu.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
`http://<IP of SigNoz backend>:4318/v1/traces`
|
||||
Step 3. Run the application<br></br>
|
||||
|
||||
Here’s a handy [grid](https://signoz.io/docs/instrumentation/troubleshoot-instrumentation/) to figure out which address to use to send data to SigNoz.
|
||||
Make sure you set the `OTEL_EXPORTER_OTLP_HEADERS` env as follows
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" node -r ./tracing.js app.js
|
||||
```
|
||||
|
||||
:::note
|
||||
Remember to allow incoming requests to port 4318 of machine where SigNoz backend is hosted.
|
||||
`SIGNOZ_INGESTION_KEY` is the API token provided by SigNoz. You can find your ingestion key from SigNoz cloud account details sent on your email.
|
||||
|
||||
---
|
||||
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Javascript application.
|
||||
|
||||
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
3. **Run the application**<br></br>
|
||||
The tracing configuration should be run before your application code. We will use the [`-r, —require module`](https://nodejs.org/api/cli.html#cli_r_require_module) flag for that.<br></br>
|
||||
```js
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
```jsx
|
||||
node -r ./tracing.js app.js
|
||||
```
|
||||
Step 2. Create tracing.js file<br></br>
|
||||
|
||||
:::note
|
||||
If you're running your nodejs application in PM2 cluster mode, it doesn't support node args: [Unitech/pm2#3227](https://github.com/Unitech/pm2/issues/3227). As above sample app instrumentation requires to load `tracing.js` before app load by passing node arg, so nodejs instrumentation doesn't work in PM2 cluster mode. So you need to import `tracing.js` in your main application. The `import ./tracing.js` should be the first line of your application code and initialize it before any other function. Here's the [sample github repo](https://github.com/SigNoz/sample-nodejs-app/tree/init-tracer-main) which shows the implementation.
|
||||
:::
|
||||
```js
|
||||
// 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');
|
||||
|
||||
### Validating instrumentation by checking for traces
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
// highlight-next-line
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||
})
|
||||
});
|
||||
|
||||
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start()
|
||||
|
||||
Validate your traces in SigNoz:
|
||||
// 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));
|
||||
});
|
||||
```
|
||||
|
||||
1. Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
|
||||
2. In SigNoz, open the `Services` tab. Hit the `Refresh` button on the top right corner, and your application should appear in the list of `Applications`.
|
||||
3. Go to the `Traces` tab, and apply relevant filters to see your application’s traces.
|
||||
Step 3. Run the application<br></br>
|
||||
```bash
|
||||
node -r ./tracing.js app.js
|
||||
```
|
||||
---
|
||||
|
||||
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs [here](https://signoz.io/docs/operate/docker-standalone/#remove-the-sample-application).
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
<figure data-zoomable align='center'>
|
||||
<img src="/img/docs/express_application_services_list.webp" alt="Nestjs Application in the list of services being monitored in SigNoz"/>
|
||||
<figcaption><i>Express Application in the list of services being monitored in SigNoz</i></figcaption>
|
||||
</figure>
|
||||
For Javascript application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
<br></br>
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Javascript instrumentation by following the below steps:
|
||||
|
||||
If you don't see your application reported in the list of services, try our [troubleshooting](https://signoz.io/docs/install/troubleshooting/) guide.
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
### Using a specific auto-instrumentation library
|
||||
Step 2. Create tracing.js file<br></br>
|
||||
|
||||
If you want to instrument only your Express framework, then you need to use the following package:
|
||||
```js
|
||||
// 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');
|
||||
|
||||
```jsx
|
||||
npm install --save @opentelemetry/instrumentation-express
|
||||
````
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
Note that in the above case, you will have to install packages for all the components that you want to instrument with OpenTelemetry individually. You can find detailed instructions [here](https://signoz.io/docs/instrumentation/javascript/#using-a-specific-auto-instrumentation-library).
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
// highlight-next-line
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||
})
|
||||
});
|
||||
|
||||
// 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. Run the application<br></br>
|
||||
|
||||
```bash
|
||||
node -r ./tracing.js app.js
|
||||
```
|
@ -1,7 +1,13 @@
|
||||
## Requirements
|
||||
|
||||
- Node.js version 14 or newer ([See here](https://github.com/open-telemetry/opentelemetry-js#supported-runtimes))<br></br>
|
||||
|
||||
## Send traces to SigNoz Cloud
|
||||
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
@ -11,39 +17,34 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
```js
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-grpc@^0.39.1
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
Step 2. Create tracing.js file<br></br>
|
||||
|
||||
You need to configure the endpoint for SigNoz cloud in this file. You can find your ingestion key from SigNoz cloud account details sent on your email.
|
||||
|
||||
```js
|
||||
// tracing.js
|
||||
'use strict';
|
||||
'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-grpc');
|
||||
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 { 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
|
||||
|
||||
// highlight-start
|
||||
const exporterOptions = {
|
||||
url: 'https://ingest.{region}.signoz.cloud:443',
|
||||
};
|
||||
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
||||
}
|
||||
// highlight-end
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
@ -52,18 +53,17 @@ const sdk = new opentelemetry.NodeSDK({
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
// highlight-next-line
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app',
|
||||
}),
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start();
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
@ -72,13 +72,14 @@ process.on('SIGTERM', () => {
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
US - ingest.us.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
Step 3. Run the application<br></br>
|
||||
|
||||
Make sure you set the `OTEL_EXPORTER_OTLP_HEADERS` env as follows
|
||||
|
||||
```bash
|
||||
@ -87,15 +88,13 @@ OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" node -r
|
||||
|
||||
`SIGNOZ_INGESTION_KEY` is the API token provided by SigNoz. You can find your ingestion key from SigNoz cloud account details sent on your email.
|
||||
|
||||
Step 4. You can validate if your application is sending traces to SigNoz cloud [here](#validating-instrumentation-by-checking-for-traces).
|
||||
---
|
||||
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
:::note
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Javascript application.
|
||||
:::
|
||||
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
@ -103,30 +102,24 @@ Step 1. Install OpenTelemetry packages
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-grpc@^0.39.1
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
Step 2. Create tracing.js file<br></br>
|
||||
|
||||
```js
|
||||
// tracing.js
|
||||
'use strict';
|
||||
'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-grpc');
|
||||
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 { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4317',
|
||||
};
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
@ -134,18 +127,17 @@ const sdk = new opentelemetry.NodeSDK({
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
// highlight-next-line
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app',
|
||||
}),
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start();
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
@ -158,10 +150,9 @@ Step 3. Run the application<br></br>
|
||||
node -r ./tracing.js app.js
|
||||
```
|
||||
|
||||
Step 4. You can validate if your application is sending traces to SigNoz cloud [here](#validating-instrumentation-by-checking-for-traces).
|
||||
---
|
||||
|
||||
</TabItem>
|
||||
<TabItem value="k8s" label="Kubernetes">
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Javascript application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
@ -173,30 +164,24 @@ Step 1. Install OpenTelemetry packages
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-grpc@^0.39.1
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
Step 2. Create tracing.js file<br></br>
|
||||
|
||||
```js
|
||||
// tracing.js
|
||||
'use strict';
|
||||
'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-grpc');
|
||||
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 { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||
|
||||
const exporterOptions = {
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4317',
|
||||
};
|
||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
@ -204,18 +189,17 @@ const sdk = new opentelemetry.NodeSDK({
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
// highlight-next-line
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app',
|
||||
}),
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start();
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
@ -223,9 +207,6 @@ process.on('SIGTERM', () => {
|
||||
```
|
||||
|
||||
Step 3. Run the application<br></br>
|
||||
|
||||
```bash
|
||||
node -r ./tracing.js app.js
|
||||
```
|
||||
|
||||
Step 4. You can validate if your application is sending traces to SigNoz cloud [here](#validating-instrumentation-by-checking-for-traces).
|
||||
|
@ -1,89 +1,105 @@
|
||||
## Send Traces Directly to SigNoz
|
||||
## Requirements
|
||||
|
||||
### Using the all-in-one auto-instrumentation library
|
||||
**Supported Versions**
|
||||
|
||||
The recommended way to instrument your Nestjs application is to use the all-in-one auto-instrumentation library - `@opentelemetry/auto-instrumentations-node`. It provides a simple way to initialize multiple Nodejs instrumentations.
|
||||
- `>=4.0.0`
|
||||
|
||||
Internally, it calls the specific auto-instrumentation library for components used in the application. You can see the complete list [here](https://github.com/open-telemetry/opentelemetry-js-contrib/tree/main/metapackages/auto-instrumentations-node#supported-instrumentations).
|
||||
## Send traces to SigNoz Cloud
|
||||
|
||||
#### Steps to auto-instrument Nestjs application
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
1. Install the dependencies<br></br>
|
||||
We start by installing the relevant dependencies.
|
||||
### Application on VMs
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/sdk-node
|
||||
npm install --save @opentelemetry/auto-instrumentations-node
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http
|
||||
```
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
<NestjsPinnedVersions />
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
2. Create a `tracer.ts` file
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
```jsx
|
||||
'use strict';
|
||||
const process = require('process');
|
||||
//OpenTelemetry
|
||||
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');
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
const exporterOptions = {
|
||||
url: 'http://localhost:4318/v1/traces',
|
||||
};
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
Step 2. Create `tracer.ts` file<br></br>
|
||||
|
||||
You need to configure the endpoint for SigNoz cloud in this file.
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
//OpenTelemetry
|
||||
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 = {
|
||||
// highlight-start
|
||||
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
||||
// highlight-end
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'sampleNestjsApplication',
|
||||
}),
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'sampleNestjsApplication'
|
||||
})
|
||||
});
|
||||
|
||||
// initialize the SDK and register with the OpenTelemetry API
|
||||
// this enables the API to record telemetry
|
||||
sdk.start();
|
||||
sdk.start()
|
||||
|
||||
// gracefully shut down the SDK on process exit
|
||||
process.on('SIGTERM', () => {
|
||||
sdk
|
||||
.shutdown()
|
||||
sdk.shutdown()
|
||||
.then(() => console.log('Tracing terminated'))
|
||||
.catch((error) => console.log('Error terminating tracing', error))
|
||||
.finally(() => process.exit(0));
|
||||
});
|
||||
|
||||
module.exports = sdk;
|
||||
```
|
||||
module.exports = sdk
|
||||
```
|
||||
|
||||
3. Import the tracer module where your app starts
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
```jsx
|
||||
const tracer = require('./tracer');
|
||||
```
|
||||
US - ingest.us.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
4. Start the tracer<br></br>
|
||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
||||
IN - ingest.in.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
```jsx
|
||||
const tracer = require('./tracer');
|
||||
EU - ingest.eu.signoz.cloud:443/v1/traces <br></br>
|
||||
|
||||
import { NestFactory } from '@nestjs/core';
|
||||
import { AppModule } from './app.module';
|
||||
|
||||
|
||||
Step 3. Import the tracer module where your app starts
|
||||
|
||||
```jsx
|
||||
const tracer = require('./tracer')
|
||||
```
|
||||
|
||||
|
||||
Step 4. Start the tracer<br></br>
|
||||
|
||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
||||
|
||||
```jsx
|
||||
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() {
|
||||
async function bootstrap() {
|
||||
// highlight-start
|
||||
await tracer.start();
|
||||
//highlight-end
|
||||
@ -91,39 +107,194 @@ Internally, it calls the specific auto-instrumentation library for components us
|
||||
await app.listen(3001);
|
||||
}
|
||||
bootstrap();
|
||||
```
|
||||
|
||||
You can now run your Nestjs application. The data captured with OpenTelemetry from your application should start showing on the SigNoz dashboard.
|
||||
|
||||
### Validating instrumentation by checking for traces
|
||||
|
||||
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
|
||||
|
||||
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
|
||||
|
||||
Validate your traces in SigNoz:
|
||||
|
||||
1. Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
|
||||
2. In SigNoz, open the `Services` tab. Hit the `Refresh` button on the top right corner, and your application should appear in the list of `Applications`.
|
||||
3. Go to the `Traces` tab, and apply relevant filters to see your application’s traces.
|
||||
|
||||
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs [here](https://signoz.io/docs/operate/docker-standalone/#remove-the-sample-application).
|
||||
|
||||
<figure data-zoomable align='center'>
|
||||
<img src="/img/docs/nestjs_application_instrumented.webp" alt="Nestjs Application in the list of services being monitored in SigNoz"/>
|
||||
<figcaption><i>Nestjs Application in the list of services being monitored in SigNoz</i></figcaption>
|
||||
</figure>
|
||||
|
||||
<br></br>
|
||||
|
||||
If you don't see your application reported in the list of services, try our [troubleshooting](https://signoz.io/docs/install/troubleshooting/) guide.
|
||||
|
||||
### Using a specific auto-instrumentation library
|
||||
|
||||
If you want to instrument only your Nestjs framework, then you need to use the following package:
|
||||
|
||||
```jsx
|
||||
npm install --save @opentelemetry/instrumentation-nestjs-core
|
||||
```
|
||||
|
||||
Note that in the above case, you will have to install packages for all the components that you want to instrument with OpenTelemetry individually. You can find detailed instructions [here](https://signoz.io/docs/instrumentation/javascript/#using-a-specific-auto-instrumentation-library).
|
||||
Step 5. Run the application
|
||||
|
||||
```bash
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" nest start
|
||||
```
|
||||
|
||||
You can now run your Nestjs application. The data captured with OpenTelemetry from your application should start showing on the SigNoz dashboard.
|
||||
|
||||
`SIGNOZ_INGESTION_KEY` is the API token provided by SigNoz. You can find your ingestion key from SigNoz cloud account details sent on your email.
|
||||
|
||||
---
|
||||
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Javascript application.
|
||||
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
```js
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
Step 2. Create `tracer.ts` file<br></br>
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
//OpenTelemetry
|
||||
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 = {
|
||||
// highlight-start
|
||||
url: 'http://localhost:4318/v1/traces'
|
||||
// highlight-end
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'sampleNestjsApplication'
|
||||
})
|
||||
});
|
||||
|
||||
// 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));
|
||||
});
|
||||
|
||||
module.exports = sdk
|
||||
```
|
||||
|
||||
Step 3. Import the tracer module where your app starts
|
||||
|
||||
```jsx
|
||||
const tracer = require('./tracer')
|
||||
```
|
||||
|
||||
|
||||
Step 4. Start the tracer<br></br>
|
||||
|
||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
||||
|
||||
```jsx
|
||||
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() {
|
||||
// highlight-start
|
||||
await tracer.start();
|
||||
//highlight-end
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(3001);
|
||||
}
|
||||
bootstrap();
|
||||
```
|
||||
|
||||
Step 5. Run the application
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Javascript application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Javascript instrumentation by following the below steps:
|
||||
|
||||
Step 1. Install OpenTelemetry packages
|
||||
|
||||
```bash
|
||||
npm install --save @opentelemetry/api@^1.4.1
|
||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||
```
|
||||
|
||||
Step 2. Create `tracer.ts` file<br></br>
|
||||
|
||||
```js
|
||||
'use strict'
|
||||
const process = require('process');
|
||||
//OpenTelemetry
|
||||
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 = {
|
||||
// highlight-start
|
||||
url: 'http://localhost:4318/v1/traces'
|
||||
// highlight-end
|
||||
}
|
||||
|
||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||
const sdk = new opentelemetry.NodeSDK({
|
||||
traceExporter,
|
||||
instrumentations: [getNodeAutoInstrumentations()],
|
||||
resource: new Resource({
|
||||
[SemanticResourceAttributes.SERVICE_NAME]: 'sampleNestjsApplication'
|
||||
})
|
||||
});
|
||||
|
||||
// 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));
|
||||
});
|
||||
|
||||
module.exports = sdk
|
||||
```
|
||||
|
||||
Step 3. Import the tracer module where your app starts
|
||||
|
||||
```jsx
|
||||
const tracer = require('./tracer')
|
||||
```
|
||||
|
||||
|
||||
Step 4. Start the tracer<br></br>
|
||||
|
||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
||||
|
||||
```jsx
|
||||
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() {
|
||||
// highlight-start
|
||||
await tracer.start();
|
||||
//highlight-end
|
||||
const app = await NestFactory.create(AppModule);
|
||||
await app.listen(3001);
|
||||
}
|
||||
bootstrap();
|
||||
```
|
||||
|
||||
Step 5. Run the application
|
@ -1,92 +1,186 @@
|
||||
## Send Traces Directly to SigNoz
|
||||
## Requirements
|
||||
|
||||
You can use OpenTelemetry to send your traces directly to SigNoz. OpenTelemetry provides a handy distro in Python that can help you get started with automatic instrumentation. We recommend using it to get started quickly.
|
||||
- Python 3.8 or newer
|
||||
|
||||
### Steps to auto-instrument Django app for traces
|
||||
|
||||
1. **Create a virtual environment**<br></br>
|
||||
- for Django, you must define `DJANGO_SETTINGS_MODULE`correctly. If your project is called `mysite`, something like following should work:
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
export DJANGO_SETTINGS_MODULE=mysite.settings
|
||||
```
|
||||
|
||||
2. **Install the OpenTelemetry dependencies**<br></br>
|
||||
Please refer the official [Django docs](https://docs.djangoproject.com/en/1.10/topics/settings/#designating-the-settings) for more details.
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro
|
||||
pip install opentelemetry-exporter-otlp
|
||||
```
|
||||
|
||||
The dependencies included are briefly explained below:
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
`opentelemetry-distro` - The distro provides a mechanism to automatically configure some of the more common options for users. It helps to get started with OpenTelemetry auto-instrumentation quickly.
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
`opentelemetry-exporter-otlp` - This library provides a way to install all OTLP exporters. You will need an exporter to send the data to SigNoz.
|
||||
### Application on VMs
|
||||
|
||||
:::note
|
||||
💡 The `opentelemetry-exporter-otlp` is a convenient wrapper package to install all OTLP exporters. Currently, it installs:
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- opentelemetry-exporter-otlp-proto-http
|
||||
- opentelemetry-exporter-otlp-proto-grpc
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
- (soon) opentelemetry-exporter-otlp-json-http
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
The `opentelemetry-exporter-otlp-proto-grpc` package installs the gRPC exporter which depends on the `grpcio` package. The installation of `grpcio` may fail on some platforms for various reasons. If you run into such issues, or you don't want to use gRPC, you can install the HTTP exporter instead by installing the `opentelemetry-exporter-otlp-proto-http` package. You need to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable to `http/protobuf` to use the HTTP exporter.
|
||||
:::
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
3. **Add automatic instrumentation**<br></br>
|
||||
The below command inspects the dependencies of your application and installs the instrumentation packages relevant for your Django application.
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
:::note
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
:::
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
4. **Run your application**<br></br>
|
||||
In the final run command, you can configure environment variables and flags. Flags for exporters:<br></br>
|
||||
<!-- The dependencies included are briefly explained below:
|
||||
|
||||
For running your application, there are a few things that you need to keep in mind. Below are the notes:
|
||||
:::note
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, you can disable the auto reload with `--noreload`.
|
||||
:::
|
||||
`opentelemetry-distro` - The distro provides a mechanism to automatically configure some of the more common options for users. It helps to get started with OpenTelemetry auto-instrumentation quickly.
|
||||
|
||||
For running applications with application servers which are based on [pre fork model](#running-applications-with-gunicorn-uwsgi), like Gunicorn, uWSGI you have to add a post_fork hook or a @postfork decorator in your configuration.
|
||||
`opentelemetry-exporter-otlp` - This library provides a way to install all OTLP exporters. You will need an exporter to send the data to SigNoz.
|
||||
|
||||
To start sending data to SigNoz, use the following run command:
|
||||
:::note
|
||||
💡 The `opentelemetry-exporter-otlp` is a convenience wrapper package to install all OTLP exporters. Currently, it installs:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> OTEL_EXPORTER_OTLP_ENDPOINT="http://<IP of SigNoz Backend>:4317" OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
- opentelemetry-exporter-otlp-proto-http
|
||||
- opentelemetry-exporter-otlp-proto-grpc
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
- (soon) opentelemetry-exporter-otlp-json-http
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
The `opentelemetry-exporter-otlp-proto-grpc` package installs the gRPC exporter which depends on the `grpcio` package. The installation of `grpcio` may fail on some platforms for various reasons. If you run into such issues, or you don't want to use gRPC, you can install the HTTP exporter instead by installing the `opentelemetry-exporter-otlp-proto-http` package. You need to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable to `http/protobuf` to use the HTTP exporter.
|
||||
::: -->
|
||||
|
||||
`IP of SigNoz backend` is the IP of the machine where you installed SigNoz. If you have installed SigNoz on `localhost`, the endpoint will be `http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
:::note
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively. Remember to allow incoming requests to port **4317**/**4318** of machine where SigNoz backend is hosted.
|
||||
:::
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
### Validating instrumentation by checking for traces
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
|
||||
Step 4. Run your application
|
||||
|
||||
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||
opentelemetry-instrument <your_run_command>
|
||||
```
|
||||
|
||||
Validate your traces in SigNoz:
|
||||
- `<service_name>` is the name of the service you want
|
||||
- <your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
- Replace `SIGNOZ_INGESTION_KEY` with the api token provided by SigNoz. You can find it in the email sent by SigNoz with your cloud account details.
|
||||
|
||||
1. Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
|
||||
2. In SigNoz, open the `Services` tab. Hit the `Refresh` button on the top right corner, and your application should appear in the list of `Applications`.
|
||||
3. Go to the `Traces` tab, and apply relevant filters to see your application’s traces.
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs [here](https://signoz.io/docs/operate/docker-standalone/#remove-the-sample-application).
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, you can disable the auto reload with `--noreload`.
|
||||
|
||||
---
|
||||
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Python application.
|
||||
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Step 4. To run your application and send data to collector in same VM:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
- <service_name> is the name of service you want
|
||||
|
||||
- <your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
- `http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Python application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Python instrumentation by following the below steps:
|
||||
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Step 4. Run your application:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
<service_name> is the name of service you want
|
||||
|
||||
<your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
Note:
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
Step 5. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
||||
|
||||
<figure data-zoomable align='center'>
|
||||
<img src="/img/docs/opentelemetry_python_app_instrumented.webp" alt="Python Application in the list of services being monitored in SigNoz"/>
|
||||
<figcaption><i>Python Application in the list of services being monitored in SigNoz</i></figcaption></figure>
|
||||
<br></br>
|
||||
|
@ -1,92 +1,185 @@
|
||||
## Send Traces Directly to SigNoz
|
||||
## Requirements
|
||||
|
||||
You can use OpenTelemetry to send your traces directly to SigNoz. OpenTelemetry provides a handy distro in Python that can help you get started with automatic instrumentation. We recommend using it to get started quickly.
|
||||
- Python 3.8 or newer
|
||||
|
||||
### Steps to auto-instrument Falcon app for traces
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
1. **Create a virtual environment**<br></br>
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
### Application on VMs
|
||||
|
||||
2. **Install the OpenTelemetry dependencies**<br></br>
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro
|
||||
pip install opentelemetry-exporter-otlp
|
||||
```
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
The dependencies included are briefly explained below:
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
`opentelemetry-distro` - The distro provides a mechanism to automatically configure some of the more common options for users. It helps to get started with OpenTelemetry auto-instrumentation quickly.
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
`opentelemetry-exporter-otlp` - This library provides a way to install all OTLP exporters. You will need an exporter to send the data to SigNoz.
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
:::note
|
||||
💡 The `opentelemetry-exporter-otlp` is a convenience wrapper package to install all OTLP exporters. Currently, it installs:
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
- opentelemetry-exporter-otlp-proto-http
|
||||
- opentelemetry-exporter-otlp-proto-grpc
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
- (soon) opentelemetry-exporter-otlp-json-http
|
||||
<!-- The dependencies included are briefly explained below:
|
||||
|
||||
The `opentelemetry-exporter-otlp-proto-grpc` package installs the gRPC exporter which depends on the `grpcio` package. The installation of `grpcio` may fail on some platforms for various reasons. If you run into such issues, or you don't want to use gRPC, you can install the HTTP exporter instead by installing the `opentelemetry-exporter-otlp-proto-http` package. You need to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable to `http/protobuf` to use the HTTP exporter.
|
||||
:::
|
||||
`opentelemetry-distro` - The distro provides a mechanism to automatically configure some of the more common options for users. It helps to get started with OpenTelemetry auto-instrumentation quickly.
|
||||
|
||||
3. **Add automatic instrumentation**<br></br>
|
||||
The below command inspects the dependencies of your application and installs the instrumentation packages relevant for your Falcon application.
|
||||
`opentelemetry-exporter-otlp` - This library provides a way to install all OTLP exporters. You will need an exporter to send the data to SigNoz.
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
:::note
|
||||
💡 The `opentelemetry-exporter-otlp` is a convenience wrapper package to install all OTLP exporters. Currently, it installs:
|
||||
|
||||
:::note
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
:::
|
||||
- opentelemetry-exporter-otlp-proto-http
|
||||
- opentelemetry-exporter-otlp-proto-grpc
|
||||
|
||||
4. **Run your application**<br></br>
|
||||
In the final run command, you can configure environment variables and flags. Flags for exporters:<br></br>
|
||||
- (soon) opentelemetry-exporter-otlp-json-http
|
||||
|
||||
For running your application, there are a few things that you need to keep in mind. Below are the notes:
|
||||
:::note
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation.
|
||||
:::
|
||||
The `opentelemetry-exporter-otlp-proto-grpc` package installs the gRPC exporter which depends on the `grpcio` package. The installation of `grpcio` may fail on some platforms for various reasons. If you run into such issues, or you don't want to use gRPC, you can install the HTTP exporter instead by installing the `opentelemetry-exporter-otlp-proto-http` package. You need to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable to `http/protobuf` to use the HTTP exporter.
|
||||
::: -->
|
||||
|
||||
For running applications with application servers which are based on [pre fork model](#running-applications-with-gunicorn-uwsgi), like Gunicorn, uWSGI you have to add a post_fork hook or a @postfork decorator in your configuration.
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
To start sending data to SigNoz, use the following run command:
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> OTEL_EXPORTER_OTLP_ENDPOINT="http://<IP of SigNoz Backend>:4317" OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
Step 4. Run your application
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||
opentelemetry-instrument <your_run_command>
|
||||
```
|
||||
|
||||
`IP of SigNoz backend` is the IP of the machine where you installed SigNoz. If you have installed SigNoz on `localhost`, the endpoint will be `http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
- *`<service_name>`* is the name of the service you want
|
||||
- *<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
- Replace `SIGNOZ_INGESTION_KEY` with the api token provided by SigNoz. You can find it in the email sent by SigNoz with your cloud account details.
|
||||
|
||||
:::note
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively. Remember to allow incoming requests to port **4317**/**4318** of machine where SigNoz backend is hosted.
|
||||
:::
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
### Validating instrumentation by checking for traces
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
Validate your traces in SigNoz:
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, you can disable the auto reload with `--noreload`.
|
||||
|
||||
1. Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
|
||||
2. In SigNoz, open the `Services` tab. Hit the `Refresh` button on the top right corner, and your application should appear in the list of `Applications`.
|
||||
3. Go to the `Traces` tab, and apply relevant filters to see your application’s traces.
|
||||
---
|
||||
|
||||
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs [here](https://signoz.io/docs/operate/docker-standalone/#remove-the-sample-application).
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
<figure data-zoomable align='center'>
|
||||
<img src="/img/docs/opentelemetry_python_app_instrumented.webp" alt="Python Application in the list of services being monitored in SigNoz"/>
|
||||
<figcaption><i>Python Application in the list of services being monitored in SigNoz</i></figcaption></figure>
|
||||
<br></br>
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Python application.
|
||||
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
Step 4. To run your application and send data to collector in same VM:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation.
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
Note:
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Python application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Python instrumentation by following the below steps:
|
||||
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
Step 4. Run your application:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation.
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
Note:
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
Step 5. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
@ -1,92 +1,163 @@
|
||||
## Send Traces Directly to SigNoz
|
||||
## Requirements
|
||||
|
||||
You can use OpenTelemetry to send your traces directly to SigNoz. OpenTelemetry provides a handy distro in Python that can help you get started with automatic instrumentation. We recommend using it to get started quickly.
|
||||
- Python 3.8 or newer
|
||||
|
||||
### Steps to auto-instrument FastAPI app for traces
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
1. **Create a virtual environment**<br></br>
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
### Application on VMs
|
||||
|
||||
2. **Install the OpenTelemetry dependencies**<br></br>
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro
|
||||
pip install opentelemetry-exporter-otlp
|
||||
```
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
The dependencies included are briefly explained below:
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
`opentelemetry-distro` - The distro provides a mechanism to automatically configure some of the more common options for users. It helps to get started with OpenTelemetry auto-instrumentation quickly.
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
`opentelemetry-exporter-otlp` - This library provides a way to install all OTLP exporters. You will need an exporter to send the data to SigNoz.
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
:::note
|
||||
💡 The `opentelemetry-exporter-otlp` is a convenience wrapper package to install all OTLP exporters. Currently, it installs:
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
- opentelemetry-exporter-otlp-proto-http
|
||||
- opentelemetry-exporter-otlp-proto-grpc
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
- (soon) opentelemetry-exporter-otlp-json-http
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
The `opentelemetry-exporter-otlp-proto-grpc` package installs the gRPC exporter which depends on the `grpcio` package. The installation of `grpcio` may fail on some platforms for various reasons. If you run into such issues, or you don't want to use gRPC, you can install the HTTP exporter instead by installing the `opentelemetry-exporter-otlp-proto-http` package. You need to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable to `http/protobuf` to use the HTTP exporter.
|
||||
:::
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
3. **Add automatic instrumentation**<br></br>
|
||||
The below command inspects the dependencies of your application and installs the instrumentation packages relevant for your FastAPI application.
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
Step 4. Run your application
|
||||
|
||||
:::note
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
:::
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||
opentelemetry-instrument <your_run_command>
|
||||
```
|
||||
|
||||
4. **Run your application**<br></br>
|
||||
In the final run command, you can configure environment variables and flags. Flags for exporters:<br></br>
|
||||
- *`<service_name>`* is the name of the service you want
|
||||
- *<your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
- Replace `SIGNOZ_INGESTION_KEY` with the api token provided by SigNoz. You can find it in the email sent by SigNoz with your cloud account details.
|
||||
|
||||
For running your application, there are a few things that you need to keep in mind. Below are the notes:
|
||||
:::note
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, if you use `--reload` or `reload=True`, it enables the reloader mode which breaks OpenTelemetry isntrumentation.
|
||||
:::
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
For running applications with application servers which are based on [pre fork model](#running-applications-with-gunicorn-uwsgi), like Gunicorn, uWSGI you have to add a post_fork hook or a @postfork decorator in your configuration.
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
To start sending data to SigNoz, use the following run command:
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> OTEL_EXPORTER_OTLP_ENDPOINT="http://<IP of SigNoz Backend>:4317" OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, you can disable the auto reload with `--noreload`.
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
---
|
||||
|
||||
`IP of SigNoz backend` is the IP of the machine where you installed SigNoz. If you have installed SigNoz on `localhost`, the endpoint will be `http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
:::note
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively. Remember to allow incoming requests to port **4317**/**4318** of machine where SigNoz backend is hosted.
|
||||
:::
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
### Validating instrumentation by checking for traces
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Python application.
|
||||
|
||||
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Validate your traces in SigNoz:
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
1. Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
|
||||
2. In SigNoz, open the `Services` tab. Hit the `Refresh` button on the top right corner, and your application should appear in the list of `Applications`.
|
||||
3. Go to the `Traces` tab, and apply relevant filters to see your application’s traces.
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs [here](https://signoz.io/docs/operate/docker-standalone/#remove-the-sample-application).
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
<figure data-zoomable align='center'>
|
||||
<img src="/img/docs/opentelemetry_python_app_instrumented.webp" alt="Python Application in the list of services being monitored in SigNoz"/>
|
||||
<figcaption><i>Python Application in the list of services being monitored in SigNoz</i></figcaption></figure>
|
||||
<br></br>
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
Step 4. To run your application and send data to collector in same VM:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
Note:
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Python application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Python instrumentation by following the below steps:
|
||||
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
Step 4. Run your application:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
Note:
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
Step 5. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
@ -1,92 +1,168 @@
|
||||
## Send Traces Directly to SigNoz
|
||||
## Requirements
|
||||
|
||||
You can use OpenTelemetry to send your traces directly to SigNoz. OpenTelemetry provides a handy distro in Python that can help you get started with automatic instrumentation. We recommend using it to get started quickly.
|
||||
- Python 3.8 or newer
|
||||
|
||||
### Steps to auto-instrument Flask app for traces
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
1. **Create a virtual environment**<br></br>
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
### Application on VMs
|
||||
|
||||
2. **Install the OpenTelemetry dependencies**<br></br>
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro
|
||||
pip install opentelemetry-exporter-otlp
|
||||
```
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
- [Send traces via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||
|
||||
The dependencies included are briefly explained below:
|
||||
#### **Send traces directly to SigNoz Cloud**
|
||||
|
||||
`opentelemetry-distro` - The distro provides a mechanism to automatically configure some of the more common options for users. It helps to get started with OpenTelemetry auto-instrumentation quickly.
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
`opentelemetry-exporter-otlp` - This library provides a way to install all OTLP exporters. You will need an exporter to send the data to SigNoz.
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
:::note
|
||||
💡 The `opentelemetry-exporter-otlp` is a convenience wrapper package to install all OTLP exporters. Currently, it installs:
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
- opentelemetry-exporter-otlp-proto-http
|
||||
- opentelemetry-exporter-otlp-proto-grpc
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
- (soon) opentelemetry-exporter-otlp-json-http
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
The `opentelemetry-exporter-otlp-proto-grpc` package installs the gRPC exporter which depends on the `grpcio` package. The installation of `grpcio` may fail on some platforms for various reasons. If you run into such issues, or you don't want to use gRPC, you can install the HTTP exporter instead by installing the `opentelemetry-exporter-otlp-proto-http` package. You need to set the `OTEL_EXPORTER_OTLP_PROTOCOL` environment variable to `http/protobuf` to use the HTTP exporter.
|
||||
:::
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
3. **Add automatic instrumentation**<br></br>
|
||||
The below command inspects the dependencies of your application and installs the instrumentation packages relevant for your Flask application.
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
Step 4. Run your application
|
||||
|
||||
:::note
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
:::
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||
opentelemetry-instrument <your_run_command>
|
||||
```
|
||||
|
||||
4. **Run your application**<br></br>
|
||||
In the final run command, you can configure environment variables and flags. Flags for exporters:<br></br>
|
||||
- *`<service_name>`* is the name of the service you want
|
||||
- *<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
- Replace `SIGNOZ_INGESTION_KEY` with the api token provided by SigNoz. You can find it in the email sent by SigNoz with your cloud account details.
|
||||
|
||||
For running your application, there are a few things that you need to keep in mind. Below are the notes:
|
||||
:::note
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, if you use `export Flask_ENV=development`, it enables the reloader mode which breaks OpenTelemetry instrumentation.
|
||||
:::
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
For running applications with application servers which are based on [pre fork model](#running-applications-with-gunicorn-uwsgi), like Gunicorn, uWSGI you have to add a post_fork hook or a @postfork decorator in your configuration.
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
To start sending data to SigNoz, use the following run command:
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> OTEL_EXPORTER_OTLP_ENDPOINT="http://<IP of SigNoz Backend>:4317" OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, you can disable the auto reload with `--noreload`.
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
---
|
||||
|
||||
`IP of SigNoz backend` is the IP of the machine where you installed SigNoz. If you have installed SigNoz on `localhost`, the endpoint will be `http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
#### **Send traces via OTel Collector binary**
|
||||
|
||||
:::note
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively. Remember to allow incoming requests to port **4317**/**4318** of machine where SigNoz backend is hosted.
|
||||
:::
|
||||
OTel Collector binary helps to collect logs, hostmetrics, resource and infra attributes. It is recommended to install Otel Collector binary to collect and send traces to SigNoz cloud. You can correlate signals and have rich contextual data through this way.
|
||||
|
||||
### Validating instrumentation by checking for traces
|
||||
You can find instructions to install OTel Collector binary [here](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/) in your VM. Once you are done setting up your OTel Collector binary, you can follow the below steps for instrumenting your Python application.
|
||||
|
||||
With your application running, you can verify that you’ve instrumented your application with OpenTelemetry correctly by confirming that tracing data is being reported to SigNoz.
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
To do this, you need to ensure that your application generates some data. Applications will not produce traces unless they are being interacted with, and OpenTelemetry will often buffer data before sending. So you need to interact with your application and wait for some time to see your tracing data in SigNoz.
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Validate your traces in SigNoz:
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
1. Trigger an action in your app that generates a web request. Hit the endpoint a number of times to generate some data. Then, wait for some time.
|
||||
2. In SigNoz, open the `Services` tab. Hit the `Refresh` button on the top right corner, and your application should appear in the list of `Applications`.
|
||||
3. Go to the `Traces` tab, and apply relevant filters to see your application’s traces.
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
You might see other dummy applications if you’re using SigNoz for the first time. You can remove it by following the docs [here](https://signoz.io/docs/operate/docker-standalone/#remove-the-sample-application).
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
<figure data-zoomable align='center'>
|
||||
<img src="/img/docs/opentelemetry_python_app_instrumented.webp" alt="Python Application in the list of services being monitored in SigNoz"/>
|
||||
<figcaption><i>Python Application in the list of services being monitored in SigNoz</i></figcaption></figure>
|
||||
<br></br>
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
Step 4. To run your application and send data to collector in same VM:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, if you use `export Flask_ENV=development`, it enables the reloader mode which breaks OpenTelemetry instrumentation.
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
---
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Python application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Python instrumentation by following the below steps:
|
||||
|
||||
Step 1. Create a virtual environment<br></br>
|
||||
|
||||
```bash
|
||||
python3 -m venv .venv
|
||||
source .venv/bin/activate
|
||||
```
|
||||
|
||||
Step 2. Install the OpenTelemetry dependencies
|
||||
|
||||
```bash
|
||||
pip install opentelemetry-distro==0.38b0
|
||||
pip install opentelemetry-exporter-otlp==1.17.0
|
||||
```
|
||||
|
||||
|
||||
Step 3. Add automatic instrumentation
|
||||
|
||||
```bash
|
||||
opentelemetry-bootstrap --action=install
|
||||
```
|
||||
|
||||
Please make sure that you have installed all the dependencies of your application before running the above command. The command will not install instrumentation for the dependencies which are not installed.
|
||||
|
||||
Step 4. Run your application:
|
||||
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation. For example, if you use `export Flask_ENV=development`, it enables the reloader mode which breaks OpenTelemetry instrumentation.
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
Step 5. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
@ -1,7 +1,13 @@
|
||||
## Requirements
|
||||
|
||||
- Python 3.8 or newer
|
||||
|
||||
## Send Traces to SigNoz Cloud
|
||||
|
||||
Based on your application environment, you can choose the setup below to send traces to SigNoz Cloud.
|
||||
|
||||
### Application on VMs
|
||||
|
||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
||||
|
||||
- [Send traces directly to SigNoz Cloud](#send-traces-directly-to-signoz-cloud)
|
||||
@ -37,13 +43,14 @@ opentelemetry-instrument <your_run_command>
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
| Region | Endpoint |
|
||||
| ------ | -------------------------- |
|
||||
| US | ingest.us.signoz.cloud:443 |
|
||||
| IN | ingest.in.signoz.cloud:443 |
|
||||
| EU | ingest.eu.signoz.cloud:443 |
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
Step 4. Validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
Note:
|
||||
Don’t run app in reloader/hot-reload mode as it breaks instrumentation.
|
||||
|
||||
---
|
||||
|
||||
@ -71,7 +78,7 @@ Step 3. To run your application and send data to collector in same VM:
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
opentelemetry-instrument <your_run_command>
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
where,
|
||||
@ -79,9 +86,20 @@ where,
|
||||
- *`<service_name>`* is the name of the service you want
|
||||
- *`<your_run_command>`* can be `python3 app.py` or `flask run`
|
||||
|
||||
*<service_name>* is the name of service you want
|
||||
|
||||
*<your_run_command>* can be `python3 app.py` or `flask run`
|
||||
|
||||
`http://localhost:4317` for gRPC exporter and `http://localhost:4318` for HTTP exporter.
|
||||
|
||||
The port numbers are 4317 and 4318 for the gRPC and HTTP exporters respectively.
|
||||
|
||||
In case you have OtelCollector Agent in different VM, replace localhost:4317 with `<IP Address of the VM>:4317`.
|
||||
|
||||
Step 4. You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
---
|
||||
|
||||
|
||||
### Applications Deployed on Kubernetes
|
||||
|
||||
For Python application deployed on Kubernetes, you need to install OTel Collector agent in your k8s infra to collect and send traces to SigNoz Cloud. You can find the instructions to install OTel Collector agent [here](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/).
|
||||
|
||||
@ -105,7 +123,7 @@ Step 3. Run your application:
|
||||
```bash
|
||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||
OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" \
|
||||
opentelemetry-instrument <your_run_command>
|
||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc opentelemetry-instrument <your run command>
|
||||
```
|
||||
|
||||
where,
|
||||
@ -113,6 +131,5 @@ where,
|
||||
- *`<service_name>`* is the name of the service you want
|
||||
- *`<your_run_command>`* can be `python3 app.py` or `flask run`
|
||||
|
||||
Step 4. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
||||
|
||||
You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](#validating-instrumentation-by-checking-for-traces).
|
||||
Step 4. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
@ -1,82 +1,35 @@
|
||||
import './InfrastructureMonitoring.styles.scss';
|
||||
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
import { Tabs } from 'antd';
|
||||
|
||||
import Prometheus from './prometheus.md';
|
||||
import SpecificReceiver from './specific-metric-receiver.md';
|
||||
|
||||
const enum ReceiverType {
|
||||
specific_metric_receiver = 'Specific Metric Receiver',
|
||||
Prometheus = 'Prometheus',
|
||||
}
|
||||
|
||||
const supportedLanguages = [
|
||||
{
|
||||
name: 'specific_metric_receiver',
|
||||
label: 'Specific Metric Receiver',
|
||||
},
|
||||
{
|
||||
name: 'prometheus',
|
||||
label: 'Prometheus',
|
||||
},
|
||||
];
|
||||
import InfraMonitoringDocs from './infraMonitoringDocs.md';
|
||||
|
||||
export default function InfrastructureMonitoring({
|
||||
activeStep,
|
||||
}: {
|
||||
activeStep: number;
|
||||
}): JSX.Element {
|
||||
const renderEnableReceiverByType = (receiverType: string): JSX.Element => {
|
||||
if (receiverType === ReceiverType.specific_metric_receiver) {
|
||||
return <SpecificReceiver />;
|
||||
}
|
||||
|
||||
return <Prometheus />;
|
||||
};
|
||||
|
||||
const docsURL = 'https://signoz.io/docs/userguide/send-metrics-cloud/';
|
||||
const heading = 'Send Metrics to SigNoz Cloud';
|
||||
return (
|
||||
<div className="infrastructure-monitoring-module-container">
|
||||
{activeStep === 2 && (
|
||||
<div className="content-container">
|
||||
<div className="heading">
|
||||
<h2 className="title">
|
||||
By default, when you install SigNoz, only the
|
||||
<a
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
href="https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/receiver/hostmetricsreceiver/README.md"
|
||||
>
|
||||
Hostmetric receiver
|
||||
</a>
|
||||
is enabled.
|
||||
</h2>
|
||||
</div>
|
||||
<div className="header">
|
||||
<div className="title">
|
||||
<h1>{heading}</h1>
|
||||
|
||||
<div className="subheading">
|
||||
Before you can query other metrics, you must first enable additional
|
||||
receivers in SigNoz. There are two ways in which you can send metrics to
|
||||
SigNoz using OpenTelemetry:
|
||||
<br />
|
||||
<div className="recevier-types">
|
||||
<small> 1. Enable a Specific Metric Receiver </small>
|
||||
<small> 2. Enable a Prometheus Receiver </small>
|
||||
<div className="detailed-docs-link">
|
||||
View detailed docs
|
||||
<a target="_blank" href={docsURL} rel="noreferrer">
|
||||
here
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<MDXProvider>
|
||||
<Tabs
|
||||
defaultActiveKey="1"
|
||||
items={supportedLanguages.map((language, i) => {
|
||||
const id = String(i + 1);
|
||||
|
||||
return {
|
||||
label: <div className="language-tab-item">{language.label}</div>,
|
||||
key: id,
|
||||
children: renderEnableReceiverByType(language.name),
|
||||
};
|
||||
})}
|
||||
/>
|
||||
<InfraMonitoringDocs />
|
||||
</MDXProvider>
|
||||
</div>
|
||||
)}
|
||||
|
@ -0,0 +1,191 @@
|
||||
There are two ways in which you can send metrics to SigNoz using OpenTelemetry:
|
||||
|
||||
- From your application
|
||||
- From OpenTelemetry Collector
|
||||
|
||||
In this document, we will cover how to send metrics from OpenTelemetry Collector. The Collector is a swiss-army knife that can collect metrics from various sources and send them to SigNoz.
|
||||
|
||||
- [Enable a Specific Metric Receiver](#enable-a-specific-metric-receiver)
|
||||
- [Enable a Prometheus Receiver](#enable-a-prometheus-receiver)
|
||||
|
||||
## Enable a Specific Metric Receiver
|
||||
|
||||
SigNoz supports all the receivers that are listed in the [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver) GitHub repository. To configure a new metric receiver, you must edit the `receivers` and `service::pipelines` sections of the `otel-collector-config.yaml` file. The following example shows the default configuration in which the `hostmetrics` receiver is enabled:
|
||||
|
||||
```yaml {8-20,52}
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: localhost:4317
|
||||
http:
|
||||
endpoint: localhost:4318
|
||||
hostmetrics:
|
||||
collection_interval: 30s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
processes: {}
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system, ec2] # include ec2 for AWS, gce for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
override: false
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: 'ingest.{region}.signoz.cloud:443' # replace {region} with your region
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
'signoz-access-token': '<SIGNOZ_INGESTION_KEY>'
|
||||
logging:
|
||||
loglevel: debug
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: localhost:8888
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/hostmetrics:
|
||||
receivers: [hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||
|
||||
US - ingest.us.signoz.cloud:443 <br></br>
|
||||
|
||||
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||
|
||||
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||
|
||||
To enable a new OpenTelemetry receiver, follow the steps below:
|
||||
|
||||
1. Open the `otel-collector-config.yaml` file in a plain-text editor.
|
||||
2. Configure your receivers. The following example shows how you can enable a `rabbitmq` receiver:
|
||||
|
||||
```yaml {21-25,53}
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: localhost:4317
|
||||
http:
|
||||
endpoint: localhost:4318
|
||||
hostmetrics:
|
||||
collection_interval: 30s
|
||||
scrapers:
|
||||
cpu: {}
|
||||
disk: {}
|
||||
load: {}
|
||||
filesystem: {}
|
||||
memory: {}
|
||||
network: {}
|
||||
paging: {}
|
||||
process:
|
||||
mute_process_name_error: true
|
||||
processes: {}
|
||||
rabbitmq:
|
||||
endpoint: http://localhost:15672
|
||||
username: <RABBITMQ_USERNAME>
|
||||
password: <RABBITMQ_PASSWORD>
|
||||
collection_interval: 10s
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# Ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/README.md
|
||||
resourcedetection:
|
||||
detectors: [env, system, ec2] # include ec2 for AWS, gce for GCP and azure for Azure.
|
||||
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
|
||||
timeout: 2s
|
||||
override: false
|
||||
system:
|
||||
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
|
||||
exporters:
|
||||
otlp:
|
||||
endpoint: 'ingest.{region}.signoz.cloud:443' # replace {region} with your region
|
||||
tls:
|
||||
insecure: false
|
||||
headers:
|
||||
'signoz-access-token': '<SIGNOZ_INGESTION_KEY>'
|
||||
logging:
|
||||
loglevel: debug
|
||||
service:
|
||||
telemetry:
|
||||
metrics:
|
||||
address: localhost:8888
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [otlp, rabbitmq]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
metrics/hostmetrics:
|
||||
receivers: [hostmetrics]
|
||||
processors: [resourcedetection, batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
For details about configuring OpenTelemetry receivers, see the [README](https://github.com/open-telemetry/opentelemetry-collector/blob/main/receiver/README.md) page of the `opentelemetry-collector` GitHub repository.
|
||||
|
||||
## Enable a Prometheus Receiver
|
||||
|
||||
SigNoz supports all the exporters that are listed on the [Exporters and Integrations](https://prometheus.io/docs/instrumenting/exporters/) page of the Prometheus documentation. If you have a running Prometheus instance, and you expose metrics in Prometheus, then you can scrape them in SigNoz by configuring Prometheus receivers in the `receivers::prometheus::config::scrape_configs` section of the `otel-collector-config.yaml` file.
|
||||
|
||||
To enable a Prometheus receiver, follow the steps below:
|
||||
|
||||
1. Open the `otel-collector-config.yaml` file in a plain-text editor.
|
||||
2. Enable a new Prometheus receiver. Depending on your use case, there are two ways in which you can enable a new Prometheus exporter:
|
||||
- **By creating a new job**: The following example shows how you can enable a Prometheus receiver by creating a new job named `my-new-job`:
|
||||
```yaml {10-13}
|
||||
...
|
||||
# Data sources: metrics
|
||||
prometheus:
|
||||
config:
|
||||
scrape_configs:
|
||||
- job_name: "otel-collector"
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ["otel-collector:8889"]
|
||||
- job_name: "my-new-job"
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ["localhost:8080"]
|
||||
...
|
||||
# This file was truncated for brevity.
|
||||
```
|
||||
- **By adding a new target to an existing job**: The following example shows the default `otel-collector` job to which a new target (`localhost:8080`) was added:
|
||||
```yaml {9}
|
||||
...
|
||||
# Data sources: metrics
|
||||
prometheus:
|
||||
config:
|
||||
scrape_configs:
|
||||
- job_name: "otel-collector"
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ["otel-collector:8889", "localhost:8080"]
|
||||
...
|
||||
# This file was truncated for brevity.
|
||||
```
|
||||
Note that all the jobs are scraped in parallel, and all targets inside a job are scraped serially. For more details about configuring jobs and targets, see the following sections of the Prometheus documentation:
|
||||
- [<Scrape_config>](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config)
|
||||
- [Jobs and Instances](https://prometheus.io/docs/concepts/jobs_instances/)
|
@ -1,67 +0,0 @@
|
||||
## Enable a Prometheus Receiver
|
||||
|
||||
SigNoz supports all the exporters that are listed on the [Exporters and Integrations](https://prometheus.io/docs/instrumenting/exporters/) page of the Prometheus documentation. If you have a running Prometheus instance, and you expose metrics in Prometheus, then you can scrape them in SigNoz by configuring Prometheus receivers in the `receivers.prometheus.config.scrape_configs` section of the `deploy/docker/clickhouse-setup/otel-collector-metrics-config.yaml` file.
|
||||
|
||||
To enable a Prometheus receiver, follow the steps below:
|
||||
|
||||
1. Open the `deploy/docker/clickhouse-setup/otel-collector-metrics-config.yaml` file in a plain-text editor.
|
||||
2. Enable a new Prometheus receiver. Depending on your use case, there are two ways in which you can enable a new Prometheus exporter:
|
||||
|
||||
- **By creating a new job**: The following example shows how you can enable a Prometheus receiver by creating a new job named `my-new-job`:
|
||||
|
||||
```yaml {15-18}
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
|
||||
# Data sources: metrics
|
||||
prometheus:
|
||||
config:
|
||||
scrape_configs:
|
||||
- job_name: 'otel-collector'
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ['otel-collector:8889']
|
||||
- job_name: 'my-new-job'
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ['localhost:8080']
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# This file was truncated for brevity.
|
||||
```
|
||||
|
||||
- **By adding a new target to an existing job**: The following example shows the default `otel-collector` job to which a new target (`localhost:8080`) was added:
|
||||
|
||||
```yaml {14}
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
|
||||
# Data sources: metrics
|
||||
prometheus:
|
||||
config:
|
||||
scrape_configs:
|
||||
- job_name: 'otel-collector'
|
||||
scrape_interval: 30s
|
||||
static_configs:
|
||||
- targets: ['otel-collector:8889', 'localhost:8080']
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# This file was truncated for brevity.
|
||||
```
|
||||
|
||||
Note that all the jobs are scraped in parallel, and all targets inside a job are scraped serially. For more details about configuring jobs and targets, see the following sections of the Prometheus documentation:
|
||||
|
||||
- [<Scrape_config>](https://prometheus.io/docs/prometheus/latest/configuration/configuration/#scrape_config)
|
||||
- [Jobs and Instances](https://prometheus.io/docs/concepts/jobs_instances/)
|
||||
|
||||
3. <SaveChangesRestart />
|
@ -1,72 +0,0 @@
|
||||
## Enable a Specific Metric Receiver
|
||||
|
||||
SigNoz supports all the receivers that are listed in the [opentelemetry-collector-contrib](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver) GitHub repository. To configure a new metric receiver, you must edit the `receivers` section of the `deploy/docker/clickhouse-setup/otel-collector-config.yaml` file. The following example shows the default configuration in which the `hostmetrics` receiver is enabled:
|
||||
|
||||
```yaml {14-22}
|
||||
receivers:
|
||||
otlp/spanmetrics:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 'localhost:12345'
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
jaeger:
|
||||
protocols:
|
||||
grpc:
|
||||
thrift_http:
|
||||
hostmetrics:
|
||||
collection_interval: 30s
|
||||
scrapers:
|
||||
cpu:
|
||||
load:
|
||||
memory:
|
||||
disk:
|
||||
filesystem:
|
||||
network:
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# This file was truncated for brevity
|
||||
```
|
||||
|
||||
To enable a new OpenTelemetry receiver, follow the steps below:
|
||||
|
||||
1. Move into the directory in which you installed SigNoz, and open the `deploy/docker/clickhouse-setup/otel-collector-config.yaml` file in a plain-text editor.
|
||||
2. Configure your receivers. The following example shows how you can enable a receiver named `examplereceiver`:
|
||||
|
||||
```yaml {23,24}
|
||||
receivers:
|
||||
otlp/spanmetrics:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 'localhost:12345'
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
jaeger:
|
||||
protocols:
|
||||
grpc:
|
||||
thrift_http:
|
||||
hostmetrics:
|
||||
collection_interval: 30s
|
||||
scrapers:
|
||||
cpu:
|
||||
load:
|
||||
memory:
|
||||
disk:
|
||||
filesystem:
|
||||
network:
|
||||
examplereceiver:
|
||||
endpoint: 1.2.3.4:8080
|
||||
processors:
|
||||
batch:
|
||||
send_batch_size: 1000
|
||||
timeout: 10s
|
||||
# This file was truncated for brevity.
|
||||
```
|
||||
|
||||
For details about configuring OpenTelemetry receivers, see the [README](https://github.com/open-telemetry/opentelemetry-collector/blob/main/receiver/README.md) page of the `opentelemetry-collector` GitHub repository. 3. <SaveChangesRestart />
|
@ -0,0 +1,72 @@
|
||||
import { MDXProvider } from '@mdx-js/react';
|
||||
import { Select } from 'antd';
|
||||
import Header from 'container/OnboardingContainer/common/Header/Header';
|
||||
import { useState } from 'react';
|
||||
|
||||
import FluentBit from './md-docs/fluentBit.md';
|
||||
import FluentD from './md-docs/fluentD.md';
|
||||
import LogStashDocs from './md-docs/logStash.md';
|
||||
|
||||
enum FrameworksMap {
|
||||
fluent_d = 'FluentD',
|
||||
fluent_bit = 'FluentBit',
|
||||
logstash = 'Logstash',
|
||||
}
|
||||
|
||||
export default function ExistingCollectors(): JSX.Element {
|
||||
const [selectedFrameWork, setSelectedFrameWork] = useState('fluent_d');
|
||||
|
||||
const renderDocs = (): JSX.Element => {
|
||||
switch (selectedFrameWork) {
|
||||
case 'fluent_d':
|
||||
return <FluentD />;
|
||||
case 'fluent_bit':
|
||||
return <FluentBit />;
|
||||
default:
|
||||
return <LogStashDocs />;
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="java-setup-instructions-container">
|
||||
<Header
|
||||
entity="existing_collectors"
|
||||
heading="Logs from existing collectors"
|
||||
imgURL="/Logos/cmd-terminal.svg"
|
||||
docsURL="https://signoz.io/docs/userguide/fluentbit_to_signoz/"
|
||||
imgClassName="supported-language-img"
|
||||
/>
|
||||
|
||||
<div className="form-container">
|
||||
<div className="framework-selector">
|
||||
<div className="label"> Select Framework </div>
|
||||
|
||||
<Select
|
||||
defaultValue="fluent_d"
|
||||
style={{ minWidth: 120 }}
|
||||
placeholder="Select Framework"
|
||||
onChange={(value): void => setSelectedFrameWork(value)}
|
||||
options={[
|
||||
{
|
||||
value: 'fluent_d',
|
||||
label: FrameworksMap.fluent_d,
|
||||
},
|
||||
{
|
||||
value: 'fluent_bit',
|
||||
label: FrameworksMap.fluent_bit,
|
||||
},
|
||||
{
|
||||
value: 'logstash',
|
||||
label: FrameworksMap.logstash,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="content-container">
|
||||
<MDXProvider>{renderDocs()}</MDXProvider>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
If you use fluentBit to collect logs in your stack with this tutotrial you will be able to send logs from fluentBit to SigNoz.
|
||||
|
||||
At SigNoz we use opentelemetry collector to recieve logs which supports the fluentforward protocol. So you can forward your logs from your fluentBit agent to opentelemetry collector using fluentforward protocol.
|
||||
|
||||
### Collect Logs Using FluentBit in SigNoz cloud
|
||||
|
||||
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
- Add fluentforward reciever to your `config.yaml`
|
||||
|
||||
```yaml
|
||||
receivers:
|
||||
fluentforward:
|
||||
endpoint: 0.0.0.0:24224
|
||||
```
|
||||
|
||||
Here we have used port 24224 for listing in fluentforward protocol, but you can change it to a port you want.
|
||||
You can read more about fluentforward receiver [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/fluentforwardreceiver).
|
||||
|
||||
- Modify your `config.yaml` and add the above receiver
|
||||
```yaml {4}
|
||||
service:
|
||||
....
|
||||
logs:
|
||||
receivers: [otlp, fluentforward]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
- Change the fluentBit config to forward the logs to otel collector.
|
||||
|
||||
```
|
||||
[INPUT]
|
||||
Name dummy
|
||||
Tag dummy.log
|
||||
Dummy {"message": "mylog", "trace_id": "0000000000000000f4dbb3edd765f620", "span_id": "43222c2d51a7abe3"}
|
||||
|
||||
[OUTPUT]
|
||||
Name forward
|
||||
Match *
|
||||
Host otel-collector-host
|
||||
Port 24224
|
||||
```
|
||||
|
||||
In this example we are generating sample logs and then forwarding them to the otel collector which is listening on port 24224.
|
||||
`otel-collector-host` has to be replaced by the host where otel-collector is running. For more info check [troubleshooting](../install/troubleshooting.md#signoz-otel-collector-address-grid).
|
||||
|
||||
- Once you make this changes you can restart fluentBit and otel-binary, and you will be able to see the logs in SigNoz.
|
||||
- To properly transform your existing log model into opentelemetry [log](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md) model you can use the different processors provided by opentelemetry. [link](./logs.md#processors-available-for-processing-logs)
|
||||
|
||||
eg:-
|
||||
|
||||
```yaml
|
||||
processors:
|
||||
logstransform:
|
||||
operators:
|
||||
- type: trace_parser
|
||||
trace_id:
|
||||
parse_from: attributes.trace_id
|
||||
span_id:
|
||||
parse_from: attributes.span_id
|
||||
- type: remove
|
||||
field: attributes.trace_id
|
||||
- type: remove
|
||||
field: attributes.span_id
|
||||
```
|
||||
|
||||
The operations in the above processor will parse the trace_id and span_id from log to opentelemetry log model and remove them from attributes.
|
@ -0,0 +1,79 @@
|
||||
If you use fluentD to collect logs in your stack with this tutotrial you will be able to send logs from fluentD to SigNoz.
|
||||
|
||||
At SigNoz we use opentelemetry collector to recieve logs which supports the fluentforward protocol. So you can forward your logs from your fluentD agent to opentelemetry collector.
|
||||
|
||||
### Collect Logs Using FluentD in SigNoz cloud
|
||||
|
||||
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||
|
||||
- Add fluentforward reciever to your `config.yaml`
|
||||
|
||||
```yaml
|
||||
receivers:
|
||||
fluentforward:
|
||||
endpoint: 0.0.0.0:24224
|
||||
```
|
||||
|
||||
Here we have used port 24224 for listing in fluentforward protocol, but you can change it to a port you want.
|
||||
You can read more about fluentforward receiver [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/fluentforwardreceiver).
|
||||
|
||||
- Modify your `config.yaml` and add the above receiver
|
||||
|
||||
```yaml {4}
|
||||
service:
|
||||
....
|
||||
logs:
|
||||
receivers: [otlp, fluentforward]
|
||||
processors: [batch]
|
||||
exporters: [otlp]
|
||||
```
|
||||
|
||||
- Change the fluentD config to forward the logs to otel collector.
|
||||
|
||||
```
|
||||
<source>
|
||||
@type sample
|
||||
sample [{"message": "my log data", "source": "myhost"}, {"message": "my log data 1", "source": "myhost1"}]
|
||||
tag sample
|
||||
rate 10000
|
||||
</source>
|
||||
|
||||
<match sample>
|
||||
@type forward
|
||||
send_timeout 60s
|
||||
recover_wait 10s
|
||||
hard_timeout 60s
|
||||
|
||||
<server>
|
||||
name myserver1
|
||||
host otel-collector-host
|
||||
port 24224
|
||||
</server>
|
||||
</match>
|
||||
```
|
||||
|
||||
In this example we are generating sample logs and then forwarding them to the otel collector which is listening on port 24224.
|
||||
`otel-collector-host` has to be replaced by the host where otel-collector is running. For more info check [troubleshooting](../install/troubleshooting.md#signoz-otel-collector-address-grid).
|
||||
|
||||
- Once you make this changes you can restart fluentD and otel-binary, and you will be able to see the logs in SigNoz.
|
||||
|
||||
- To properly transform your existing log model into opentelemetry [log](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md) model you can use the different processors provided by opentelemetry. [link](./logs.md#processors-available-for-processing-logs)
|
||||
|
||||
eg:-
|
||||
|
||||
```yaml
|
||||
processors:
|
||||
logstransform:
|
||||
operators:
|
||||
- type: trace_parser
|
||||
trace_id:
|
||||
parse_from: attributes.trace_id
|
||||
span_id:
|
||||
parse_from: attributes.span_id
|
||||
- type: remove
|
||||
field: attributes.trace_id
|
||||
- type: remove
|
||||
field: attributes.span_id
|
||||
```
|
||||
|
||||
The operations in the above processor will parse the trace_id and span_id from log to opentelemetry log model and remove them from attributes.
|
@ -0,0 +1,62 @@
|
||||
If you use logstash to collect logs in your stack with this tutotrial you will be able to send logs from logstash to SigNoz.
|
||||
|
||||
At SigNoz we use opentelemetry collector to recieve logs which supports the TCP protocol. So you can forward your logs from your logstash agent to opentelemetry collector
|
||||
|
||||
## Steps to recieve logs from Logstash:
|
||||
|
||||
- Add fluentforward reciever to your `otel-collector-config.yaml` which is present inside `deploy/docker/clickhouse-setup`
|
||||
|
||||
```
|
||||
receivers:
|
||||
tcplog/logstash:
|
||||
max_log_size: 1MiB
|
||||
listen_address: "0.0.0.0:2255"
|
||||
attributes: {}
|
||||
resource: {}
|
||||
add_attributes: false
|
||||
operators: []
|
||||
```
|
||||
|
||||
Here we have used port 2255 for listing in TCP protocol, but you can change it to a port you want.
|
||||
You can read more about tcplog reciver [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/tcplogreceiver).
|
||||
|
||||
- Update the pipleline for logs and make the following change in `otel-collector-config.yaml`
|
||||
|
||||
```
|
||||
service:
|
||||
...
|
||||
|
||||
logs:
|
||||
receivers: [ otlp, tcplog/logstash ]
|
||||
processors: [ batch ]
|
||||
exporters: [ clickhouselogsexporter ]
|
||||
```
|
||||
|
||||
Here we are adding our clickhouse exporter and creating a pipeline which will collect logs from `tcplog/logstash` receiver, processing it using batch processor and export it to clickhouse.
|
||||
|
||||
- Expose the port in port for otel-collector in `docker-compose.yaml` file present in `deploy/docker/clickhouse-setup`
|
||||
|
||||
```
|
||||
otel-collector:
|
||||
...
|
||||
ports:
|
||||
- "2255:2255"
|
||||
```
|
||||
|
||||
- Change the logstash config to forward the logs to otel collector.
|
||||
|
||||
```
|
||||
output {
|
||||
tcp {
|
||||
codec => json_lines # this is required otherwise it will send eveything in a single line
|
||||
host => "otel-collector-host"
|
||||
port => 2255
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
In this example we are generating sample logs and then forwarding them to the otel collector which is listening on port 2255.
|
||||
`otel-collector-host` has to be replaced by the host where otel-collector is running. For more info check [troubleshooting](../install/troubleshooting.md#signoz-otel-collector-address-grid).
|
||||
|
||||
- Once you make this changes you can restart logstash and SignNoz, and you will be able to see the logs in SigNoz.
|
||||
- To properly transform your existing log model into opentelemetry [log](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/data-model.md) model you can use the different processors provided by opentelemetry. [link](./logs.md#processors-available-for-processing-logs)
|
@ -8,6 +8,7 @@ import { useState } from 'react';
|
||||
|
||||
import ApplicationLogs from './ApplicationLogs/ApplicationLogs';
|
||||
import Docker from './Docker/Docker';
|
||||
import ExistingCollectors from './ExistingCollectors/ExistingCollectors';
|
||||
import Kubernetes from './Kubernetes/Kubernetes';
|
||||
import Nodejs from './Nodejs/Nodejs';
|
||||
import SysLogs from './SysLogs/SysLogs';
|
||||
@ -39,10 +40,15 @@ const supportedLogTypes = [
|
||||
imgURL: `Logos/node-js.svg`,
|
||||
},
|
||||
{
|
||||
name: 'Logs from existing Collectors',
|
||||
name: 'Application Logs using OTEL SDK',
|
||||
id: 'application_logs_otel_sdk',
|
||||
imgURL: `Logos/cmd-terminal.svg`,
|
||||
},
|
||||
{
|
||||
name: 'Logs from existing collectors',
|
||||
id: 'existing_collectors',
|
||||
imgURL: `Logos/cmd-terminal.svg`,
|
||||
},
|
||||
];
|
||||
|
||||
export default function LogsManagement({
|
||||
@ -70,6 +76,8 @@ export default function LogsManagement({
|
||||
return <SysLogs activeStep={activeStep} />;
|
||||
case 'nodejs':
|
||||
return <Nodejs activeStep={activeStep} />;
|
||||
case 'existing_collectors':
|
||||
return <ExistingCollectors />;
|
||||
default:
|
||||
return <> </>;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user