Merge pull request #4688 from SigNoz/php-onboarding-docs

feat:php flow
This commit is contained in:
CheetoDa 2024-03-20 09:06:34 +05:30 committed by GitHub
commit d9f232683d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 1277 additions and 3 deletions

View File

@ -0,0 +1,24 @@
## Install otel-collector in your Kubernetes infra
 
Add the SigNoz Helm Chart repository
```bash
helm repo add signoz https://charts.signoz.io
```
 
If the chart is already present, update the chart to the latest using:
```bash
helm repo update
```
 
Install the Kubernetes Infrastructure chart provided by SigNoz
```bash
helm install my-release signoz/k8s-infra \
--set otelCollectorEndpoint=ingest.{{REGION}}.signoz.cloud:443 \
--set otelInsecure=false \
--set signozApiKey={{SIGNOZ_INGESTION_KEY}} \
--set global.clusterName=<CLUSTER_NAME>
```
- Replace `<CLUSTER_NAME>` with the name of the Kubernetes cluster or a unique identifier of the cluster.

View File

@ -0,0 +1,64 @@
&nbsp;
After setting up the Otel collector agent, follow the steps below to instrument your PHP Application
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,16 @@
### Set environment variables and run app
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME={MYAPP} \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=<COLLECTOR_ENDPOINT> \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <COLLECTOR_ENDPOINT> - Endpoint at which the collector is running. Ex. -> `http://localhost:4317`
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,60 @@
&nbsp;
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,16 @@
### Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME={{MYAPP}} \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443 \
OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}} \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,96 @@
## Setup OpenTelemetry Binary as an agent
&nbsp;
### Step 1: Download otel-collector tar.gz
```bash
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_amd64.tar.gz
```
&nbsp;
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
```bash
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_amd64.tar.gz -C otelcol-contrib
```
&nbsp;
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
```bash
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
hostmetrics:
collection_interval: 60s
scrapers:
cpu: {}
disk: {}
load: {}
filesystem: {}
memory: {}
network: {}
paging: {}
process:
mute_process_name_error: true
mute_process_exe_error: true
mute_process_io_error: true
processes: {}
prometheus:
config:
global:
scrape_interval: 60s
scrape_configs:
- job_name: otel-collector-binary
static_configs:
- targets:
# - localhost:8888
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] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
timeout: 2s
system:
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
extensions:
health_check: {}
zpages: {}
exporters:
otlp:
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
tls:
insecure: false
headers:
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
logging:
verbosity: normal
service:
telemetry:
metrics:
address: 0.0.0.0:8888
extensions: [health_check, zpages]
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
metrics/internal:
receivers: [prometheus, hostmetrics]
processors: [resourcedetection, batch]
exporters: [otlp]
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
```

View File

@ -0,0 +1,62 @@
&nbsp;
After setting up the Otel collector agent, follow the steps below to instrument your PHP Application
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,41 @@
&nbsp;
Once you are done instrumenting your PHP application, you can run it using the below commands
&nbsp;
### Step 1: Run OTel Collector
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
```bash
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
```
&nbsp;
#### (Optional Step): View last 50 lines of `otelcol` logs
```bash
tail -f -n 50 otelcol-output.log
```
#### (Optional Step): Stop `otelcol`
```bash
kill "$(< otel-pid)"
```
&nbsp;
### Step 2: Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME=<SERVICE_NAME> \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=<COLLECTOR_ENDPOINT> \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <COLLECTOR_ENDPOINT> - Endpoint at which the collector is running. Ex. -> `http://localhost:4317`
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,60 @@
&nbsp;
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,16 @@
### Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME={{MYAPP}} \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443 \
OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}} \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,96 @@
## Setup OpenTelemetry Binary as an agent
&nbsp;
### Step 1: Download otel-collector tar.gz
```bash
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_linux_arm64.tar.gz
```
&nbsp;
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
```bash
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_linux_arm64.tar.gz -C otelcol-contrib
```
&nbsp;
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
```bash
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
hostmetrics:
collection_interval: 60s
scrapers:
cpu: {}
disk: {}
load: {}
filesystem: {}
memory: {}
network: {}
paging: {}
process:
mute_process_name_error: true
mute_process_exe_error: true
mute_process_io_error: true
processes: {}
prometheus:
config:
global:
scrape_interval: 60s
scrape_configs:
- job_name: otel-collector-binary
static_configs:
- targets:
# - localhost:8888
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] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
timeout: 2s
system:
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
extensions:
health_check: {}
zpages: {}
exporters:
otlp:
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
tls:
insecure: false
headers:
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
logging:
verbosity: normal
service:
telemetry:
metrics:
address: 0.0.0.0:8888
extensions: [health_check, zpages]
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
metrics/internal:
receivers: [prometheus, hostmetrics]
processors: [resourcedetection, batch]
exporters: [otlp]
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
```

