Skip to content

Commit

Permalink
Merge branch 'main' of github.com:solarwinds/apm-ruby into NH-85973
Browse files Browse the repository at this point in the history
  • Loading branch information
xuan-cao-swi committed Aug 23, 2024
2 parents d01e116 + 37f11c0 commit 5d23630
Show file tree
Hide file tree
Showing 18 changed files with 167 additions and 72 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci-markdown-link.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Markdown Link Check

on:
pull_request:

jobs:
markdown-link-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# act -j markdown-link-check --container-architecture linux/arm64
- name: "Markdown Link Check"
uses: gaurav-nelson/github-action-markdown-link-check@v1
with:
config-file: '.markdown-link-check.json'
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
21 changes: 21 additions & 0 deletions .github/workflows/ci-markdownlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Markdown Lint Check

on:
pull_request:

jobs:
markdownlint-check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

# equivalent cli: markdownlint-cli2 "**/*.md" "#lambda/.aws-sam/**" "#.github/pull_request_template.md" "#.github/ISSUE_TEMPLATE/bug-or-feature-request.md" --config .markdownlint.json
- name: "Markdown Lint Check"
uses: DavidAnson/markdownlint-cli2-action@v16
with:
fix: false
globs: |
**/*.md
!lambda/.aws-sam/**
!.github/pull_request_template.md
!.github/ISSUE_TEMPLATE/bug-or-feature-request.md
10 changes: 10 additions & 0 deletions .markdown-link-check.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"ignorePatterns": [
{
"pattern": "^http://localhost"
}
],
"timeout": "5s",
"retryOn429": true,
"aliveStatusCodes": [200, 206, 429]
}
14 changes: 14 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"emphasis-style": false,
"line-length": false,
"link-fragments": false,
"list-marker-space": false,
"no-emphasis-as-heading": false,
"no-hard-tabs": false,
"no-inline-html": false,
"no-trailing-punctuation": false,
"no-trailing-spaces": true,
"custom-rules-below-this-point": false,
"trim-code-block-and-unindent": true,
"single-title/single-h1": false
}
1 change: 0 additions & 1 deletion .yardopts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
--no-private
--readme yardoc_frontpage.md
lib/solarwinds_apm/api/tracing.rb
lib/solarwinds_apm/api/current_trace_info.rb
lib/solarwinds_apm/api/transaction_name.rb
Expand Down
27 changes: 18 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# Changelog

For the latest release info, see here:
https://github.com/solarwinds/apm-ruby/releases
<https://github.com/solarwinds/apm-ruby/releases>

Dates in this file are in the format MM/DD/YYYY.

# solarwinds_apm 6.0.1 (06/20/2024)
## solarwinds_apm 6.0.2 (06/27/2024)

This release includes the following features:

* Add multi-runtime lambda layer
* Fix the issue of init msg not sent

## solarwinds_apm 6.0.1 (06/20/2024)

This release includes the following features:

* Documentation update.
* Reduce the length pf rubocop config file.
* Oboe version update to 15.0.1.

# solarwinds_apm 6.0.0 (04/11/2024)
## solarwinds_apm 6.0.0 (04/11/2024)

This release includes the following features:

Expand All @@ -20,7 +29,7 @@ This release includes the following features:
* Refactor on logging when service key is invalid.
* Using noop for all possible error from our agent.

# solarwinds_apm 6.0.0.prev6 (01/30/2024)
## solarwinds_apm 6.0.0.prev6 (01/30/2024)

This release includes the following features:

Expand All @@ -37,7 +46,7 @@ This release includes the following features:
* Updated versioning and workflow for Amazon Linux 2 on checkout.
* Dependency updates by Dependabot.

# solarwinds_apm 6.0.0.preV5 (11/06/2023)
## solarwinds_apm 6.0.0.preV5 (11/06/2023)

This release includes the following features:

Expand All @@ -49,13 +58,13 @@ This release includes the following features:
* Bug fix on determining the service_name from oboe_init
* Backward compatibility of custom metrics in [#74](https://github.com/solarwinds/apm-ruby/pull/74)

# solarwinds_apm 6.0.0.preV4 (09/14/2023)
## solarwinds_apm 6.0.0.preV4 (09/14/2023)

This release includes the following features:

* Relaxed the opentelemetry-sdk version requirement to 1.2.0 for common version 0.19.6

# solarwinds_apm 6.0.0.preV3 (09/13/2023)
## solarwinds_apm 6.0.0.preV3 (09/13/2023)

This release includes the following features:

Expand All @@ -71,7 +80,7 @@ This release includes the following features:
* Changed layer to span.kind:span.name
* Removed extensions from transaction_settings

# solarwinds_apm 6.0.0.preV2 (08/08/2023)
## solarwinds_apm 6.0.0.preV2 (08/08/2023)

This release includes the following features:

Expand All @@ -81,7 +90,7 @@ This release includes the following features:
* Unsupport tracecontext in sql for non-rails app with activerecord > 7
* Updated README.md, CONTRIBUTING.md and CONFIG.md

# solarwinds_apm 6.0.0.preV1 (06/16/2023)
## solarwinds_apm 6.0.0.preV1 (06/16/2023)

This release includes the following features:

Expand Down
20 changes: 15 additions & 5 deletions CONFIGURATION.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Configuration

By default all applicable instrumentations are enabled. The only required configuration is the service key, so a minimal example to get started is:

```bash
export SW_APM_SERVICE_KEY=<set-service-key-here>
```
Expand All @@ -16,9 +17,10 @@ Many OpenTelemetry instrumenter configurations can be set within the `SolarWinds
> [!IMPORTANT]
> this feature is only enabled if auto-config is disabled via `SW_APM_AUTO_CONFIGURE=false`.
### Instrumentation
### Instrumentation Programmatic Configuration

Below is an example that disables Dalli instrumentation and sets the Rack instrumentation to capture certain headers as Span attributes:

```ruby
# note auto-configure must be disabled, e.g.
# export SW_APM_AUTO_CONFIGURE=false
Expand All @@ -44,6 +46,7 @@ export OTEL_TRACES_EXPORTER=console
```

Other exporters must first be installed and required before loading `solarwinds_apm`. For example, if dependencies are loaded by `Bundler.require`, add the OTLP exporter to the Gemfile:

```ruby
# application dependencies, eg
# gem "rails", "~> 7.0.5", ">= 7.0.5.1"
Expand All @@ -55,6 +58,7 @@ gem 'solarwinds_apm'
```

And set the environment variable:

```bash
export OTEL_TRACES_EXPORTER=otlp
```
Expand All @@ -71,7 +75,7 @@ export OTEL_SERVICE_NAME=bar
ruby application.rb
```

### Instrumentation
### Instrumentation Environment Variables

You can use OpenTelemetry Ruby instrumentation environment variables to disable certain instrumentation.
From [instrumentation-base](https://github.com/open-telemetry/opentelemetry-ruby-contrib/blob/opentelemetry-instrumentation-base/v0.22.3/instrumentation/base/lib/opentelemetry/instrumentation/base.rb#L56-L61):
Expand All @@ -98,7 +102,7 @@ Options setup through enviromental variables

> Checks to see if user pass any environment variable that set option for instrumentation.
> By convention, the environment variable will be the instrumentation name upper cased,
> with '::' replaced by underscores, OPENTELEMETRY shortened to OTEL_{LANG} and _CONFIG_OPTS appended.
> with '::' replaced by underscores, OPENTELEMETRY shortened to OTEL_{LANG} and_CONFIG_OPTS appended.
> For example, the, environment variable name for OpenTelemetry::Instrumentation::Faraday
> will be OTEL_RUBY_INSTRUMENTATION_FARADAY_CONFIG_OPTS. A value of 'peer_service=new_service;'
> will overrides the option set from ::OpenTelemetry::SDK.configure do |c| ... end for faraday.
Expand Down Expand Up @@ -127,12 +131,15 @@ See more details in [instrumentation-base](https://github.com/open-telemetry/ope
On startup, the library looks for the configuration file in the following locations under the application's current working directory:

* `config/initializers/solarwinds_apm.rb` for Rails applications, which can be created by running the provided generator:

```bash
bundle exec rails generate solarwinds_apm:install
```

* `solarwinds_apm_config.rb` for non-Rails applications

The default location can be overridden via environment variable `SW_APM_CONFIG_RUBY`:

```bash
export SW_APM_CONFIG_RUBY=config/file/location.rb
```
Expand All @@ -151,7 +158,7 @@ Environment Variable | Config File Key | Description | Default
`SW_APM_ENABLED` | N/A | Enable/disable the library, setting `false` is an alternative to uninstalling `solarwinds_apm` since it will prevent the library from loading. | `true`
`SW_APM_LOG_FILEPATH` | N/A | Configure the log file path for the C extension, e.g. `export SW_APM_LOG_FILEPATH=/path/file_path.log`. If set, messages from the C extension are written to the specified file instead of stderr. | None
`SW_APM_PROXY` | `:http_proxy` | Configure an HTTP proxy through which the library connects to the collector. | None
`SW_APM_SERVICE_KEY` | `:service_key` | API token and service name in the form of _token:service name_, **required**. |
`SW_APM_SERVICE_KEY` | `:service_key` | API token and service name in the form of `token:service_name`, **required**. | None
`SW_APM_TAG_SQL` | `:tag_sql` | Enable/disable injecting trace context into supported SQL statements. Set to boolean true or (or string `true` in env var) to enable, see [Tag Query with Trace Context](#tag-query-with-trace-context) for details.| false
`SW_APM_TRIGGER_TRACING_MODE` | `:trigger_tracing_mode` | Enable/disable trigger tracing for the service. Setting to `disabled` may impact DEM visibility into the service. | `enabled`
`SW_APM_TRUSTEDPATH` | N/A | The library uses the host system's default trusted CA certificates to verify the TLS connection to the collector. To override the default, define the trusted certificate path configuration option with an absolute path to a specific trusted certificate file in PEM format. | None
Expand All @@ -163,6 +170,7 @@ N/A | `:transaction_settings` | Configure tracing mode per transaction, aka tran
### Transaction Filtering

Specific transactions can be disabled from tracing (suppressing both spans and metrics) using the `:transaction_settings` configuration. An example that filters out static assets and a message consumer:

```ruby
SolarWindsAPM::Config[:transaction_settings] = [
{
Expand All @@ -180,7 +188,8 @@ SolarWindsAPM::Config[:transaction_settings] = [
### Tag Query with Trace Context

You can set the environment variable `SW_APM_TAG_SQL` or configuration file option `:tag_sql` to true to enable appending the current trace context into a database query as a SQL comment. For example:
```

```console
# query without tag sql
SELECT * FROM SAMPLE_TABLE WHERE user_id = 1;

Expand All @@ -191,6 +200,7 @@ SELECT * FROM SAMPLE_TABLE WHERE user_id = 1; /* traceparent=7435a9fe510ae453341
For Rails < 7 and non-Rails applications, we use a port of [Marginalia](https://github.com/basecamp/marginalia) that patches ActiveRecord to inject the comment.

For Rails >= 7, Marginalia is [integrated into ActiveRecord](https://api.rubyonrails.org/classes/ActiveRecord/QueryLogs.html) so enabling this feature should be done through Rails [configuration](https://guides.rubyonrails.org/v7.0/configuring.html#config-active-record-query-log-tags-enabled). For example:

```ruby
class Application < Rails::Application
config.active_record.query_log_tags_enabled = true
Expand Down
Loading

0 comments on commit 5d23630

Please sign in to comment.