|
3 | 3 | The `solarwinds_apm` gem starting from version 6.0.0 is an [OpenTelemetry Ruby](https://opentelemetry.io/docs/instrumentation/ruby/) distribution. It provides automatic instrumentation and custom SolarWinds Observability features for Ruby applications.
|
4 | 4 |
|
5 | 5 | ## Requirements
|
| 6 | +> [!NOTE] |
| 7 | +> Versions before 7.0.0 only support Linux and will go into no-op mode on other platforms. |
6 | 8 |
|
7 |
| -Only Linux is supported, the gem will go into no-op mode on other platforms. MRI Ruby version 3 or above is required. The [SolarWinds Observability documentation website](https://documentation.solarwinds.com/en/success_center/observability/content/configure/services/ruby/install.htm) has details on the supported platforms and system dependencies. |
| 9 | +MRI Ruby version 3 or above is required. The [SolarWinds Observability documentation website](https://documentation.solarwinds.com/en/success_center/observability/content/configure/services/ruby/install.htm) has details on the supported platforms and system dependencies. |
8 | 10 |
|
9 | 11 | See [CONTRIBUTING.md](CONTRIBUTING.md) for how to build for development.
|
10 | 12 |
|
@@ -32,7 +34,7 @@ The only required configuration is the service key, which can be set in the `SW_
|
32 | 34 |
|
33 | 35 | ## Custom Instrumentation
|
34 | 36 |
|
35 |
| -`solarwinds_apm` supports the standard OpenTelemetry API for tracing and includes a helper to ease its use in manual instrumentation. Additionally, a set of SolarWindsAPM APIs are provided for features specific to SolarWinds Observability. |
| 37 | +`solarwinds_apm` supports the standard OpenTelemetry API and includes a few convenience methods for manual instrumentation. Additionally, a set of SolarWindsAPM APIs are provided for features specific to SolarWinds Observability. |
36 | 38 |
|
37 | 39 | ### Using the OpenTelemetry API
|
38 | 40 |
|
@@ -60,6 +62,25 @@ current_span = ::OpenTelemetry::Trace.current_span
|
60 | 62 |
|
61 | 63 | Note that if `OpenTelemetry::SDK.configure` is used to set up a `TracerProvider`, it will not be configured with our distribution's customizations and manual instrumentation made with its `Tracer` object will not be reported to SolarWinds Observability.
|
62 | 64 |
|
| 65 | +This gem also initializes a global `MeterProvider`, so your application can create Meters and Metric Instruments as follows to collect custom metrics, which will be exported every 60 seconds. |
| 66 | + |
| 67 | +```ruby |
| 68 | +# set up meter and create a counter instrument |
| 69 | +MyAppMeter = ::OpenTelemetry.meter_provider.meter('myapp') |
| 70 | +counter = MyAppMeter.create_counter('password.resets', |
| 71 | + description: 'Count of password reset requests to myapp', |
| 72 | + unit: '{request}' |
| 73 | +) |
| 74 | + |
| 75 | +# increment counter |
| 76 | +def reset |
| 77 | + counter.add(1, attributes: {'user.id' => user_id}) |
| 78 | + # do things |
| 79 | +end |
| 80 | +``` |
| 81 | + |
| 82 | +See the [OTel Ruby Metrics README](https://github.com/open-telemetry/opentelemetry-ruby/blob/main/metrics_api/README.md) for more information on the API and links to examples. |
| 83 | + |
63 | 84 | ### Using the SolarWindsAPM API
|
64 | 85 |
|
65 | 86 | Several convenience and vendor-specific APIs are availabe to an application where `solarwinds_apm` has been loaded, below is a quick overview of the features provided. The full reference can be found at the [RubyDoc page for this gem](https://rubydoc.info/github/solarwinds/apm-ruby).
|
@@ -158,7 +179,10 @@ By default, transaction names are constructed based on attributes such as the re
|
158 | 179 | result = SolarWindsAPM::API.set_transaction_name('my-custom-trace-name')
|
159 | 180 | ```
|
160 | 181 |
|
161 |
| -#### Send Custom Metrics (Depreciated) |
| 182 | +#### Send Custom Metrics (Deprecated) |
| 183 | + |
| 184 | +> [!NOTE] |
| 185 | +> Starting from version 7.0.0 these are no-op, standard OTel API should be used instead. |
162 | 186 |
|
163 | 187 | Service metrics are automatically collected by this library. In addition, the following methods support sending two types of custom metrics:
|
164 | 188 |
|
|
0 commit comments