View File

@ -0,0 +1,62 @@
&nbsp;
After setting up the Otel collector agent, follow the steps below to instrument your PHP Application
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,41 @@
&nbsp;
Once you are done instrumenting your Rust application, you can run it using the below commands
&nbsp;
### Step 1: Run OTel Collector
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
```bash
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
```
&nbsp;
#### (Optional Step): View last 50 lines of `otelcol` logs
```bash
tail -f -n 50 otelcol-output.log
```
#### (Optional Step): Stop `otelcol`
```bash
kill "$(< otel-pid)"
```
&nbsp;
### Step 2: Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME=<SERVICE_NAME> \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=<COLLECTOR_ENDPOINT> \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <COLLECTOR_ENDPOINT> - Endpoint at which the collector is running. Ex. -> `http://localhost:4317`
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,60 @@
&nbsp;
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,16 @@
### Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME={{MYAPP}} \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443 \
OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}} \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,96 @@
### Setup OpenTelemetry Binary as an agent
&nbsp;
### Step 1: Download otel-collector tar.gz
```bash
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_amd64.tar.gz
```
&nbsp;
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
```bash
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_amd64.tar.gz -C otelcol-contrib
```
&nbsp;
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
```bash
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
hostmetrics:
collection_interval: 60s
scrapers:
cpu: {}
disk: {}
load: {}
filesystem: {}
memory: {}
network: {}
paging: {}
process:
mute_process_name_error: true
mute_process_exe_error: true
mute_process_io_error: true
processes: {}
prometheus:
config:
global:
scrape_interval: 60s
scrape_configs:
- job_name: otel-collector-binary
static_configs:
- targets:
# - localhost:8888
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] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
timeout: 2s
system:
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
extensions:
health_check: {}
zpages: {}
exporters:
otlp:
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
tls:
insecure: false
headers:
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
logging:
verbosity: normal
service:
telemetry:
metrics:
address: 0.0.0.0:8888
extensions: [health_check, zpages]
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
metrics/internal:
receivers: [prometheus, hostmetrics]
processors: [resourcedetection, batch]
exporters: [otlp]
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
```

View File

@ -0,0 +1,62 @@
&nbsp;
After setting up the Otel collector agent, follow the steps below to instrument your PHP Application
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,41 @@
&nbsp;
Once you are done instrumenting your Rust application, you can run it using the below commands
&nbsp;
### Step 1: Run OTel Collector
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
```bash
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
```
&nbsp;
#### (Optional Step): View last 50 lines of `otelcol` logs
```bash
tail -f -n 50 otelcol-output.log
```
#### (Optional Step): Stop `otelcol`
```bash
kill "$(< otel-pid)"
```
&nbsp;
### Step 2: Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME=<SERVICE_NAME> \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=<COLLECTOR_ENDPOINT> \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <COLLECTOR_ENDPOINT> - Endpoint at which the collector is running. Ex. -> `http://localhost:4317`
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,60 @@
&nbsp;
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,16 @@
### Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME={{MYAPP}} \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=https://ingest.{{REGION}}.signoz.cloud:443 \
OTEL_EXPORTER_OTLP_HEADERS=signoz-access-token={{SIGNOZ_INGESTION_KEY}} \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <your-run-command> - Run command for your PHP application

View File

