From cff50ad36190b83847676f3be58d59ae4c550210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Th=C3=A9riault?= Date: Thu, 24 Aug 2023 15:37:06 -0700 Subject: [PATCH] add proxy configuration option --- .yarn/versions/871d8c64.yml | 4 ++++ packages/bindings/src/oboe/reporter.cc | 3 --- packages/sdk/src/config.ts | 1 + packages/sdk/src/reporter.ts | 2 +- packages/solarwinds-apm/CONFIGURATION.md | 20 +++++++++++--------- packages/solarwinds-apm/src/config.ts | 1 + 6 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 .yarn/versions/871d8c64.yml diff --git a/.yarn/versions/871d8c64.yml b/.yarn/versions/871d8c64.yml new file mode 100644 index 00000000..967e76f4 --- /dev/null +++ b/.yarn/versions/871d8c64.yml @@ -0,0 +1,4 @@ +releases: + "@solarwinds-apm/bindings": patch + "@solarwinds-apm/sdk": minor + solarwinds-apm: minor diff --git a/packages/bindings/src/oboe/reporter.cc b/packages/bindings/src/oboe/reporter.cc index f33f031b..cd87cec1 100644 --- a/packages/bindings/src/oboe/reporter.cc +++ b/packages/bindings/src/oboe/reporter.cc @@ -3,9 +3,6 @@ #include "metadata.hh" Reporter* from_options(swo::Object const& options) { - auto defaults = oboe_init_options_t{.version = 15}; - oboe_init_options_set_defaults(&defaults); - auto hostname_alias = options.get("hostname_alias"); auto log_level = options.get("log_level"); auto log_file_path = options.get("log_file_path"); diff --git a/packages/sdk/src/config.ts b/packages/sdk/src/config.ts index b581407e..bfadae2b 100644 --- a/packages/sdk/src/config.ts +++ b/packages/sdk/src/config.ts @@ -22,6 +22,7 @@ export interface SwoConfiguration { enabled: boolean collector?: string certificate?: string + proxy?: string metricFormat?: number oboeLogLevel: number otelLogLevel: DiagLogLevel diff --git a/packages/sdk/src/reporter.ts b/packages/sdk/src/reporter.ts index 4684961b..5a4469e5 100644 --- a/packages/sdk/src/reporter.ts +++ b/packages/sdk/src/reporter.ts @@ -50,7 +50,7 @@ export function createReporter(config: SwoConfiguration): oboe.Reporter { file_single: 0, ec2_metadata_timeout: -1, - grpc_proxy: "", + grpc_proxy: config.proxy ?? "", stdout_clear_nonblocking: 0, metric_format: config.metricFormat ?? 2, }) diff --git a/packages/solarwinds-apm/CONFIGURATION.md b/packages/solarwinds-apm/CONFIGURATION.md index 8531a2c8..133a0d8c 100644 --- a/packages/solarwinds-apm/CONFIGURATION.md +++ b/packages/solarwinds-apm/CONFIGURATION.md @@ -6,15 +6,16 @@ All configuration options are optional except for the service key which is alway ## Environment Variables -| Name | Default | Description | -| ------------------------------ | ----------------- | ----------------------------------------------- | -| **`SW_APM_SERVICE_KEY`** | | **Service key** | -| `SW_APM_ENABLED` | `true` | Whether instrumentation should be enabled | -| `SW_APM_COLLECTOR` | Default collector | Collector URL | -| `SW_APM_TRUSTED_PATH` | None | Path to the collector's SSL certificate | -| `SW_APM_LOG_LEVEL` | `info` | Logging level for the instrumentation libraries | -| `SW_APM_TRIGGER_TRACE_ENABLED` | `true` | Whether trigger tracing should be enabled | -| `SW_APM_RUNTIME_METRICS` | `true` | Whether runtime metrics should be enabled | +| Name | Default | Description | +| ------------------------------ | ----------------- | ------------------------------------------------- | +| **`SW_APM_SERVICE_KEY`** | | **Service key** | +| `SW_APM_ENABLED` | `true` | Whether instrumentation should be enabled | +| `SW_APM_COLLECTOR` | Default collector | Collector URL | +| `SW_APM_TRUSTED_PATH` | None | Path to the collector's SSL certificate | +| `SW_APM_PROXY` | None | URL of a proxy to use to connect to the collector | +| `SW_APM_LOG_LEVEL` | `info` | Logging level for the instrumentation libraries | +| `SW_APM_TRIGGER_TRACE_ENABLED` | `true` | Whether trigger tracing should be enabled | +| `SW_APM_RUNTIME_METRICS` | `true` | Whether runtime metrics should be enabled | ## Configuration File @@ -54,6 +55,7 @@ module.exports = { | `enabled` | `true` | Whether instrumentation should be enabled | | `collector` | Default collector | Collector URL | | `trustedPath` | None | Path to the collector's SSL certificate | +| `proxy` | None | URL of a proxy to use to connect to the collector | | `logLevel` | `info` | Logging level for the instrumentation libraries | | `triggerTraceEnabled` | `true` | Whether trigger tracing should be enabled | | `runtimeMetrics` | `true` | Whether runtime metrics should be enabled | diff --git a/packages/solarwinds-apm/src/config.ts b/packages/solarwinds-apm/src/config.ts index c3f14af0..45291764 100644 --- a/packages/solarwinds-apm/src/config.ts +++ b/packages/solarwinds-apm/src/config.ts @@ -126,6 +126,7 @@ export function readConfig(): ExtendedSwoConfiguration { }, collector: { env: true, file: true, parser: String }, trustedPath: { env: true, file: true, parser: String }, + proxy: { env: true, file: true, parser: String }, logLevel: { env: true, file: true,