Skip to content

feat(dsm): add manual checkpoint parameter to consume API #13646

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

michael-zhao459
Copy link
Contributor

@michael-zhao459 michael-zhao459 commented Jun 11, 2025

Adds a manual_checkpoint parameter in the public dsm set_consume_checkpoint(), this allows one to turn off the manual_checkpoint:true tag if use of function is not for explicit purpose of manually instrumenting (default remains as manual instrumentation).

Checklist

  • PR author has checked that all the criteria below are met
  • The PR description includes an overview of the change
  • The PR description articulates the motivation for the change
  • The change includes tests OR the PR description describes a testing strategy
  • The PR description notes risks associated with the change, if any
  • Newly-added code is easy to change
  • The change follows the library release note guidelines
  • The change includes or references documentation updates if necessary
  • Backport labels are set (if applicable)

Reviewer Checklist

  • Reviewer has checked that all the criteria below are met
  • Title is accurate
  • All changes are related to the pull request's stated goal
  • Avoids breaking API changes
  • Testing strategy adequately addresses listed risks
  • Newly-added code is easy to change
  • Release note makes sense to a user of the library
  • If necessary, author has acknowledged and discussed the performance implications of this PR as reported in the benchmarks PR comment
  • Backport labels are set in a manner that is consistent with the release branch maintenance policy

Copy link
Contributor

github-actions bot commented Jun 11, 2025

CODEOWNERS have been resolved as:

releasenotes/notes/add-dsm-manual-checkpoint-flag-8ec40cc433070ee6.yaml  @DataDog/apm-python
ddtrace/data_streams.py                                                 @DataDog/apm-core-python
tests/datastreams/test_public_api.py                                    @DataDog/data-streams-monitoring

Copy link
Contributor

github-actions bot commented Jun 11, 2025

Bootstrap import analysis

Comparison of import times between this PR and base.

Summary

The average import time from this PR is: 274 ± 3 ms.

The average import time from base is: 275 ± 4 ms.

The import time difference between this PR and base is: -1.4 ± 0.2 ms.

Import time breakdown

The following import paths have shrunk:

ddtrace.auto 1.952 ms (0.71%)
ddtrace.bootstrap.sitecustomize 1.270 ms (0.46%)
ddtrace.bootstrap.preload 1.270 ms (0.46%)
ddtrace.internal.remoteconfig.client 0.632 ms (0.23%)
ddtrace 0.682 ms (0.25%)
ddtrace.internal._unpatched 0.032 ms (0.01%)
json 0.032 ms (0.01%)
json.decoder 0.032 ms (0.01%)
re 0.032 ms (0.01%)
enum 0.032 ms (0.01%)
types 0.032 ms (0.01%)

@pr-commenter
Copy link

pr-commenter bot commented Jun 11, 2025

Benchmarks

Benchmark execution time: 2025-06-12 13:49:12

Comparing candidate commit 2b00286 in PR branch michael.zhao/add-manual-check-dsm-checkpoint with baseline commit c58f633 in branch main.

Found 0 performance improvements and 1 performance regressions! Performance is the same for 418 metrics, 3 unstable metrics.

scenario:telemetryaddmetric-flush-1-metric

  • 🟥 execution_time [+294.472ns; +446.826ns] or [+7.159%; +10.863%]

@@ -2,7 +2,7 @@
from ddtrace.internal.datastreams.processor import PROPAGATION_KEY_BASE_64


def set_consume_checkpoint(typ, source, carrier_get):
def set_consume_checkpoint(typ, source, carrier_get, manual_checkpoint=True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add a definition of the parameter just bellow, since it's a public api, we want to make sure users know what values to use.

with mock.patch.object(mocked_tracer.data_streams_processor, "set_checkpoint") as mock_set_checkpoint:
set_consume_checkpoint("kinesis", "stream-123", headers.get)
called_tags = mock_set_checkpoint.call_args[0][0]
assert "manual_checkpoint:true" in called_tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also test got.hash (similar to above) and make sure manual_checkpoint:true is / is not in the tags needed to compute the hash?

@michael-zhao459 michael-zhao459 marked this pull request as ready for review June 12, 2025 13:14
@michael-zhao459 michael-zhao459 requested review from a team as code owners June 12, 2025 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants