mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-14 21:15:53 +08:00
parent
a4a285c074
commit
4cc3ce224c
@ -143,7 +143,7 @@ From VMs, there are two ways to send data to SigNoz Cloud.
|
|||||||
|
|
||||||
`OTEL_EXPORTER_OTLP_HEADERS`: `signoz-access-token=<SIGNOZ-INGESTION-TOKEN>`. Update `<SIGNOZ-INGESTION-TOKEN>` with the ingestion token provided by SigNoz
|
`OTEL_EXPORTER_OTLP_HEADERS`: `signoz-access-token=<SIGNOZ-INGESTION-TOKEN>`. Update `<SIGNOZ-INGESTION-TOKEN>` with the ingestion token provided by SigNoz
|
||||||
|
|
||||||
`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.
|
`OTEL_EXPORTER_OTLP_ENDPOINT`: ingest.{region}.signoz.cloud:443. Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary accordingly.
|
||||||
|
|
||||||
|
|
||||||
US - ingest.us.signoz.cloud:443 <br></br>
|
US - ingest.us.signoz.cloud:443 <br></br>
|
||||||
@ -295,7 +295,7 @@ You can find instructions to install OTel Collector binary [here](https://signoz
|
|||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Golang instrumentation by following the below steps:
|
||||||
|
|
||||||
|
@ -29,13 +29,13 @@ Step 2. Run your application
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<app_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<app_name> \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443 \
|
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443 \
|
||||||
java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <my-app>.jar
|
java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <my-app>.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
- `<app_name>` is the name for your application
|
- `<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.
|
- `<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.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <myapp>.jar
|
|||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||||
|
|
||||||
|
@ -35,16 +35,16 @@ Step 3. Update `JAVA_OPTS` environment variable
|
|||||||
Update `JAVA_OPTS` environment variable with configurations required to send data to SigNoz cloud in your configuration file.
|
Update `JAVA_OPTS` environment variable with configurations required to send data to SigNoz cloud in your configuration file.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
JAVA_OPTS="-javaagent:/path/opentelemetry-javaagent.jar
|
JAVA_OPTS="-javaagent:/<path>/opentelemetry-javaagent.jar
|
||||||
-Dotel.exporter.otlp.endpoint=https://ingest.{region}.signoz.cloud:443
|
-Dotel.exporter.otlp.endpoint=https://ingest.{region}.signoz.cloud:443
|
||||||
-Dotel.exporter.otlp.headers="signoz-access-token=SIGNOZ_INGESTION_KEY"
|
-Dotel.exporter.otlp.headers="signoz-access-token=<SIGNOZ_INGESTION_KEY>"
|
||||||
-Dotel.resource.attributes="service.name=<app_name>""
|
-Dotel.resource.attributes="service.name=<app_name>""
|
||||||
```
|
```
|
||||||
You need to replace the following things based on your environment:<br></br>
|
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>
|
- `<path>` - Update it to the path of your downloaded Java JAR agent.<br></br>
|
||||||
- `<app_name>` is the name for your application
|
- `<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.
|
- `<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.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ where,
|
|||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||||
|
|
||||||
|
@ -27,13 +27,14 @@ wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releas
|
|||||||
Step 2. Run your application
|
Step 2. Run your application
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<app_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<myapp> \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443 \
|
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443 \
|
||||||
java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <my-app>.jar
|
java -javaagent:<path>/opentelemetry-javaagent.jar -jar <myapp>.jar
|
||||||
```
|
```
|
||||||
- `<app_name>` is the name for your application
|
- `<myapp>` 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.
|
- `<path>` - update it to the path of your downloaded Java JAR agent
|
||||||
|
- `<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.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
@ -59,17 +60,17 @@ wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releas
|
|||||||
Step 2. Run your application<br></br>
|
Step 2. Run your application<br></br>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <myapp>.jar
|
java -javaagent:<path>/opentelemetry-javaagent.jar -jar <myapp>.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
- `<myapp>` is the name of your application jar file
|
- `<myapp>` is the name of your application
|
||||||
- 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.
|
- `<path>` - update it to the path of your downloaded Java JAR agent
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||||
|
|
||||||
@ -82,10 +83,10 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry ja
|
|||||||
2. Run your application<br></br>
|
2. Run your application<br></br>
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
java -javaagent:$PWD/opentelemetry-javaagent.jar -jar <myapp>.jar
|
java -javaagent:<path>/opentelemetry-javaagent.jar -jar <myapp>.jar
|
||||||
```
|
```
|
||||||
|
|
||||||
- `<myapp>` is the name of your application jar file
|
- `<myapp>` is the name of your application
|
||||||
- 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.
|
- `<path>` - update it to the path of your downloaded Java JAR agent
|
||||||
|
|
||||||
3. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
3. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
@ -26,22 +26,21 @@ wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releas
|
|||||||
|
|
||||||
Step 2. Enable the instrumentation agent and run your application
|
Step 2. Enable the instrumentation agent and run your application
|
||||||
|
|
||||||
If you run your `.war` package by putting in `webapps` folder, just add `setenv.sh` in your Tomcat `bin` folder.
|
If you run your `.war` package by putting in `webapps` folder, just add `setenv.sh` in your Tomcat `bin` folder. Inside the `setenv.sh` file, add the following environment variables:
|
||||||
|
|
||||||
This should set these environment variables and start sending telemetry data to SigNoz Cloud.
|
|
||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
|
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/<path>/opentelemetry-javaagent.jar"
|
||||||
export OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY"
|
export OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>"
|
||||||
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443
|
export OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{region}.signoz.cloud:443
|
||||||
export OTEL_RESOURCE_ATTRIBUTES=service.name=<app_name>
|
export OTEL_RESOURCE_ATTRIBUTES=service.name=<app_name>
|
||||||
```
|
```
|
||||||
|
|
||||||
- `<app_name>` is the name for your application
|
- `<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.
|
- `<path>` - update it to the path of your downloaded Java JAR agent.
|
||||||
|
- `<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.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary accordingly.
|
||||||
|
|
||||||
US - ingest.us.signoz.cloud:443 <br></br>
|
US - ingest.us.signoz.cloud:443 <br></br>
|
||||||
|
|
||||||
@ -70,16 +69,16 @@ This should set these environment variables and start sending telemetry data to
|
|||||||
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
|
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/<path>/opentelemetry-javaagent.jar"
|
||||||
```
|
```
|
||||||
|
|
||||||
- path/to - Update it to the path of your downloaded Java JAR agent.
|
- `<path>` - Update it to the path of your downloaded Java JAR agent.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry java instrumentation by following the below steps:
|
||||||
|
|
||||||
@ -96,11 +95,11 @@ Once you have set up OTel Collector agent, you can proceed with OpenTelemetry ja
|
|||||||
This should set the environment variable and start sending telemetry data to SigNoz Cloud.
|
This should set the environment variable and start sending telemetry data to SigNoz Cloud.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/path/to/opentelemetry-javaagent.jar"
|
export CATALINA_OPTS="$CATALINA_OPTS -javaagent:/<path>/opentelemetry-javaagent.jar"
|
||||||
```
|
```
|
||||||
|
|
||||||
- path/to - Update it to the path of your downloaded Java JAR agent.
|
- `<path>` - Update it to the path of your downloaded Java JAR agent.
|
||||||
|
|
||||||
3. Make sure to dockerise your application along with OpenTelemetry instrumentation.
|
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).
|
You can validate if your application is sending traces to SigNoz cloud by following the instructions [here](https://signoz.io/docs/instrumentation/tomcat/#validating-instrumentation-by-checking-for-traces).
|
@ -23,7 +23,7 @@ export default function Javascript({
|
|||||||
}: {
|
}: {
|
||||||
activeStep: number;
|
activeStep: number;
|
||||||
}): JSX.Element {
|
}): JSX.Element {
|
||||||
const [selectedFrameWork, setSelectedFrameWork] = useState('nodejs');
|
const [selectedFrameWork, setSelectedFrameWork] = useState('express');
|
||||||
|
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
|
|
||||||
|
@ -1,213 +1,212 @@
|
|||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
Supported Versions
|
Supported Versions
|
||||||
|
|
||||||
^4.0.0
|
^4.0.0
|
||||||
|
|
||||||
## Send traces to SigNoz Cloud
|
## Send traces to SigNoz Cloud
|
||||||
|
|
||||||
Based on your application environment, you can choose the setup below to 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
|
### Application on VMs
|
||||||
|
|
||||||
From VMs, there are two ways to send data to SigNoz Cloud.
|
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 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 via OTel Collector binary](#send-traces-via-otel-collector-binary) (recommended)
|
||||||
|
|
||||||
#### **Send traces directly to SigNoz Cloud**
|
#### **Send traces directly to SigNoz Cloud**
|
||||||
|
|
||||||
Step 1. Install OpenTelemetry packages
|
Step 1. Install OpenTelemetry packages
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install --save @opentelemetry/api@^1.4.1
|
npm install --save @opentelemetry/api@^1.4.1
|
||||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||||
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||||
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
||||||
```
|
```
|
||||||
|
|
||||||
Step 2. Create tracing.js file<br></br>
|
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.
|
You need to configure the endpoint for SigNoz cloud in this file. You also need to configure your service name. In this example, we have used `node_app`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// tracing.js
|
// tracing.js
|
||||||
'use strict'
|
'use strict'
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||||
const { Resource } = require('@opentelemetry/resources');
|
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
|
// 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
|
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
|
||||||
|
|
||||||
// highlight-start
|
const exporterOptions = {
|
||||||
const exporterOptions = {
|
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
||||||
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
}
|
||||||
}
|
|
||||||
// highlight-end
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
|
const sdk = new opentelemetry.NodeSDK({
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
traceExporter,
|
||||||
const sdk = new opentelemetry.NodeSDK({
|
instrumentations: [getNodeAutoInstrumentations()],
|
||||||
traceExporter,
|
resource: new Resource({
|
||||||
instrumentations: [getNodeAutoInstrumentations()],
|
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||||
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()
|
||||||
// initialize the SDK and register with the OpenTelemetry API
|
|
||||||
// this enables the API to record telemetry
|
// gracefully shut down the SDK on process exit
|
||||||
sdk.start()
|
process.on('SIGTERM', () => {
|
||||||
|
sdk.shutdown()
|
||||||
// gracefully shut down the SDK on process exit
|
.then(() => console.log('Tracing terminated'))
|
||||||
process.on('SIGTERM', () => {
|
.catch((error) => console.log('Error terminating tracing', error))
|
||||||
sdk.shutdown()
|
.finally(() => process.exit(0));
|
||||||
.then(() => console.log('Tracing terminated'))
|
});
|
||||||
.catch((error) => console.log('Error terminating tracing', error))
|
```
|
||||||
.finally(() => process.exit(0));
|
|
||||||
});
|
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/v1/traces <br></br>
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
|
||||||
|
IN - ingest.in.signoz.cloud:443/v1/traces <br></br>
|
||||||
US - ingest.us.signoz.cloud:443/v1/traces <br></br>
|
|
||||||
|
EU - ingest.eu.signoz.cloud:443/v1/traces <br></br>
|
||||||
IN - ingest.in.signoz.cloud:443/v1/traces <br></br>
|
|
||||||
|
Step 3. Run the application<br></br>
|
||||||
EU - ingest.eu.signoz.cloud:443/v1/traces <br></br>
|
|
||||||
|
Make sure you set the `OTEL_EXPORTER_OTLP_HEADERS` env as follows
|
||||||
Step 3. Run the application<br></br>
|
```bash
|
||||||
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" node -r ./tracing.js app.js
|
||||||
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
|
`<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.
|
||||||
```
|
|
||||||
|
---
|
||||||
`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.
|
||||||
#### **Send traces via OTel Collector binary**
|
|
||||||
|
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.
|
||||||
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
|
||||||
Step 1. Install OpenTelemetry packages
|
npm install --save @opentelemetry/api@^1.4.1
|
||||||
|
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||||
```js
|
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||||
npm install --save @opentelemetry/api@^1.4.1
|
npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.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 tracing.js file<br></br>
|
||||||
```
|
|
||||||
|
You need to configure your service name. In this example, we have used `node_app`.
|
||||||
Step 2. Create tracing.js file<br></br>
|
|
||||||
|
```js
|
||||||
```js
|
// tracing.js
|
||||||
// tracing.js
|
'use strict'
|
||||||
'use strict'
|
const process = require('process');
|
||||||
const process = require('process');
|
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
const { Resource } = require('@opentelemetry/resources');
|
||||||
const { Resource } = require('@opentelemetry/resources');
|
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
|
||||||
|
const exporterOptions = {
|
||||||
const exporterOptions = {
|
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
}
|
||||||
}
|
|
||||||
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
const sdk = new opentelemetry.NodeSDK({
|
||||||
const sdk = new opentelemetry.NodeSDK({
|
traceExporter,
|
||||||
traceExporter,
|
instrumentations: [getNodeAutoInstrumentations()],
|
||||||
instrumentations: [getNodeAutoInstrumentations()],
|
resource: new Resource({
|
||||||
resource: new Resource({
|
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||||
// highlight-next-line
|
})
|
||||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
});
|
||||||
})
|
|
||||||
});
|
// initialize the SDK and register with the OpenTelemetry API
|
||||||
|
// this enables the API to record telemetry
|
||||||
// initialize the SDK and register with the OpenTelemetry API
|
sdk.start()
|
||||||
// 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
|
sdk.shutdown()
|
||||||
process.on('SIGTERM', () => {
|
.then(() => console.log('Tracing terminated'))
|
||||||
sdk.shutdown()
|
.catch((error) => console.log('Error terminating tracing', error))
|
||||||
.then(() => console.log('Tracing terminated'))
|
.finally(() => process.exit(0));
|
||||||
.catch((error) => console.log('Error terminating tracing', error))
|
});
|
||||||
.finally(() => process.exit(0));
|
```
|
||||||
});
|
|
||||||
```
|
Step 3. Run the application<br></br>
|
||||||
|
```bash
|
||||||
Step 3. Run the application<br></br>
|
node -r ./tracing.js app.js
|
||||||
```bash
|
```
|
||||||
node -r ./tracing.js app.js
|
---
|
||||||
```
|
|
||||||
---
|
### Applications Deployed on 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](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/).
|
||||||
|
|
||||||
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:
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
Step 1. Install OpenTelemetry packages
|
```bash
|
||||||
|
npm install --save @opentelemetry/api@^1.4.1
|
||||||
```bash
|
npm install --save @opentelemetry/sdk-node@^0.39.1
|
||||||
npm install --save @opentelemetry/api@^1.4.1
|
npm install --save @opentelemetry/auto-instrumentations-node@^0.37.0
|
||||||
npm install --save @opentelemetry/sdk-node@^0.39.1
|
npm install --save @opentelemetry/exporter-trace-otlp-http@^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 tracing.js file<br></br>
|
||||||
|
|
||||||
Step 2. Create tracing.js file<br></br>
|
You also need to configure your service name. In this example, we have used `node_app`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// tracing.js
|
// tracing.js
|
||||||
'use strict'
|
'use strict'
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||||
const { Resource } = require('@opentelemetry/resources');
|
const { Resource } = require('@opentelemetry/resources');
|
||||||
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
|
||||||
|
|
||||||
const exporterOptions = {
|
const exporterOptions = {
|
||||||
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT || 'http://localhost:4318/v1/traces',
|
||||||
}
|
}
|
||||||
|
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
const sdk = new opentelemetry.NodeSDK({
|
const sdk = new opentelemetry.NodeSDK({
|
||||||
traceExporter,
|
traceExporter,
|
||||||
instrumentations: [getNodeAutoInstrumentations()],
|
instrumentations: [getNodeAutoInstrumentations()],
|
||||||
resource: new Resource({
|
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
|
||||||
// initialize the SDK and register with the OpenTelemetry API
|
// this enables the API to record telemetry
|
||||||
// this enables the API to record telemetry
|
sdk.start()
|
||||||
sdk.start()
|
|
||||||
|
// gracefully shut down the SDK on process exit
|
||||||
// gracefully shut down the SDK on process exit
|
process.on('SIGTERM', () => {
|
||||||
process.on('SIGTERM', () => {
|
sdk.shutdown()
|
||||||
sdk.shutdown()
|
.then(() => console.log('Tracing terminated'))
|
||||||
.then(() => console.log('Tracing terminated'))
|
.catch((error) => console.log('Error terminating tracing', error))
|
||||||
.catch((error) => console.log('Error terminating tracing', error))
|
.finally(() => process.exit(0));
|
||||||
.finally(() => process.exit(0));
|
});
|
||||||
});
|
```
|
||||||
```
|
|
||||||
|
Step 3. Run the application<br></br>
|
||||||
Step 3. Run the application<br></br>
|
|
||||||
|
```bash
|
||||||
```bash
|
node -r ./tracing.js app.js
|
||||||
node -r ./tracing.js app.js
|
|
||||||
```
|
```
|
@ -26,7 +26,7 @@ npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
|||||||
|
|
||||||
Step 2. Create tracing.js file<br></br>
|
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.
|
You need to configure the endpoint for SigNoz cloud in this file. You also need to configure your service name. In this example, we have used `node_app`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// tracing.js
|
// tracing.js
|
||||||
@ -41,18 +41,15 @@ const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventi
|
|||||||
// do not set headers in exporterOptions, the OTel spec recommends setting headers through ENV variables
|
// 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
|
// https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md#specifying-headers-via-environment-variables
|
||||||
|
|
||||||
// highlight-start
|
|
||||||
const exporterOptions = {
|
const exporterOptions = {
|
||||||
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
||||||
}
|
}
|
||||||
// highlight-end
|
|
||||||
|
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
const sdk = new opentelemetry.NodeSDK({
|
const sdk = new opentelemetry.NodeSDK({
|
||||||
traceExporter,
|
traceExporter,
|
||||||
instrumentations: [getNodeAutoInstrumentations()],
|
instrumentations: [getNodeAutoInstrumentations()],
|
||||||
resource: new Resource({
|
resource: new Resource({
|
||||||
// highlight-next-line
|
|
||||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -86,7 +83,7 @@ Make sure you set the `OTEL_EXPORTER_OTLP_HEADERS` env as follows
|
|||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" node -r ./tracing.js app.js
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" node -r ./tracing.js app.js
|
||||||
```
|
```
|
||||||
|
|
||||||
`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.
|
`<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.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -107,6 +104,8 @@ npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
|||||||
|
|
||||||
Step 2. Create tracing.js file<br></br>
|
Step 2. Create tracing.js file<br></br>
|
||||||
|
|
||||||
|
You need to configure your service name. In this example, we have used `node_app`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// tracing.js
|
// tracing.js
|
||||||
'use strict'
|
'use strict'
|
||||||
@ -126,7 +125,6 @@ const sdk = new opentelemetry.NodeSDK({
|
|||||||
traceExporter,
|
traceExporter,
|
||||||
instrumentations: [getNodeAutoInstrumentations()],
|
instrumentations: [getNodeAutoInstrumentations()],
|
||||||
resource: new Resource({
|
resource: new Resource({
|
||||||
// highlight-next-line
|
|
||||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@ -154,7 +152,7 @@ node -r ./tracing.js app.js
|
|||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Javascript instrumentation by following the below steps:
|
||||||
|
|
||||||
@ -169,6 +167,8 @@ npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
|||||||
|
|
||||||
Step 2. Create tracing.js file<br></br>
|
Step 2. Create tracing.js file<br></br>
|
||||||
|
|
||||||
|
You need to configure your service name. In this example, we have used `node_app`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
// tracing.js
|
// tracing.js
|
||||||
'use strict'
|
'use strict'
|
||||||
@ -188,7 +188,6 @@ const sdk = new opentelemetry.NodeSDK({
|
|||||||
traceExporter,
|
traceExporter,
|
||||||
instrumentations: [getNodeAutoInstrumentations()],
|
instrumentations: [getNodeAutoInstrumentations()],
|
||||||
resource: new Resource({
|
resource: new Resource({
|
||||||
// highlight-next-line
|
|
||||||
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
[SemanticResourceAttributes.SERVICE_NAME]: 'node_app'
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
@ -28,12 +28,11 @@ npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
|||||||
|
|
||||||
Step 2. Create `tracer.ts` file<br></br>
|
Step 2. Create `tracer.ts` file<br></br>
|
||||||
|
|
||||||
You need to configure the endpoint for SigNoz cloud in this file.
|
You need to configure the endpoint for SigNoz cloud in this file. You also need to configure your service name. In this example, we have used `sampleNestjsApplication`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
'use strict'
|
'use strict'
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
//OpenTelemetry
|
|
||||||
const opentelemetry = require('@opentelemetry/sdk-node');
|
const opentelemetry = require('@opentelemetry/sdk-node');
|
||||||
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
|
||||||
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
|
||||||
@ -41,9 +40,7 @@ const {Resource} = require('@opentelemetry/resources');
|
|||||||
const {SemanticResourceAttributes} = require('@opentelemetry/semantic-conventions');
|
const {SemanticResourceAttributes} = require('@opentelemetry/semantic-conventions');
|
||||||
|
|
||||||
const exporterOptions = {
|
const exporterOptions = {
|
||||||
// highlight-start
|
|
||||||
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
url: 'https://ingest.{region}.signoz.cloud:443/v1/traces'
|
||||||
// highlight-end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
@ -70,7 +67,7 @@ const sdk = new opentelemetry.NodeSDK({
|
|||||||
module.exports = sdk
|
module.exports = sdk
|
||||||
```
|
```
|
||||||
|
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary accordingly.
|
||||||
|
|
||||||
US - ingest.us.signoz.cloud:443/v1/traces <br></br>
|
US - ingest.us.signoz.cloud:443/v1/traces <br></br>
|
||||||
|
|
||||||
@ -80,7 +77,7 @@ Depending on the choice of your region for SigNoz cloud, the ingest endpoint wil
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
Step 3. Import the tracer module where your app starts
|
Step 3. Import the tracer module where your app starts `(Ex —> main.ts)`
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
const tracer = require('./tracer')
|
const tracer = require('./tracer')
|
||||||
@ -89,7 +86,7 @@ const tracer = require('./tracer')
|
|||||||
|
|
||||||
Step 4. Start the tracer<br></br>
|
Step 4. Start the tracer<br></br>
|
||||||
|
|
||||||
In the `async function boostrap` section of the application code, initialize the tracer as follows:
|
In the `async function boostrap` section of the application code `(Ex —> In main.ts)`, initialize the tracer as follows:
|
||||||
|
|
||||||
```jsx
|
```jsx
|
||||||
const tracer = require('./tracer')
|
const tracer = require('./tracer')
|
||||||
@ -100,9 +97,7 @@ import { AppModule } from './app.module';
|
|||||||
// OpenTelemetry automatic instrumentation must go here.
|
// OpenTelemetry automatic instrumentation must go here.
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
// highlight-start
|
|
||||||
await tracer.start();
|
await tracer.start();
|
||||||
//highlight-end
|
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
await app.listen(3001);
|
await app.listen(3001);
|
||||||
}
|
}
|
||||||
@ -117,7 +112,7 @@ OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" nest sta
|
|||||||
|
|
||||||
You can now run your Nestjs application. The data captured with OpenTelemetry from your application should start showing on the SigNoz dashboard.
|
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.
|
`<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.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -138,6 +133,8 @@ npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
|||||||
|
|
||||||
Step 2. Create `tracer.ts` file<br></br>
|
Step 2. Create `tracer.ts` file<br></br>
|
||||||
|
|
||||||
|
You need to configure your service name. In this example, we have used `sampleNestjsApplication`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
'use strict'
|
'use strict'
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
@ -149,9 +146,7 @@ const {Resource} = require('@opentelemetry/resources');
|
|||||||
const {SemanticResourceAttributes} = require('@opentelemetry/semantic-conventions');
|
const {SemanticResourceAttributes} = require('@opentelemetry/semantic-conventions');
|
||||||
|
|
||||||
const exporterOptions = {
|
const exporterOptions = {
|
||||||
// highlight-start
|
|
||||||
url: 'http://localhost:4318/v1/traces'
|
url: 'http://localhost:4318/v1/traces'
|
||||||
// highlight-end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
@ -198,9 +193,7 @@ import { AppModule } from './app.module';
|
|||||||
// OpenTelemetry automatic instrumentation must go here.
|
// OpenTelemetry automatic instrumentation must go here.
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
// highlight-start
|
|
||||||
await tracer.start();
|
await tracer.start();
|
||||||
//highlight-end
|
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
await app.listen(3001);
|
await app.listen(3001);
|
||||||
}
|
}
|
||||||
@ -213,7 +206,7 @@ Step 5. Run the application
|
|||||||
|
|
||||||
### Applications Deployed on 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/).
|
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](https://signoz.io/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:
|
Once you have set up OTel Collector agent, you can proceed with OpenTelemetry Javascript instrumentation by following the below steps:
|
||||||
|
|
||||||
@ -228,6 +221,8 @@ npm install --save @opentelemetry/exporter-trace-otlp-http@^0.39.1
|
|||||||
|
|
||||||
Step 2. Create `tracer.ts` file<br></br>
|
Step 2. Create `tracer.ts` file<br></br>
|
||||||
|
|
||||||
|
You need to configure your service name. In this example, we have used `sampleNestjsApplication`.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
'use strict'
|
'use strict'
|
||||||
const process = require('process');
|
const process = require('process');
|
||||||
@ -239,9 +234,7 @@ const {Resource} = require('@opentelemetry/resources');
|
|||||||
const {SemanticResourceAttributes} = require('@opentelemetry/semantic-conventions');
|
const {SemanticResourceAttributes} = require('@opentelemetry/semantic-conventions');
|
||||||
|
|
||||||
const exporterOptions = {
|
const exporterOptions = {
|
||||||
// highlight-start
|
|
||||||
url: 'http://localhost:4318/v1/traces'
|
url: 'http://localhost:4318/v1/traces'
|
||||||
// highlight-end
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
const traceExporter = new OTLPTraceExporter(exporterOptions);
|
||||||
@ -288,9 +281,7 @@ import { AppModule } from './app.module';
|
|||||||
// OpenTelemetry automatic instrumentation must go here.
|
// OpenTelemetry automatic instrumentation must go here.
|
||||||
|
|
||||||
async function bootstrap() {
|
async function bootstrap() {
|
||||||
// highlight-start
|
|
||||||
await tracer.start();
|
await tracer.start();
|
||||||
//highlight-end
|
|
||||||
const app = await NestFactory.create(AppModule);
|
const app = await NestFactory.create(AppModule);
|
||||||
await app.listen(3001);
|
await app.listen(3001);
|
||||||
}
|
}
|
||||||
|
@ -68,14 +68,14 @@ Step 4. Run your application
|
|||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||||
opentelemetry-instrument <your_run_command>
|
opentelemetry-instrument <your_run_command>
|
||||||
```
|
```
|
||||||
|
|
||||||
- `<service_name>` is the name of the service you want
|
- `<service_name>` is the name of the service you want
|
||||||
- <your_run_command> can be `python3 app.py` or `python manage.py runserver --noreload`
|
- <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.
|
- 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.
|
||||||
|
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
|
@ -59,14 +59,14 @@ Step 4. Run your application
|
|||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||||
opentelemetry-instrument <your_run_command>
|
opentelemetry-instrument <your_run_command>
|
||||||
```
|
```
|
||||||
|
|
||||||
- *`<service_name>`* is the name of the service you want
|
- *`<service_name>`* is the name of the service you want
|
||||||
- *<your_run_command>* can be `python3 app.py` or `flask run`
|
- *<your_run_command>* can be `python3 app.py` or `gunicorn src.app -b 0.0.0.0:8001`
|
||||||
- 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.
|
- 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.
|
||||||
|
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
|
@ -42,14 +42,14 @@ Step 4. Run your application
|
|||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||||
opentelemetry-instrument <your_run_command>
|
opentelemetry-instrument <your_run_command>
|
||||||
```
|
```
|
||||||
|
|
||||||
- *`<service_name>`* is the name of the service you want
|
- *`<service_name>`* is the name of the service you want
|
||||||
- *<your_run_command>* can be `python3 app.py` or `python manage.py runserver --noreload`
|
- *<your_run_command>* can be `python3 app.py` or `uvicorn main:app --host localhost --port 5002`
|
||||||
- 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.
|
- 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.
|
||||||
|
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
|
@ -42,14 +42,14 @@ Step 4. Run your application
|
|||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
OTEL_EXPORTER_OTLP_PROTOCOL=grpc \
|
||||||
opentelemetry-instrument <your_run_command>
|
opentelemetry-instrument <your_run_command>
|
||||||
```
|
```
|
||||||
|
|
||||||
- *`<service_name>`* is the name of the service you want
|
- *`<service_name>`* is the name of the service you want
|
||||||
- *<your_run_command>* can be `python3 app.py` or `flask run`
|
- *<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.
|
- 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.
|
||||||
|
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
|
@ -33,13 +33,13 @@ Step 3. Run your application
|
|||||||
```bash
|
```bash
|
||||||
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
OTEL_RESOURCE_ATTRIBUTES=service.name=<service_name> \
|
||||||
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
OTEL_EXPORTER_OTLP_ENDPOINT="https://ingest.{region}.signoz.cloud:443" \
|
||||||
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=SIGNOZ_INGESTION_KEY" \
|
OTEL_EXPORTER_OTLP_HEADERS="signoz-access-token=<SIGNOZ_INGESTION_KEY>" \
|
||||||
opentelemetry-instrument <your_run_command>
|
opentelemetry-instrument <your_run_command>
|
||||||
```
|
```
|
||||||
|
|
||||||
- *`<service_name>`* is the name of the service you want
|
- *`<service_name>`* is the name of the service you want
|
||||||
- *`<your_run_command>`* can be `python3 app.py` or `flask run`
|
- *`<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.
|
- 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.
|
||||||
|
|
||||||
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary according to this table.
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
## Collect Application Logs from Log file in SigNoz cloud
|
## Collect Application Logs from Log file in SigNoz cloud
|
||||||
|
|
||||||
If you don’t already have a SigNoz cloud account, you can sign up [here](https://signoz.io/teams/).
|
|
||||||
|
|
||||||
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||||
|
|
||||||
- Add the filelog reciever to `config.yaml`.
|
- Add the filelog reciever to `config.yaml`.
|
||||||
@ -35,4 +33,5 @@ If you don’t already have a SigNoz cloud account, you can sign up [here](https
|
|||||||
- Now we can restart the otel collector so that new changes are applied.
|
- Now we can restart the otel collector so that new changes are applied.
|
||||||
|
|
||||||
- The log will be exported, if you add more lines to the log file it will be exported as well
|
- The log will be exported, if you add more lines to the log file it will be exported as well
|
||||||
|
|
||||||
- If there are no errors your logs will be visible on SigNoz UI.
|
- If there are no errors your logs will be visible on SigNoz UI.
|
||||||
|
@ -1,70 +1,23 @@
|
|||||||
## Collect Syslogs in SigNoz cloud
|
## Collect Docker Container Logs in SigNoz Cloud
|
||||||
|
|
||||||
### Setup Otel Collector as agent
|
- Clone this [repository](https://github.com/SigNoz/docker-container-logs)
|
||||||
|
|
||||||
- Add `config.yaml`
|
- Update `otel-collector-config.yaml` and set the values of `<SIGNOZ_INGESTION_KEY>` and `{region}`.
|
||||||
```yaml {22-26}
|
|
||||||
receivers:
|
|
||||||
filelog:
|
|
||||||
include: [/tmp/python.log]
|
|
||||||
start_at: beginning
|
|
||||||
operators:
|
|
||||||
- type: json_parser
|
|
||||||
timestamp:
|
|
||||||
parse_from: attributes.time
|
|
||||||
layout: '%Y-%m-%d,%H:%M:%S %z'
|
|
||||||
- type: move
|
|
||||||
from: attributes.message
|
|
||||||
to: body
|
|
||||||
- type: remove
|
|
||||||
field: attributes.time
|
|
||||||
processors:
|
|
||||||
batch:
|
|
||||||
send_batch_size: 10000
|
|
||||||
send_batch_max_size: 11000
|
|
||||||
timeout: 10s
|
|
||||||
exporters:
|
|
||||||
otlp:
|
|
||||||
endpoint: 'ingest.{region}.signoz.cloud:443'
|
|
||||||
tls:
|
|
||||||
insecure: false
|
|
||||||
headers:
|
|
||||||
'signoz-access-token': '<SIGNOZ_INGESTION_KEY>'
|
|
||||||
service:
|
|
||||||
pipelines:
|
|
||||||
logs:
|
|
||||||
receivers: [filelog]
|
|
||||||
processors: [batch]
|
|
||||||
exporters: [otlp/log]
|
|
||||||
```
|
|
||||||
|
|
||||||
````
|
Depending on the choice of your region for SigNoz cloud, the ingest endpoint will vary accordingly.
|
||||||
Depending on the choice of your region for SigNoz cloud, the otlp endpoint will vary according to this table.
|
|
||||||
|
|
||||||
| Region | Endpoint |
|
US - ingest.us.signoz.cloud:443 <br></br>
|
||||||
| ------ | -------------------------- |
|
|
||||||
| US | ingest.us.signoz.cloud:443 |
|
|
||||||
| IN | ingest.in.signoz.cloud:443 |
|
|
||||||
| EU | ingest.eu.signoz.cloud:443 |
|
|
||||||
|
|
||||||
* We will start our otel-collector container.
|
IN - ingest.in.signoz.cloud:443 <br></br>
|
||||||
```bash
|
|
||||||
docker run -d --name signoz-host-otel-collector -p 2255:2255 --user root -v $(pwd)/config.yaml:/etc/otel/config.yaml signoz/signoz-otel-collector:0.79.0
|
|
||||||
````
|
|
||||||
|
|
||||||
### Run logspout to collect docker container logs and send it to local otel collector.
|
EU - ingest.eu.signoz.cloud:443 <br></br>
|
||||||
|
|
||||||
Logspout helps in collecting Docker logs by connecting to Docker socket.
|
|
||||||
|
|
||||||
- Run logspout
|
- Start the containers
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
```bash
|
- If there are no errors your logs will be exported and will be visible on the SigNoz UI.
|
||||||
docker run --net=host --rm --name="logspout" \
|
|
||||||
--volume=/var/run/docker.sock:/var/run/docker.sock \
|
|
||||||
gliderlabs/logspout \
|
|
||||||
syslog+tcp://<host>:2255
|
|
||||||
```
|
|
||||||
|
|
||||||
For finding the right host for your SigNoz cluster please follow the guide [here](../install/troubleshooting.md#signoz-otel-collector-address-grid).
|
|
||||||
|
|
||||||
- If there are no errors your logs will be exported and will be visible on the SigNoz UI.
|
|
||||||
|
@ -1,66 +1,58 @@
|
|||||||
If you use fluentBit to collect logs in your stack with this tutotrial you will be able to send logs from fluentBit to SigNoz.
|
## Collect Logs Using FluentBit in SigNoz cloud
|
||||||
|
|
||||||
|
If you use fluentBit to collect logs in your stack, 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.
|
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 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`
|
||||||
- Add fluentforward reciever to your `config.yaml`
|
```yaml
|
||||||
|
receivers:
|
||||||
|
fluentforward:
|
||||||
|
endpoint: 0.0.0.0:24224
|
||||||
|
```
|
||||||
|
Here we have used port 24224 for listening 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).
|
||||||
|
|
||||||
```yaml
|
* Modify your `config.yaml` and add the above receiver
|
||||||
receivers:
|
```yaml {4}
|
||||||
fluentforward:
|
service:
|
||||||
endpoint: 0.0.0.0:24224
|
....
|
||||||
```
|
logs:
|
||||||
|
receivers: [otlp, fluentforward]
|
||||||
|
processors: [batch]
|
||||||
|
exporters: [otlp]
|
||||||
|
```
|
||||||
|
|
||||||
Here we have used port 24224 for listing in fluentforward protocol, but you can change it to a port you want.
|
* Add the following to your fluentBit config to forward the logs to otel collector.
|
||||||
You can read more about fluentforward receiver [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/fluentforwardreceiver).
|
```
|
||||||
|
[OUTPUT]
|
||||||
|
Name forward
|
||||||
|
Match *
|
||||||
|
Host localhost
|
||||||
|
Port 24224
|
||||||
|
```
|
||||||
|
In this config we are forwarding the logs to the otel collector which is listening on port 24224.
|
||||||
|
Also we are assuming that you are running the fluentBit binary on the host. If not, the value of `host` might change depending on your environment.
|
||||||
|
|
||||||
- Modify your `config.yaml` and add the above receiver
|
* Once you make this changes you can restart fluentBit and otel-binary, and you will be able to see the logs in SigNoz.
|
||||||
```yaml {4}
|
|
||||||
service:
|
|
||||||
....
|
|
||||||
logs:
|
|
||||||
receivers: [otlp, fluentforward]
|
|
||||||
processors: [batch]
|
|
||||||
exporters: [otlp]
|
|
||||||
```
|
|
||||||
- Change the fluentBit config to forward the logs to otel collector.
|
|
||||||
|
|
||||||
```
|
* 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](https://signoz.io/docs/userguide/logs/#processors-available-for-processing-logs))
|
||||||
[INPUT]
|
|
||||||
Name dummy
|
eg:-
|
||||||
Tag dummy.log
|
```yaml
|
||||||
Dummy {"message": "mylog", "trace_id": "0000000000000000f4dbb3edd765f620", "span_id": "43222c2d51a7abe3"}
|
processors:
|
||||||
|
logstransform:
|
||||||
[OUTPUT]
|
operators:
|
||||||
Name forward
|
- type: trace_parser
|
||||||
Match *
|
trace_id:
|
||||||
Host otel-collector-host
|
parse_from: attributes.trace_id
|
||||||
Port 24224
|
span_id:
|
||||||
```
|
parse_from: attributes.span_id
|
||||||
|
- type: remove
|
||||||
In this example we are generating sample logs and then forwarding them to the otel collector which is listening on port 24224.
|
field: attributes.trace_id
|
||||||
`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).
|
- type: remove
|
||||||
|
field: attributes.span_id
|
||||||
- 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)
|
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.
|
||||||
|
|
||||||
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.
|
|
@ -1,24 +1,21 @@
|
|||||||
If you use fluentD to collect logs in your stack with this tutotrial you will be able to send logs from fluentD to SigNoz.
|
## Collect Logs Using FluentD in SigNoz cloud
|
||||||
|
|
||||||
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.
|
If you use fluentD to collect logs in your stack, you will be able to send logs from fluentD to SigNoz.
|
||||||
|
|
||||||
### Collect Logs Using FluentD in SigNoz cloud
|
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.
|
||||||
|
|
||||||
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
* 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`
|
|
||||||
|
|
||||||
|
* Add fluentforward reciever to your `config.yaml`
|
||||||
```yaml
|
```yaml
|
||||||
receivers:
|
receivers:
|
||||||
fluentforward:
|
fluentforward:
|
||||||
endpoint: 0.0.0.0:24224
|
endpoint: 0.0.0.0:24224
|
||||||
```
|
```
|
||||||
|
Here we have used port 24224 for listening in fluentforward protocol, but you can change it to a port you want.
|
||||||
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).
|
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
|
* Modify your `config.yaml` and add the above receiver
|
||||||
|
|
||||||
```yaml {4}
|
```yaml {4}
|
||||||
service:
|
service:
|
||||||
....
|
....
|
||||||
@ -28,17 +25,9 @@ At SigNoz we use opentelemetry collector to recieve logs which supports the flue
|
|||||||
exporters: [otlp]
|
exporters: [otlp]
|
||||||
```
|
```
|
||||||
|
|
||||||
- Change the fluentD config to forward the logs to otel collector.
|
* Add the following to your fluentD config to forward the logs to otel collector.
|
||||||
|
|
||||||
```
|
```
|
||||||
<source>
|
<match <directive>>
|
||||||
@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
|
@type forward
|
||||||
send_timeout 60s
|
send_timeout 60s
|
||||||
recover_wait 10s
|
recover_wait 10s
|
||||||
@ -46,34 +35,32 @@ At SigNoz we use opentelemetry collector to recieve logs which supports the flue
|
|||||||
|
|
||||||
<server>
|
<server>
|
||||||
name myserver1
|
name myserver1
|
||||||
host otel-collector-host
|
host localhost
|
||||||
port 24224
|
port 24224
|
||||||
</server>
|
</server>
|
||||||
</match>
|
</match>
|
||||||
```
|
```
|
||||||
|
In this config we are matching a directive and forwarding logs to the otel collector which is listening on port 24224. Replace `<directive>` with your directive name.
|
||||||
|
Also we are assuming that you are running the fluentD binary on the host. If not, the value of `host` might change depending on your environment.
|
||||||
|
* 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](https://signoz.io/docs/userguide/logs/#processors-available-for-processing-logs))
|
||||||
|
|
||||||
In this example we are generating sample logs and then forwarding them to the otel collector which is listening on port 24224.
|
eg:-
|
||||||
`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.
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
- 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)
|
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.
|
||||||
|
|
||||||
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.
|
|
@ -1,12 +1,13 @@
|
|||||||
If you use logstash to collect logs in your stack with this tutotrial you will be able to send logs from logstash to SigNoz.
|
## Collect Logs Using Logstash in SigNoz cloud
|
||||||
|
|
||||||
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
|
If you use logstash to collect logs in your stack, you will be able to send logs from Logstash to SigNoz.
|
||||||
|
|
||||||
## Steps to recieve logs from Logstash:
|
At SigNoz we use OpenTelemetry Collector to recieve logs which supports the TCP protocol. So you can forward your logs from the logstash agent to opentelemetry collector.
|
||||||
|
|
||||||
- Add fluentforward reciever to your `otel-collector-config.yaml` which is present inside `deploy/docker/clickhouse-setup`
|
* Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||||
|
|
||||||
```
|
* Add the reciever to your `config.yaml`
|
||||||
|
```yaml
|
||||||
receivers:
|
receivers:
|
||||||
tcplog/logstash:
|
tcplog/logstash:
|
||||||
max_log_size: 1MiB
|
max_log_size: 1MiB
|
||||||
@ -16,47 +17,32 @@ At SigNoz we use opentelemetry collector to recieve logs which supports the TCP
|
|||||||
add_attributes: false
|
add_attributes: false
|
||||||
operators: []
|
operators: []
|
||||||
```
|
```
|
||||||
|
Here we have used port 2255 for listening in TCP protocol, but you can change it to a port you want.
|
||||||
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).
|
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`
|
* Modify your `config.yaml` and add the above receiver
|
||||||
|
```yaml {4}
|
||||||
```
|
|
||||||
service:
|
service:
|
||||||
...
|
....
|
||||||
|
logs:
|
||||||
logs:
|
receivers: [otlp, tcplog/logstash]
|
||||||
receivers: [ otlp, tcplog/logstash ]
|
processors: [batch]
|
||||||
processors: [ batch ]
|
exporters: [otlp]
|
||||||
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.
|
* Change the logstash config to forward the logs to otel collector.
|
||||||
|
|
||||||
- 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 {
|
output {
|
||||||
tcp {
|
tcp {
|
||||||
codec => json_lines # this is required otherwise it will send eveything in a single line
|
codec => json_lines # this is required otherwise it will send eveything in a single line
|
||||||
host => "otel-collector-host"
|
host => "localhost"
|
||||||
port => 2255
|
port => 2255
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Here we are configuring logstash to send logs to otel-collector that we ran in the previous step, which is listening on port 2255.
|
||||||
|
Also we are assuming that you are running the logstash binary on the host. If not, the value of `host` might change depending on your environment.
|
||||||
|
|
||||||
In this example we are generating sample logs and then forwarding them to the otel collector which is listening on port 2255.
|
* Once you make this changes you can otel binary and logstash, and you will be able to see the logs in SigNoz.
|
||||||
`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](https://signoz.io/docs/userguide/logs/#processors-available-for-processing-logs)).
|
||||||
- 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)
|
|
@ -1,6 +1,6 @@
|
|||||||
## Collect Kubernetes Pod Logs in SigNoz Cloud
|
## Collect Kubernetes Pod Logs in SigNoz Cloud
|
||||||
|
|
||||||
To collect logs from your kubernetes cluster, you will need to deploy k8s-infra chart. Please follow the guide [here](/docs/tutorial/kubernetes-infra-metrics/). Log collection of pods from all namespaces is enabled by default except for pods in `kube-system` and `hotrod`. To modify the log collection mechanism, please follow the guides below.
|
To collect logs from your kubernetes cluster, you will need to deploy k8s-infra chart. Please follow the guide [here](https://signoz.io/docs/tutorial/kubernetes-infra-metrics/). Log collection of pods from all namespaces is enabled by default except for pods in `kube-system` and `hotrod`. To modify the log collection mechanism, please follow the guides below.
|
||||||
|
|
||||||
- [Disable automatic pod logs collection](#steps-to-disable-automatic-pod-logs-collection)
|
- [Disable automatic pod logs collection](https://signoz.io/docs/userguide/collect_kubernetes_pod_logs/#steps-to-disable-automatic-pod-logs-collection)
|
||||||
- [Filter/Exclude logs collection](#steps-to-filterexclude-logs-collection)
|
- [Filter/Exclude logs collection](https://signoz.io/docs/userguide/collect_kubernetes_pod_logs/#steps-to-filterexclude-logs-collection)
|
||||||
|
@ -35,16 +35,16 @@ const supportedLogTypes = [
|
|||||||
id: 'application_logs_log_file',
|
id: 'application_logs_log_file',
|
||||||
imgURL: `Logos/software-window.svg`,
|
imgURL: `Logos/software-window.svg`,
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
name: 'NodeJS Winston Logs ',
|
// name: 'NodeJS Winston Logs ',
|
||||||
id: 'nodejs',
|
// id: 'nodejs',
|
||||||
imgURL: `Logos/node-js.svg`,
|
// imgURL: `Logos/node-js.svg`,
|
||||||
},
|
// },
|
||||||
{
|
// {
|
||||||
name: 'Application Logs using OTEL SDK',
|
// name: 'Application Logs using OTEL SDK',
|
||||||
id: 'application_logs_otel_sdk',
|
// id: 'application_logs_otel_sdk',
|
||||||
imgURL: `Logos/cmd-terminal.svg`,
|
// imgURL: `Logos/cmd-terminal.svg`,
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
name: 'Logs from existing collectors',
|
name: 'Logs from existing collectors',
|
||||||
id: 'existing_collectors',
|
id: 'existing_collectors',
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
## Collect Syslogs in SigNoz cloud
|
## Collect Syslogs in SigNoz cloud
|
||||||
|
|
||||||
If you don’t already have a SigNoz cloud account, you can sign up [here](https://signoz.io/teams/).
|
|
||||||
|
|
||||||
<Tabs>
|
|
||||||
<TabItem value="VM" label="VM" default>
|
|
||||||
|
|
||||||
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
- Add otel collector binary to your VM by following this [guide](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/).
|
||||||
|
|
||||||
- Add the syslog reciever to `config.yaml` to otel-collector.
|
- Add the syslog reciever to `config.yaml` to otel-collector.
|
||||||
|
|
||||||
```yaml {2-10}
|
```yaml {2-10}
|
||||||
@ -22,7 +18,7 @@ If you don’t already have a SigNoz cloud account, you can sign up [here](https
|
|||||||
```
|
```
|
||||||
|
|
||||||
Here we are collecting the logs and moving message from attributes to body using operators that are available.
|
Here we are collecting the logs and moving message from attributes to body using operators that are available.
|
||||||
You can read more about operators [here](./logs.md#operators-for-parsing-and-manipulating-logs).
|
You can read more about operators [here](https://signoz.io/docs/userguide/logs/#operators-for-parsing-and-manipulating-logs).
|
||||||
|
|
||||||
For more configurations that are available for syslog receiver please check [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/syslogreceiver).
|
For more configurations that are available for syslog receiver please check [here](https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/receiver/syslogreceiver).
|
||||||
|
|
||||||
@ -70,14 +66,10 @@ If you don’t already have a SigNoz cloud account, you can sign up [here](https
|
|||||||
action.resumeRetryCount="10"
|
action.resumeRetryCount="10"
|
||||||
queue.type="linkedList" queue.size="10000" template="UTCTraditionalForwardFormat")
|
queue.type="linkedList" queue.size="10000" template="UTCTraditionalForwardFormat")
|
||||||
```
|
```
|
||||||
|
So that you have retries and queue in place to de-couple the sending from other logging action. Also, we are assuming that you are running the otel binary on the same host. If not, the value of target might change depending on your environment.
|
||||||
So that you have retires and queue in place to de-couple the sending from the other logging action.
|
|
||||||
|
|
||||||
The value of `target` might vary depending on where SigNoz is deployed, since it is deployed on the same host I am using `0.0.0.0` for more help you can visit [here](../install/troubleshooting.md#signoz-otel-collector-address-grid).
|
|
||||||
|
|
||||||
- Now restart your rsyslog service by running `sudo systemctl restart rsyslog.service`
|
- Now restart your rsyslog service by running `sudo systemctl restart rsyslog.service`
|
||||||
- You can check the status of service by running `sudo systemctl status rsyslog.service`
|
|
||||||
- If there are no errors your logs will be visible on SigNoz UI.
|
|
||||||
|
|
||||||
</TabItem>
|
- You can check the status of service by running `sudo systemctl status rsyslog.service`
|
||||||
</Tabs>
|
|
||||||
|
- If there are no errors your logs will be visible on SigNoz UI.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user