From 98b0f06146b8e60f72db37abc99d1ab47baf515c Mon Sep 17 00:00:00 2001 From: Andrey Marchenko Date: Mon, 2 Oct 2023 13:33:49 +0200 Subject: [PATCH] cleanup and code review suggestions --- README.md | 10 ++++------ lib/datadog/ci/transport/http.rb | 11 ++++------- spec/datadog/ci/configuration/settings_spec.rb | 3 --- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 56ed4e0d..0a28c209 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ If you are using a cloud CI provider without access to the underlying worker nod Additionally, configure which [Datadog site](https://docs.datadoghq.com/getting_started/site/) you want to send data to: `DD_SITE=your.datadoghq.com` (datadoghq.com by default). -Agentless mode can be enabled via `Datadog.configure` (but don't forget to set DD_API_KEY environment variable): +Agentless mode can also be enabled via `Datadog.configure` (but don't forget to set DD_API_KEY environment variable): ```ruby Datadog.configure { |c| c.ci.agentless_mode_enabled = true } @@ -156,8 +156,8 @@ end require "ddtrace/auto_instrument" ``` -Note: in CI mode these traces are going to be submitted to CI visibility backend, -they will **not** be submitted to Datadog APM. +Note: in CI mode these traces are going to be submitted to CI Visibility, +they will **not** show up in Datadog APM. For the full list of available instrumentations see [ddtrace documentation](https://github.com/DataDog/dd-trace-rb/blob/master/docs/GettingStarted.md) @@ -175,14 +175,12 @@ Datadog.configure { |c| c.diagnostics.startup_logs.enabled = false } Switching the library into debug mode will produce verbose, detailed logs about tracing activity, including any suppressed errors. This output can be helpful in identifying errors, confirming trace output, or catching HTTP transport issues. -You can enable this via `diagnostics.debug = true` or `DD_TRACE_DEBUG`. +You can enable this via `diagnostics.debug = true` or `DD_TRACE_DEBUG=1`. ```ruby Datadog.configure { |c| c.diagnostics.debug = true } ``` -**We do NOT recommend use of this feature in production or other sensitive environments**, as it can be very verbose under load. It's best to use this in a controlled environment where you can control application load. - ## Contributing See [development guide](/docs/DevelopmentGuide.md), [static typing guide](docs/StaticTypingGuide.md) and [contributing guidelines](/CONTRIBUTING.md). diff --git a/lib/datadog/ci/transport/http.rb b/lib/datadog/ci/transport/http.rb index 87dc85fa..a59ffb2f 100644 --- a/lib/datadog/ci/transport/http.rb +++ b/lib/datadog/ci/transport/http.rb @@ -34,13 +34,10 @@ def request(path:, payload:, headers:, method: "post") payload = Gzip.compress(payload) end - Datadog.logger.debug { "Sending #{method} request" } - Datadog.logger.debug { "host #{host}" } - Datadog.logger.debug { "port #{port}" } - Datadog.logger.debug { "ssl enabled #{ssl}" } - Datadog.logger.debug { "compression enabled #{compress}" } - Datadog.logger.debug { "path #{path}" } - Datadog.logger.debug { "payload size #{payload.size}" } + Datadog.logger.debug do + "Sending #{method} request: host=#{host}; port=#{port}; ssl_enabled=#{ssl}; " \ + "compression_enabled=#{compress}; path=#{path}; payload_size=#{payload.size}" + end send(method, path: path, payload: payload, headers: headers) end diff --git a/spec/datadog/ci/configuration/settings_spec.rb b/spec/datadog/ci/configuration/settings_spec.rb index 3ebafdfd..e58fcab7 100644 --- a/spec/datadog/ci/configuration/settings_spec.rb +++ b/spec/datadog/ci/configuration/settings_spec.rb @@ -238,9 +238,6 @@ def patcher end context "when not enabled" do - # before do - # allow(integration.configuration).to receive(:enabled).and_return(false) - # end let(:enabled) { false } it "does not patch the integration" do