Skip to content

added config option for events_uri - #39

Merged
pkaeding merged 2 commits into
masterfrom
pk/events_uri
Feb 8, 2016
Merged

pkaeding merged 2 commits into
masterfrom
pk/events_uri

Conversation

@pkaeding

@pkaeding pkaeding commented Feb 2, 2016

Copy link
Copy Markdown
Contributor

Obviously, we need to get events.launchdarkly.com live before we release this.

@apucacao

apucacao commented Feb 2, 2016

Copy link
Copy Markdown

lgtm

@jkodumal

jkodumal commented Feb 2, 2016

Copy link
Copy Markdown
Contributor

👍 , but let's not merge until events.ld is up and running.

pkaeding added a commit that referenced this pull request Feb 8, 2016
added config option for events_uri
@pkaeding
pkaeding merged commit be47edc into master Feb 8, 2016
@pkaeding
pkaeding deleted the pk/events_uri branch February 8, 2016 23:46
eli-darkly added a commit that referenced this pull request Feb 22, 2018
fix further breakage in StreamProcessor
tanderson-ld added a commit that referenced this pull request Oct 26, 2026
…timing (#539)

## Summary

Switches the two remaining wall-clock duration measurements in this SDK
to the monotonic clock, found by the clock-monotonicity re-audit.
Implements SDK-3307 (re-audit findings #39/#40/#41).

This is a **pure clock-source substitution with no observable behavioral
change versus `main`.** The recording structure, control flow, and
public contracts are byte-for-byte `main`; only the clock a duration is
measured from changes. A wall-clock step (DST via naive
`datetime.now()`, NTP correction, VM/container time resync) can no
longer distort these durations.

## Changes

- `Impl::util.monotonic_seconds()` is the single monotonic seam (added
in the sibling clock-monotonicity work; reused here).
- **Migration op latency** (`migrations/migrator.py`,
`async_migrator.py`): measured with `monotonic_seconds()` and delivered
to `OpTracker.latency` as a `timedelta` — identical type and, under a
stable clock, identical value; a backward step can no longer produce a
negative latency. Finding #39 (HIGH).
- **FDv2 stream-init diagnostics** (`datasourcev2/streaming.py`,
`async_streaming.py`, `streaming_common.py`): the connection-attempt
baseline and the `next_attempt_start` projection now use
`monotonic_seconds()`, and the duration is computed on the monotonic
clock as a difference of floored milliseconds (matching `main`'s
rounding exactly). The wall clock is retained for the reported
`timestamp` (via `current_time_millis()`) and for the three
`DataSourceErrorInfo.time` error timestamps. Findings #40 / #41 (MED).
- The recording lifecycle is unchanged from `main`: the projected
`next_attempt_start` baseline, the per-site `elapsed if elapsed >= 0
else 0` clamp, the record-iff-baseline-set guard, and all
`Start`/`Fault` control flow are preserved. `diagnostics.py` is
unchanged.

**Deliberately unchanged** (wall clock is correct — values communicated
outside the process): `DataSourceErrorInfo.time`, event `creationDate`,
diagnostic `dataSinceDate`, the big-segments cross-process staleness
stamp.

## Explicitly out of scope

The pre-existing FDv2 stream-init projection inaccuracy (a reconnect's
recorded duration can be driven to the clamp by the backoff projection)
and the related diagnostic-count behavior during a sustained outage
exist identically on `main` and are **not** changed by this PR. An
earlier revision of this PR reworked that behavior; it has been reverted
so this change is a clock swap only. Those are diagnostics-only, affect
no flag evaluation, data correctness, or retry behavior, and will be
addressed separately if desired.

## Behavioral notes

Not a breaking change — every modified component is `Impl`-internal, and
behavior under a stable clock is unchanged. Note for test suites that
time-travel: these measurements no longer follow `time.time()`;
`freezegun` does not patch `time.monotonic()` by default.

## Testing

Full suite passes (1774 passed, 371 DB-skipped); mypy, isort,
pycodestyle clean. New tests assert the clock property without asserting
new behavior: migration latency measured monotonically (sync + async,
via a module-patched clock); FDv2 stream-init duration measured on the
monotonic clock while the reported timestamp follows the wall clock
(proven by advancing the monotonic clock while stepping the wall clock
backward), plus the preserved negative-elapsed clamp and
baseline-cleared skip. The migration latency assertions use a 50 ms
floor to tolerate coarse monotonic granularity on pre-3.13 Windows.

A three-agent review (general, security, adversarial) plus proof tests
confirmed no observable behavioral change versus `main`.

Same change-class as the merged python PR #537.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Replaces wall-clock duration measurements with **monotonic** timing in
two internal areas so NTP/DST jumps no longer skew reported durations.
> 
> **Migration operations** (`migrator.py`, `async_migrator.py`): op
latency is measured with `monotonic_seconds()` and passed to the tracker
as a `timedelta` instead of `datetime.now()` deltas.
> 
> **FDv2 streaming** (`streaming.py`, `async_streaming.py`,
`streaming_common.py`): connection-attempt baselines, retry
`next_attempt_start` projections, and stream-init **elapsed** time use
the monotonic clock; diagnostic **timestamps** still use
`current_time_millis()`, and error `DataSourceErrorInfo.time` stays on
the wall clock. The existing negative-elapsed clamp and “record only
when baseline is set” behavior are unchanged.
> 
> Adds focused tests for monotonic stream-init recording (sync + async)
and migration executor latency; integration tests relax the minimum
latency assertion (100ms → 50ms) to account for coarse monotonic
resolution on some platforms.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0b804ff. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
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.

3 participants