@ -0,0 +1,96 @@
## Setup OpenTelemetry Binary as an agent
&nbsp;
### Step 1: Download otel-collector tar.gz
```bash
wget https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/v0.79.0/otelcol-contrib_0.79.0_darwin_arm64.tar.gz
```
&nbsp;
### Step 2: Extract otel-collector tar.gz to the `otelcol-contrib` folder
```bash
mkdir otelcol-contrib && tar xvzf otelcol-contrib_0.79.0_darwin_arm64.tar.gz -C otelcol-contrib
```
&nbsp;
### Step 3: Create config.yaml in folder otelcol-contrib with the below content in it
```bash
receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318
hostmetrics:
collection_interval: 60s
scrapers:
cpu: {}
disk: {}
load: {}
filesystem: {}
memory: {}
network: {}
paging: {}
process:
mute_process_name_error: true
mute_process_exe_error: true
mute_process_io_error: true
processes: {}
prometheus:
config:
global:
scrape_interval: 60s
scrape_configs:
- job_name: otel-collector-binary
static_configs:
- targets:
# - localhost:8888
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] # Before system detector, include ec2 for AWS, gcp for GCP and azure for Azure.
# Using OTEL_RESOURCE_ATTRIBUTES envvar, env detector adds custom labels.
timeout: 2s
system:
hostname_sources: [os] # alternatively, use [dns,os] for setting FQDN as host.name and os as fallback
extensions:
health_check: {}
zpages: {}
exporters:
otlp:
endpoint: "ingest.{{REGION}}.signoz.cloud:443"
tls:
insecure: false
headers:
"signoz-access-token": "{{SIGNOZ_INGESTION_KEY}}"
logging:
verbosity: normal
service:
telemetry:
metrics:
address: 0.0.0.0:8888
extensions: [health_check, zpages]
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
metrics/internal:
receivers: [prometheus, hostmetrics]
processors: [resourcedetection, batch]
exporters: [otlp]
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlp]
```

View File

