Skip to content

Conversation

@ferrous26
Copy link

Summary

Upgrades the dd-trace-rb fork from v2.15.0 to v2.27.0 while preserving Braze-specific modifications.

Changes from upstream (v2.15.0 → v2.27.0)

  • 12 minor version upgrades
  • ~2,255 commits from DataDog

Braze modifications preserved

  1. Redis Instrumentation Enhancements

    • Custom tags: redis.filepath, redis.codeowner, redis.shard_index, company_name, redis.key
    • Metrics: redis.raw_command_length, redis.raw_response_length
    • Thread-local storage for passing context to spans
  2. Grape API Endpoint Fix

  3. ActiveSupport Cache Patch Bypass

    • Disable patch_redis_store? to prevent wrong Store patching
    • Braze does not use Redis with ActiveSupport::Cache
  4. CODEOWNERS

    • Updated to Braze ownership

Dropped changes (now in upstream)

Test plan

  • dd-trace-rb CI passes on this branch
  • Platform CI passes after updating Gemfile reference

🤖 Generated with Claude Code

mabdinur and others added 30 commits December 18, 2025 13:45
Co-authored-by: Oleg Pudeyev <code@olegp.name>
…ns/runs/20401907816 (DataDog#5179)

Co-authored-by: dd-apm-ecosystems-autobot[bot] <214617597+dd-apm-ecosystems-autobot[bot]@users.noreply.github.com>
Co-authored-by: Oleg Pudeyev <code@olegp.name>
…robe with the same id (DataDog#5169)

Co-authored-by: Oleg Pudeyev <code@olegp.name>
…actions/runs/20401889084 (DataDog#5180)

Co-authored-by: dd-apm-ecosystems-autobot[bot] <214617597+dd-apm-ecosystems-autobot[bot]@users.noreply.github.com>
Strech and others added 12 commits January 20, 2026 09:49
…elpers.c`

The use of `telemetry_message_id` was moved to
`datadog_ruby_common.h/.c` directly, this was no longer needed.
…-client-typespecs

[APPSEC-60626] Return rest_client to be checked by Steep
…iation-custom-profiler-code

Telemetry-safe error reporting for native extensions
* Add initial attempt at adding process related tags on trace payloads. This is still missing memoization and additional tests.

* Add test for multiple calls to the formatter tags

* Add tests for trace formatter spec to assert that the first span of the payload has the process tag only when the feature is enabled.

* it turns out you cannot just pin things to rails 7 due to newer ruby versions so this fixes that.

* Update lib/datadog/core/environment/process.rb

Co-authored-by: Marco Costa <marco.costa@datadoghq.com>

* fix string and rename formatted_process_tags_k1_v1 to serialized

* remove unneeded line

* remove server type for now until more research is done

* Add new tag normalizer logic following the trace agent.

* lint fix

* add missing files from prototype command

* Add missing constants to ext rbs file

* jruby fix for the process spec

* remove the active record during rails creation because it caused a jruby conflict with sqlite and it is not needed for this test

* Bring tag normalization to 1:1 parity with the Trace Agent

* Add changes from code review around comments and add test for the new environment variable.

* Remove the rails gem install from process_spec

* Remove 1 sec delay.

* Update sig/datadog/core/environment/ext.rbs

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

* Update lib/datadog/tracing/transport/trace_formatter.rb

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

* Add improvements for long strings.

* small improvement to the whitespace removal.

* Add upper bound to regex to avoid the polynomial regex on uncontrolled data error.

* Change untyped to string.

* Use possessive quantifiers in regex instead of limiting the upper bound to 200 characters

* Fix types for steep check command

* Remove unneeded Core prefix

* lint fixes

* restructure folder lookup so it works on the macos ci tests

* fixes for local mac development.

* Add missing trace agent test cases.

* Fix lint

* Change methods to private. Also add comments with examples

* Fix basedir logic and adjust tests (and also fix the private change)

* Fix steepcheck error

* Add in byte logic to handle emojis with early backoff and allow starting digits for tag values.

* Move process tags only to the first span and adjust tests

* Add a special character into the test app name to show that it gets normalized

* Add process tags to the profiling payloads.

* Update lib/datadog/core/normalizer.rb

Co-authored-by: Marco Costa <marco.costa@datadoghq.com>

* Update lib/datadog/core/normalizer.rb

Co-authored-by: Marco Costa <marco.costa@datadoghq.com>

* Fixes for new constant names

* Change to byteslice

* fix lint.

* remove process_spec from main rake task

* Update spec/datadog/core/normalizer_spec.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Update spec/datadog/tracing/transport/trace_formatter_spec.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Remove the unless check and replace with an assertion that the file exist, small fixes, and add comments to the normalizer.rb explaining the expected usage

* Update spec/datadog/core/environment/process_spec.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* fix lint

* Rename Normalizer to TagNormalizer.

* Update lib/datadog/core/environment/process.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Add api private comment to the tag normalizer and refactor away the extend self on process.rb

* Fix steep errors on the process rbs file

* Refactor the utils encode call so it can be used in the tag normalizer and update tests to show some new assertions

* Update Rakefile

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

* Update lib/datadog/core/tag_normalizer.rb

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

* Add lint fixes and remove unneeded regex at the end.

* fix rbs file for deleted variable

* remove unneeded conditional

* Add a log if the process tags cannot be obtained

* Fix regex and reuse the same test cases to show that the leading digits are allowed for tag values

* Attempt to retrieve as many non empty string process tags as possible before setting process tags.

* Fix hard to spot missing comma in Rakefile that was breaking tests

* Update lib/datadog/core/environment/process.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Remove the usage of utils from the tag normalizer until 3.0 due to the requirement to change the default encoding behavior and adjust tag normalizer variables.

* Add tests to show the values based on different 0 overrides.

* Fix test string.

* refactor out the rescue and process and update the test

* Fix mocking.

* Update Matrixfile

Co-authored-by: Marco Costa <marco.costa@datadoghq.com>

* Do not run tests for all ruby versions.

* Update lib/datadog/core/environment/process.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Update lib/datadog/core/environment/process.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Add a foo bar test condition with colons and commas, which revealed a need to add the additional process values normalization logic for service names since they can only be 100 characters and cannot have colons.

* use around syntax

* Update lib/datadog/core/tag_normalizer.rb

Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>

* Update lib/datadog/core/tag_normalizer.rb

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

* Rename process_values_normalize to normalize_process_value and adjust tests for the singular version of MAX_PROCESS_VALUE_BYTE_SIZE

* refactor profiling changes based on the new profiling payload changes in 25.0.0 of libdatadog

* Fix flush_spec.rb

* Fix benchmark test

* update profiling_http_transport so that it is backwards compatible.

* Update benchmarks/profiling_http_transport.rb

Co-authored-by: Ivo Anjo <ivo.anjo@datadoghq.com>

* Update benchmarks/profiling_http_transport.rb

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

* Remove changes to the todo to leave process discovery out

* Send empty string instead of nil for blank process tags

* Fix tests based on the change in nil vs empty string.

* Update spec/datadog/profiling/http_transport_spec.rb

Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>

---------

Co-authored-by: Marco Costa <marco.costa@datadoghq.com>
Co-authored-by: Sergey Fedorov <oni.strech@gmail.com>
Co-authored-by: Oleg Pudeyev <156273877+p-datadog@users.noreply.github.com>
Co-authored-by: Oleg Pudeyev <code@olegp.name>
Co-authored-by: Ivo Anjo <ivo.anjo@datadoghq.com>
@ferrous26 ferrous26 requested a review from a team as a code owner January 31, 2026 16:34
@ferrous26 ferrous26 marked this pull request as draft January 31, 2026 17:03
@ferrous26 ferrous26 force-pushed the upgrade-v2.27.0-braze branch from 775414b to 8d5d1c1 Compare January 31, 2026 17:09
@ferrous26 ferrous26 changed the title Upgrade to dd-trace-rb v2.27.0 with Braze modifications [STREAM-126] Upgrade to dd-trace-rb v2.27.0 with Braze modifications Jan 31, 2026
@ferrous26 ferrous26 force-pushed the upgrade-v2.27.0-braze branch from 8d5d1c1 to 813137f Compare January 31, 2026 17:17
ferrous26 and others added 4 commits January 31, 2026 13:01
Add custom tags and metrics to Redis spans for improved observability:

Tags (via thread-local storage):
- redis.filepath: source file making the Redis call
- redis.codeowner: team owning the code
- redis.shard_index: which shard the call targets
- company_name: company context
- redis.key: the Redis key being accessed

Metrics:
- redis.raw_command_length: size of command sent
- redis.raw_response_length: size of response received

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Workaround for Grape API issue DataDog#1825 that doesn't work with Braze's
usage pattern.

Instead of calling api_view() directly, first try api.to_s and only
fall back to api_view(api) if the result is blank.

See: ruby-grape/grape#1825

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Braze does not use Redis with ActiveSupport::Cache, and the default
patching behavior causes the wrong Store to be patched.

This disables patch_redis_store? by always returning false.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Set Braze ownership for the forked repository.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.