README.md in aspecto-opentelemetry-0.1.1 vs README.md in aspecto-opentelemetry-0.1.2
- old
+ new
@@ -1,77 +1,111 @@
# Aspecto::OpenTelemetry
-Aspecto's SDK for ruby. This gem is a distribution of OpenTelemetry configured to use all available instrumentations and export trace data to Aspecto.
+Aspecto's SDK for ruby.
+This gem is a distribution of OpenTelemetry pre-configured to use all available instrumentations and export trace data to Aspecto.
## Installation
-Add this line to your application's Gemfile:
+Install the gem using:
-```ruby
-gem 'aspecto-opentelemetry'
+```zsh
+$ gem install aspecto-opentelemetry
```
-And then execute:
+Or, if you use [bundler](https://bundler.io), include aspecto-opentelemetry in your Gemfile.
- $ bundle install
+## Usage
-Or install it yourself as:
+### Rails Applications
- $ gem install aspecto-opentelemetry
+#### Configuration in Code
-## Usage
+Add this code to a new file `aspecto.rb` under `config/initializers/`:
-### Auto Instrumentation
+```rb
+# config/initializers/aspecto.rb
+require 'aspecto/opentelemetry'
-Does not require code changes. Just modify you `Gemfile` to add `require` like this:
+Aspecto::OpenTelemetry::configure do |c|
+ c.service_name = '<YOUR_SERIVCE_NAME>'
+ c.aspecto_auth = '<YOUR_ASPECTO_TOKEN>'
+ # c.sampling_ratio = 1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
+end
+```
+#### Configuration via Environment Variables
+
+In your Gemfile:
+
```
gem 'aspecto-opentelemetry', require: 'aspecto/auto_instrument'
```
-When using auto-instrumentation, you need to pass relevant configuration options via environment variables.
+And set environment variables:
-### Manual Instrumentation
+```
+OTEL_SERVICE_NAME=<YOUR_SERIVCE_NAME>
+ASPECTO_AUTH=<YOUR_ASPECTO_TOKEN>
+# ASPECTO_SAMPLING_RATIO=1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
+```
-Allow you to configure the SDK via code:
+### Ruby Applications
+#### Configuration in Code
+
+Add this code after your require other gems:
+
```rb
require 'aspecto/opentelemetry'
-Aspecto::OpenTelemetry::configure
+Aspecto::OpenTelemetry::configure do |c|
+ c.service_name = '<YOUR_SERIVCE_NAME>'
+ c.aspecto_auth = '<YOUR_ASPECTO_TOKEN>'
+ # c.env = '<CURRENT_ENVIRONMENT>' # [optional]: automatically detected for rails and sinatra
+ # c.sampling_ratio = 1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
+end
```
-Add this code at the beginning of your application.
-For rails - add this code to a file `aspecto.rb` under `config/initializers/`.
+#### Configuration via Environment Variables
-## Configuration
+Add this require statement after your require other gems:
-You can set configuration it 2 ways: via environment variables or via code.
-The only required config options are `aspecto_auth` and `service_name`.
+```rb
+require 'aspecto/auto_instrument'
+```
-### Configuration in Code
+And set environment variables:
-```rb
-require 'aspecto/opentelemetry'
+```
+OTEL_SERVICE_NAME=<YOUR_SERIVCE_NAME>
+ASPECTO_AUTH=<YOUR_ASPECTO_TOKEN>
+# ASPECTO_ENV=<CURRENT_ENVIRONMENT> # [optional]: automatically detected for rails and sinatra
+# ASPECTO_SAMPLING_RATIO=1.0 # [optional]: defaults to 1.0, use aspecto app to configure remotely
+```
-Aspecto::OpenTelemetry::configure do |c|
- c.service_name = 'MY_SERIVCE'
- c.aspecto_auth = 'YOUR_TOKEN_HERE'
- c.env = 'MY_COOL_ENV'
- c.sampling_ratio = 0.1
-end
+### Shutdown
+
+Call this function when your application shuts down
+
+```rb
+Aspecto::OpenTelemetry::shutdown
```
-### Configuration Options
+## Configuration
-| Option Name | Environment Variable | Type | Default | Description |
-| -------------- | ---------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
-| `aspecto_auth` | `ASPECTO_AUTH` | UUID string | - | Aspecto's [API key for authentication](https://app.aspecto.io/app/integration/api-key) |
-| `service_name` | `OTEL_SERVICE_NAME` | string | - | name of the service which is sending telemetry |
-| `env` | `ASPECTO_ENV` | string | extracted from rails or sinatra if used | deployment environment: `production` / `staging` / `development`, etc. |
-| `log_level` | `OTEL_LOG_LEVEL` | string | `ERROR` | `ERROR` / `WARN` / `INFO`, etc. |
-| `sampling_ratio` | `ASPECTO_SAMPLING_RATIO` | float | 1.0 | How many of the traces starting in this service should be sampled. set to number in range [0.0, 1.0] where 0.0 is no sampling, and 1.0 is sample all |
+You can set configuration via environment variables or via code. Values set in code takes precedence.
+The only required config options are [`aspecto_auth`](https://app.aspecto.io/app/integration/api-key) and `service_name`.
+### Configuration Options
+
+| Option Name | Environment Variable | Type | Default | Description |
+| ------------------------------------ | ------------------------------------ | ----------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `aspecto_auth` | `ASPECTO_AUTH` | UUID string | - | Aspecto's [API key for authentication](https://app.aspecto.io/app/integration/api-key) |
+| `service_name` | `OTEL_SERVICE_NAME` | string | - | name of the service which is sending telemetry |
+| `env` | `ASPECTO_ENV` | string | extracted from rails or sinatra if used | deployment environment: `production` / `staging` / `development`, etc. |
+| `log_level` | `OTEL_LOG_LEVEL` | string | `ERROR` | `ERROR` / `WARN` / `INFO`, etc. |
+| `sampling_ratio` | `ASPECTO_SAMPLING_RATIO` | float | 1.0 | How many of the traces starting in this service should be sampled. set to number in range [0.0, 1.0] where 0.0 is no sampling, and 1.0 is sample all |
+| `otel_exporter_otlp_traces_endpoint` | `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | URL | "https://otelcol.aspecto.io/v1/trace" | Url |
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/aspecto-io/aspecto-opentelemetry-ruby.