@ -0,0 +1,62 @@
&nbsp;
After setting up the Otel collector agent, follow the steps below to instrument your PHP Application
### Step 1: Setup Development Environment
Add these crates just below the `[dependencies]` section of your `cargo.toml` file
To configure our PHP application to send data, you need to use OpenTelemetry PHP extension. Since the extension is built from the source, you need to have the build tools, which can be installed using the following command:
**Linux**:
```bash
sudo apt-get install gcc make autoconf
```
**MacOs(Homebrew)**:
```bash
brew install gcc make autoconf
```
&nbsp;
### Step 2: Build the extension
With our environment set up we can install the extension using [PECL](https://pecl.php.net/):
```bash
pecl install opentelemetry
```
After successfully installing the OpenTelemetry extension, add the extension to php.ini file of your project:
```bash
[opentelemetry]
extension=opentelemetry.so
```
Verify that the extension is enabled by running:
```bash
php -m | grep opentelemetry
```
Running the above command will **output**:
```bash
opentelemetry
```
&nbsp;
### Step 3: Add the dependencies
Add dependencies required to perform automatic instrumentation using this command :
```bash
composer config allow-plugins.php-http/discovery false
composer require \
open-telemetry/sdk \
open-telemetry/exporter-otlp \
php-http/guzzle7-adapter \
open-telemetry/transport-grpc
```

View File

@ -0,0 +1,41 @@
&nbsp;
Once you are done instrumenting your Rust application, you can run it using the below commands
&nbsp;
### Step 1: Run OTel Collector
Run this command inside the `otelcol-contrib` directory that you created in the install Otel Collector step
```bash
./otelcol-contrib --config ./config.yaml &> otelcol-output.log & echo "$!" > otel-pid
```
&nbsp;
#### (Optional Step): View last 50 lines of `otelcol` logs
```bash
tail -f -n 50 otelcol-output.log
```
#### (Optional Step): Stop `otelcol`
```bash
kill "$(< otel-pid)"
```
&nbsp;
### Step 2: Running your PHP application
We will pass environment variables at the runtime:
```bash
env OTEL_PHP_AUTOLOAD_ENABLED=true \
OTEL_SERVICE_NAME=<SERVICE_NAME> \
OTEL_TRACES_EXPORTER=otlp \
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf \
OTEL_EXPORTER_OTLP_ENDPOINT=<COLLECTOR_ENDPOINT> \
OTEL_PROPAGATORS=baggage,tracecontext \
<your-run-command>
```
- <COLLECTOR_ENDPOINT> - Endpoint at which the collector is running. Ex. -> `http://localhost:4317`
- <your-run-command> - Run command for your PHP application

View File

@ -403,6 +403,38 @@ import APM_javascript_reactjs_macOsARM64_quickStart_runApplication from '../Modu
import APM_javascript_reactjs_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Javascript/md-docs/ReactJS/MacOsARM64/Recommended/reactjs-macosarm64-recommended-installOtelCollector.md';
import APM_javascript_reactjs_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Javascript/md-docs/ReactJS/MacOsARM64/Recommended/reactjs-macosarm64-recommended-instrumentApplication.md';
import APM_javascript_reactjs_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Javascript/md-docs/ReactJS/MacOsARM64/Recommended/reactjs-macosarm64-recommended-runApplication.md';
// PHP-Kubernetes
import APM_php_kubernetes_recommendedSteps_setupOtelCollector from '../Modules/APM/Php/md-docs/Kubernetes/php-kubernetes-installOtelCollector.md';
import APM_php_kubernetes_recommendedSteps_instrumentApplication from '../Modules/APM/Php/md-docs/Kubernetes/php-kubernetes-instrumentApplication.md';
import APM_php_kubernetes_recommendedSteps_runApplication from '../Modules/APM/Php/md-docs/Kubernetes/php-kubernetes-runApplication.md';
// PHP-LinuxAMD64-quickstart
import APM_php_linuxAMD64_quickStart_instrumentApplication from '../Modules/APM/Php/md-docs/LinuxAMD64/QuickStart/php-linuxamd64-quickStart-instrumentApplication.md';
import APM_php_linuxAMD64_quickStart_runApplication from '../Modules/APM/Php/md-docs/LinuxAMD64/QuickStart/php-linuxamd64-quickStart-runApplication.md';
// PHP-LinuxAMD64-recommended
import APM_php_linuxAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Php/md-docs/LinuxAMD64/Recommended/php-linuxamd64-recommended-installOtelCollector.md';
import APM_php_linuxAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Php/md-docs/LinuxAMD64/Recommended/php-linuxamd64-recommended-instrumentApplication.md';
import APM_php_linuxAMD64_recommendedSteps_runApplication from '../Modules/APM/Php/md-docs/LinuxAMD64/Recommended/php-linuxamd64-recommended-runApplication.md';
// PHP-LinuxARM64-quickstart
import APM_php_linuxARM64_quickStart_instrumentApplication from '../Modules/APM/Php/md-docs/LinuxARM64/QuickStart/php-linuxarm64-quickStart-instrumentApplication.md';
import APM_php_linuxARM64_quickStart_runApplication from '../Modules/APM/Php/md-docs/LinuxARM64/QuickStart/php-linuxarm64-quickStart-runApplication.md';
// PHP-LinuxARM64-recommended
import APM_php_linuxARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Php/md-docs/LinuxARM64/Recommended/php-linuxarm64-recommended-installOtelCollector.md';
import APM_php_linuxARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Php/md-docs/LinuxARM64/Recommended/php-linuxarm64-recommended-instrumentApplication.md';
import APM_php_linuxARM64_recommendedSteps_runApplication from '../Modules/APM/Php/md-docs/LinuxARM64/Recommended/php-linuxarm64-recommended-runApplication.md';
// PHP-MacOsAMD64-quickstart
import APM_php_macOsAMD64_quickStart_instrumentApplication from '../Modules/APM/Php/md-docs/MacOsAMD64/QuickStart/php-macosamd64-quickStart-instrumentApplication.md';
import APM_php_macOsAMD64_quickStart_runApplication from '../Modules/APM/Php/md-docs/MacOsAMD64/QuickStart/php-macosamd64-quickStart-runApplication.md';
// PHP-MacOsAMD64-recommended
import APM_php_macOsAMD64_recommendedSteps_setupOtelCollector from '../Modules/APM/Php/md-docs/MacOsAMD64/Recommended/php-macosamd64-recommended-installOtelCollector.md';
import APM_php_macOsAMD64_recommendedSteps_instrumentApplication from '../Modules/APM/Php/md-docs/MacOsAMD64/Recommended/php-macosamd64-recommended-instrumentApplication.md';
import APM_php_macOsAMD64_recommendedSteps_runApplication from '../Modules/APM/Php/md-docs/MacOsAMD64/Recommended/php-macosamd64-recommended-runApplication.md';
// PHP-MacOsARM64-quickstart
import APM_php_macOsARM64_quickStart_instrumentApplication from '../Modules/APM/Php/md-docs/MacOsARM64/QuickStart/php-macosarm64-quickStart-instrumentApplication.md';
import APM_php_macOsARM64_quickStart_runApplication from '../Modules/APM/Php/md-docs/MacOsARM64/QuickStart/php-macosarm64-quickStart-runApplication.md';
// PHP-MacOsARM64-recommended
import APM_php_macOsARM64_recommendedSteps_setupOtelCollector from '../Modules/APM/Php/md-docs/MacOsARM64/Recommended/php-macosarm64-recommended-installOtelCollector.md';
import APM_php_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Php/md-docs/MacOsARM64/Recommended/php-macosarm64-recommended-instrumentApplication.md';
import APM_php_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Php/md-docs/MacOsARM64/Recommended/php-macosarm64-recommended-runApplication.md';
/// ////// Javascript Done
/// ///// Python Start
// Django
@ -575,7 +607,6 @@ import APM_python_other_macOsARM64_recommendedSteps_setupOtelCollector from '../
import APM_python_other_macOsARM64_recommendedSteps_instrumentApplication from '../Modules/APM/Python/md-docs/Others/MacOsARM64/Recommended/others-macosarm64-recommended-instrumentApplication.md';
import APM_python_other_macOsARM64_recommendedSteps_runApplication from '../Modules/APM/Python/md-docs/Others/MacOsARM64/Recommended/others-macosarm64-recommended-runApplication.md';
// ----------------------------------------------------------------------------
/// ////// Go Done
/// ///// ROR Start
// ROR-Kubernetes
import APM_rails_kubernetes_recommendedSteps_setupOtelCollector from '../Modules/APM/RubyOnRails/md-docs/Kubernetes/ror-kubernetes-installOtelCollector.md';
@ -1546,4 +1577,36 @@ export const ApmDocFilePaths = {
APM_swift_macOsARM64_recommendedSteps_setupOtelCollector,
APM_swift_macOsARM64_recommendedSteps_instrumentApplication,
APM_swift_macOsARM64_recommendedSteps_runApplication,
APM_php_kubernetes_recommendedSteps_setupOtelCollector,
APM_php_kubernetes_recommendedSteps_instrumentApplication,
APM_php_kubernetes_recommendedSteps_runApplication,
APM_php_linuxAMD64_quickStart_instrumentApplication,
APM_php_linuxAMD64_quickStart_runApplication,
APM_php_linuxAMD64_recommendedSteps_setupOtelCollector,
APM_php_linuxAMD64_recommendedSteps_instrumentApplication,
APM_php_linuxAMD64_recommendedSteps_runApplication,
APM_php_linuxARM64_quickStart_instrumentApplication,
APM_php_linuxARM64_quickStart_runApplication,
APM_php_linuxARM64_recommendedSteps_setupOtelCollector,
APM_php_linuxARM64_recommendedSteps_instrumentApplication,
APM_php_linuxARM64_recommendedSteps_runApplication,
APM_php_macOsAMD64_quickStart_instrumentApplication,
APM_php_macOsAMD64_quickStart_runApplication,
APM_php_macOsAMD64_recommendedSteps_setupOtelCollector,
APM_php_macOsAMD64_recommendedSteps_instrumentApplication,
APM_php_macOsAMD64_recommendedSteps_runApplication,
APM_php_macOsARM64_quickStart_instrumentApplication,
APM_php_macOsARM64_quickStart_runApplication,
APM_php_macOsARM64_recommendedSteps_setupOtelCollector,
APM_php_macOsARM64_recommendedSteps_instrumentApplication,
APM_php_macOsARM64_recommendedSteps_runApplication,
};

View File

@ -132,6 +132,11 @@ const supportedLanguages = [
id: 'swift',
imgURL: `/Logos/swift.png`,
},
{
name: 'php',
id: 'php',
imgURL: `/Logos/php.png`,
},
];
export const defaultLogsType = {
@ -293,7 +298,8 @@ export const getSupportedFrameworks = ({
(moduleID === ModulesMap.APM && dataSourceName === '.NET') ||
(moduleID === ModulesMap.APM && dataSourceName === 'rust') ||
(moduleID === ModulesMap.APM && dataSourceName === 'elixir') ||
(moduleID === ModulesMap.APM && dataSourceName === 'swift')
(moduleID === ModulesMap.APM && dataSourceName === 'swift') ||
(moduleID === ModulesMap.APM && dataSourceName === 'php')
) {
return [];
}
@ -322,7 +328,8 @@ export const hasFrameworks = ({
(moduleID === ModulesMap.APM && dataSourceName === '.NET') ||
(moduleID === ModulesMap.APM && dataSourceName === 'rust') ||
(moduleID === ModulesMap.APM && dataSourceName === 'elixir') ||
(moduleID === ModulesMap.APM && dataSourceName === 'swift')
(moduleID === ModulesMap.APM && dataSourceName === 'swift') ||
(moduleID === ModulesMap.APM && dataSourceName === 'php')
) {
return false;
}