forked from colin/SimpleOtel
Update README.md
This commit is contained in:
parent
228226fce8
commit
2ec1084fff
58
README.md
58
README.md
|
@ -1,11 +1,11 @@
|
|||
# Simple Tracking Plugin Installation
|
||||
# Simple Otel Plugin Installation
|
||||
|
||||
## Installation
|
||||
|
||||
To install or update the Simple Tracking plugin, run the following command from the root of your WordPress HTML directory:
|
||||
To install or update the Simple Otel plugin, run the following command from the root of your WordPress HTML directory:
|
||||
|
||||
```sh
|
||||
curl -sSL https://git.nixc.us/colin/SimpleTracking/raw/branch/main/install.sh | bash
|
||||
curl -sSL https://git.nixc.us/colin/SimpleOtel/raw/branch/main/install.sh | bash
|
||||
```
|
||||
|
||||
## Enabling the Plugin
|
||||
|
@ -14,21 +14,57 @@ After running the install script, you need to activate the plugin. You can do th
|
|||
|
||||
1. Log in to your WordPress admin dashboard.
|
||||
2. Navigate to `Plugins > Installed Plugins`.
|
||||
3. Find `Simple Tracking` in the list and click `Activate`.
|
||||
3. Find `Simple Otel` in the list and click `Activate`.
|
||||
|
||||
Alternatively, you can activate the plugin using WP-CLI:
|
||||
|
||||
```sh
|
||||
wp plugin activate simple-tracking --allow-root
|
||||
wp plugin activate simple-otel --allow-root
|
||||
```
|
||||
|
||||
## What `install.sh` Does
|
||||
|
||||
The `install.sh` script performs the following actions:
|
||||
|
||||
1. Defines the URL for downloading the `simple-tracking.php` file.
|
||||
2. Creates the target directory (`wp-content/plugins/simple-tracking`) if it doesn't exist.
|
||||
3. Downloads the `simple-tracking.php` file into the target directory.
|
||||
4. Creates a blank `tracking-code.php` file if it doesn't already exist and instructs the user to add their tracking code to it.
|
||||
5. Sets the correct permissions for the `simple-tracking.php` and `tracking-code.php` files.
|
||||
6. Prints a message indicating that the Simple Tracking plugin has been installed or updated successfully.
|
||||
1. Defines the URL for downloading the `simple-otel.php` file.
|
||||
2. Creates the target directory (`wp-content/plugins/simple-otel`) if it doesn't exist.
|
||||
3. Downloads the `simple-otel.php` file into the target directory.
|
||||
4. Creates a blank `config.php` file if it doesn't already exist and provides a template for configuration.
|
||||
5. Sets the correct permissions for the `simple-otel.php` and `config.php` files.
|
||||
6. Prints a message indicating that the Simple Otel plugin has been installed or updated successfully.
|
||||
|
||||
## Configuration
|
||||
|
||||
After installing the plugin, you can customize its behavior by editing the `config.php` file located in `wp-content/plugins/simple-otel/`.
|
||||
|
||||
### Example `config.php`
|
||||
|
||||
Here is an example configuration for the `config.php` file:
|
||||
|
||||
```php
|
||||
<?php
|
||||
// Configuration for Simple Otel plugin
|
||||
// Add your configurations here
|
||||
|
||||
// Set default values using environment variables or fallback to manual configuration
|
||||
$otel_service_name = getenv('OTEL_SERVICE_NAME') ?: 'default-service-name';
|
||||
$otel_exporter_otlp_endpoint = getenv('OTEL_EXPORTER_OTLP_ENDPOINT') ?: 'http://localhost:4317';
|
||||
|
||||
// Apply configurations
|
||||
if (isset($GLOBALS['tracer'])) {
|
||||
$GLOBALS['tracer']->setAttribute('service.name', $otel_service_name);
|
||||
$GLOBALS['tracer']->setAttribute('otel.exporter.otlp.endpoint', $otel_exporter_otlp_endpoint);
|
||||
}
|
||||
?>
|
||||
```
|
||||
|
||||
### Explanation
|
||||
|
||||
- **Service Name**: Set the name of the service as it will appear in your observability platform. It uses the `OTEL_SERVICE_NAME` environment variable if set; otherwise, it defaults to `default-service-name`.
|
||||
- **OTLP Endpoint**: Specify the endpoint where the OpenTelemetry Collector is running. It uses the `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable if set; otherwise, it defaults to `http://localhost:4317`.
|
||||
|
||||
You can add more configuration options as needed. The plugin will include this file and apply the configurations when it initializes.
|
||||
|
||||
## Additional Information
|
||||
|
||||
For more information on how to use and configure the Simple Otel plugin, please refer to the documentation or visit the [OpenTelemetry PHP documentation](https://opentelemetry.io/docs/php/).
|
Loading…
Reference in New Issue