:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): add 3 AppDynamics tables (#99199)
Tom Owers9804fa66a68a
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 8bc5ebbb74c8..d981a51a020e 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -364,7 +364,7 @@ Note: Reference index (96 slugs) read from the docs nav; each path below confirm## Appdynamics — gaps-Today (10): `applications`, `business_transactions`, `events`, `health_rule_violations`, `health_rules`, `metric_data`, `metrics`, `nodes`, `request_snapshots`, `tiers`+Today (13): `anomalies`, `applications`, `backends`, `business_transactions`, `database_servers`, `events`, `health_rule_violations`, `health_rules`, `metric_data`, `metrics`, `nodes`, `request_snapshots`, `tiers`Diffed against: <https://help.splunk.com/en/appdynamics-saas/extend-splunk-appdynamics/26.4.0/extend-splunk-appdynamics/splunk-appdynamics-apis>@@ -372,14 +372,21 @@ Diffed against: <https://help.splunk.com/en/appdynamics-saas/extend-splunk-appdy- [x] `/controller/alerting/rest/v1/applications/{id}/health-rules` — lookup resolving the health rule IDs/names carried on the health_rule_violations we already sync (high)- [x] `/controller/rest/applications/{app}/request-snapshots` — individual slow/error transaction snapshots, the drill-down layer under business_transactions (high)- [x] `/controller/rest/applications/{app}/metrics (metric tree browse)` — lookup of available metric paths — without it metric_data has to be hand-configured (high)-- [ ] `/controller/rest/applications/{app}/backends` — lookup for remote services/databases referenced by tiers and business transactions (high)-- [ ] `/controller/anomaly/rest/api/v1/applications/{id}/anomalies` — anomaly-detection violations, the ML counterpart to health rule violations (medium)+- [x] `/controller/rest/applications/{app}/backends` — lookup for remote services/databases referenced by tiers and business transactions (high)+- [x] `/controller/anomaly/rest/api/v1/applications/{id}/anomalies` — anomaly-detection violations, the ML counterpart to health rule violations (medium)- [ ] `/events/query (Analytics Events API, ADQL)` — transaction/log/browser analytics records not exposed by the controller REST API (medium)-- [ ] `/controller/rest/databases/servers` — database visibility inventory joinable to backends and tiers (medium)+- [x] `/controller/rest/databases/servers` — database visibility inventory joinable to backends and tiers (medium)- [ ] `/controller/rest/databases/servers/healthrule-violations` — database-side violations alongside the APM ones already synced (medium)- [ ] `/controller/rest/applications/{app}/metric-data-v2` — v2 metric retrieval with richer rollup semantics than the v1 metric_data we sync (low)- [ ] `/controller/ControllerAuditHistory` — who changed what in the controller, for correlating config changes to incidents (low)+Note: `/events/query` is left unticked on purpose. The Analytics Events API is not served by+the controller: it addresses the Events Service host with its own `X-Events-API-AccountName` /+`X-Events-API-Key` credentials, and the rows it returns are whatever a user-written ADQL query+selects, so there is no fixed schema or primary key to sync as a table. Exposing it means new+credential fields, a query input, and scroll pagination, which is source-shaped work rather than+one more endpoint in this catalog.+Note: docs.appdynamics.com now serves an SPA shell and presents a broken TLS chain, so the canonical reference is the Splunk help portal; individual API pages (application-model, metric-and-snapshot, alert-and-respond/\*, anomaly-violation, analytics-events, database-visibility, rbac) were fetched and their /controller/... paths extracted.## Appfigures — gapsdiff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/appdynamics.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/appdynamics.pyindex 7494824821ee..9712ca5726d5 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/appdynamics.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/appdynamics.py@@ -20,6 +20,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.appdynamicAPPLICATIONS_PATH,MAX_APPLICATIONS,MAX_FANOUT_REQUESTS,+ MAX_PAGES_PER_TIME_WINDOW,MAX_WINDOW_SPLITS,METRIC_TREE_MAX_DEPTH,METRIC_TREE_MAX_REQUESTS_PER_APPLICATION,@@ -562,14 +563,23 @@ def _metric_rows(application_id: int, metric: dict[str, Any]) -> list[dict[str,]-def _window_params(start_ms: int, end_ms: int) -> dict[str, Any]:+def _window_params(config: AppdynamicsEndpointConfig, start_ms: int, end_ms: int) -> dict[str, Any]:+ if config.uses_epoch_time_params:+ return {"startTime": start_ms, "endTime": end_ms}return {"time-range-type": "BETWEEN_TIMES", "start-time": start_ms, "end-time": end_ms}+def _rows_from_payload(config: AppdynamicsEndpointConfig, payload: Any) -> list[dict[str, Any]]:+ """Pull the row list out of a response, unwrapping the endpoint's envelope where it has one."""+ if config.data_selector:+ payload = (payload or {}).get(config.data_selector)+ return payload or []++class SplitAllowance:- """Extra requests window bisection may spend, shared by every window in one sync.+ """Extra requests window bisection and paging may spend, shared by every window in one sync.- Splitting happens per window, but the fan-out limit is per sync. Without a shared+ Splitting and paging happen per window, but the fan-out limit is per sync. Without a sharedallowance a controller that returns a full response for every window would multiply analready-accepted sync by the per-window split cap, which is how the limit gets bypassed."""@@ -584,6 +594,47 @@ class SplitAllowance:return True+def _get_paged_window_rows(+ client: AppdynamicsClient,+ config: AppdynamicsEndpointConfig,+ path: str,+ params: dict[str, Any],+ application_id: int,+ split_allowance: SplitAllowance,+ logger: FilteringBoundLogger,+) -> Iterator[list[dict[str, Any]]]:+ """Yield one time window's rows a page at a time, stopping on the first short page."""+ page_size = config.page_size or 0++ for page_number in range(MAX_PAGES_PER_TIME_WINDOW):+ # Only the first page of each window is counted by the fan-out estimate, so the rest+ # draw from the same per-sync allowance window bisection spends from.+ if page_number > 0 and not split_allowance.take():+ logger.warning(+ f"AppDynamics: '{config.name}' stopped paging for application_id={application_id} at the "+ "per-sync request limit; later pages of that window were not synced."+ )+ return++ rows = _rows_from_payload(+ config,+ client.get_json(+ path,+ {**params, "pageSize": page_size, "pageNumber": page_number},+ output_json=config.sends_output_json_param,+ ),+ )+ if rows:+ yield [{**row, "application_id": application_id} for row in rows]+ if len(rows) < page_size:+ return++ logger.warning(+ f"AppDynamics: '{config.name}' hit the {MAX_PAGES_PER_TIME_WINDOW}-page cap for "+ f"application_id={application_id}; later pages of that window were not synced."+ )++def _get_window_rows(client: AppdynamicsClient,config: AppdynamicsEndpointConfig,@@ -606,7 +657,17 @@ def _get_window_rows(while pending:start, end = pending.pop()- rows = client.get_json(path, {**base_params, **_window_params(start, end)}) or []+ window_params = {**base_params, **_window_params(config, start, end)}++ if config.page_size is not None:+ yield from _get_paged_window_rows(+ client, config, path, window_params, application_id, split_allowance, logger+ )+ continue++ rows = _rows_from_payload(+ config, client.get_json(path, window_params, output_json=config.sends_output_json_param)+ )if config.result_cap is not None and len(rows) >= config.result_cap:# `take` spends from the sync-wide allowance, so ask for it last.@@ -721,7 +782,7 @@ def _get_windowed_application_rows(for window_start, window_end in _iter_windows(start_ms, end_ms, config.window_chunk_days):if config.is_metric_data:- window_params = _window_params(window_start, window_end)+ window_params = _window_params(config, window_start, window_end)for metric_path in metric_paths:metrics = client.get_json(path, {**window_params, "metric-path": metric_path, "rollup": "false"})for metric in metrics or []:@@ -763,7 +824,7 @@ def get_rows(client = AppdynamicsClient(base_url, auth, logger)if not config.fan_out_over_applications:- rows = client.get_json(config.path, {})+ rows = _rows_from_payload(config, client.get_json(config.path, {}, output_json=config.sends_output_json_param))if rows:yield rowsreturn@@ -844,10 +905,13 @@ def get_rows(elif config.is_metric_tree:yield from _get_metric_tree_rows(client, config, application_id, logger)else:- rows = client.get_json(- config.path.format(application_id=application_id),- {},- output_json=config.sends_output_json_param,+ rows = _rows_from_payload(+ config,+ client.get_json(+ config.path.format(application_id=application_id),+ {},+ output_json=config.sends_output_json_param,+ ),)if rows:yield [{**row, "application_id": application_id} for row in rows]diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/canonical_descriptions.pyindex 34e08dbc4cf5..143caec6e58f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/canonical_descriptions.py@@ -60,6 +60,19 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"ipAddresses": "IP addresses registered for the node.",},},+ "backends": {+ "description": "Backends (remote services, databases and message queues) registered in each application, resolving the exit point targets that tiers and business transactions call.",+ "docs_url": _DOCS_URL,+ "columns": {+ "application_id": "Identifier of the application the backend is registered in.",+ "id": "Unique identifier of the backend within the controller.",+ "name": "Name of the backend, as shown on the flow map.",+ "exitPointType": "Type of exit point the backend is called through (e.g. JDBC, JMS, HTTP).",+ "properties": "Name-value properties identifying the backend, which vary by exit point type (e.g. HOST, PORT, SCHEMA, VENDOR, URL for JDBC).",+ "tierId": "Identifier of the tier that calls the backend, 0 when it is not tier-specific.",+ "applicationComponentNodeId": "Identifier of the node that calls the backend, 0 when it is not node-specific.",+ },+ },"health_rule_violations": {"description": "Health rule violations (policy breaches such as slow response times or high error rates) per application, synced by their start time.","docs_url": _DOCS_URL,@@ -79,6 +92,23 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"deepLinkUrl": "Link to the violation in the AppDynamics controller UI.",},},+ "anomalies": {+ "description": "Anomaly detection violations, the machine-learning counterpart to health rule violations, synced by their start time.",+ "docs_url": "https://help.splunk.com/en/appdynamics-saas/extend-splunk-appdynamics/26.4.0/extend-splunk-appdynamics/splunk-appdynamics-apis/anomaly-violation-api",+ "columns": {+ "application_id": "Identifier of the application the anomaly was detected in.",+ "id": "Unique identifier of the anomaly violation within the controller.",+ "status": "Current status of the anomaly (e.g. OPEN, RESOLVED).",+ "description": "Summary of what the anomaly detected.",+ "startTime": "Epoch-ms timestamp when the anomaly started.",+ "endTime": "Epoch-ms timestamp when the anomaly ended.",+ "duration": "How long the anomaly lasted, in milliseconds.",+ "affectedEntityId": "Identifier of the entity the anomaly affects.",+ "affectedEntityName": "Name of the entity the anomaly affects.",+ "affectedEntityType": "Type of the affected entity (e.g. BUSINESS_TRANSACTION, APPLICATION_COMPONENT_NODE).",+ "eventDetailMap": "Events that opened, upgraded or downgraded the anomaly. Empty because suspected causes are not synced.",+ },+ },"metric_data": {"description": "Metric time series for the configured metric paths, flattened to one row per metric per interval.","docs_url": _DOCS_URL,@@ -173,4 +203,17 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"depth": "How many levels below the metric browser root the item sits.",},},+ "database_servers": {+ "description": "Database servers monitored by Database Visibility, the inventory behind the database backends that applications call.",+ "docs_url": "https://help.splunk.com/en/appdynamics-saas/extend-splunk-appdynamics/26.4.0/extend-splunk-appdynamics/splunk-appdynamics-apis/database-visibility-api",+ "columns": {+ "id": "Unique identifier of the monitored database server within the controller.",+ "name": "Name of the database collector monitoring the server.",+ "type": "Database type (e.g. ORACLE, MYSQL, MSSQL).",+ "hostname": "Hostname of the database server.",+ "port": "Port the collector connects to the database server on.",+ "enabled": "Whether the collector is currently collecting from the server.",+ "licensesUsed": "Licenses the collector consumes. Always -1 on controller 21.2 and later, which licenses Database Visibility per infrastructure unit instead.",+ },+ },}diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/settings.pyindex a5994a9797a3..2ef4716c4e9c 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/settings.py@@ -68,6 +68,15 @@ MAX_EVENT_TYPES = 200# `severities` is required too, and every severity is wanted for an event history.EVENT_SEVERITIES = "INFO,WARN,ERROR"+# `anomalies` pages with `pageSize`/`pageNumber` and documents no default page size, so the+# stream always sends one and walks pages until one comes back short — relying on an omitted+# param to return everything would silently drop rows if the Controller applies its own default.+ANOMALIES_PAGE_SIZE = 500++# Pages one time window may fetch before the stream gives up on it, so a window holding an+# unexpectedly large number of anomalies cannot loop a worker indefinitely.+MAX_PAGES_PER_TIME_WINDOW = 64+# `/metrics` returns only the immediate children of a path, so browsing the tree costs one# request per folder. The hierarchy is unbounded (a folder per tier, node and business# transaction), so bound both how deep the walk goes and what it may spend per application.@@ -111,6 +120,12 @@ class AppdynamicsEndpointConfig:"""Events requests carry the required `event-types` list configured on the source."""is_metric_tree: bool = False"""Walk the metric hierarchy folder by folder instead of reading one list response."""+ uses_epoch_time_params: bool = False+ """Window bounds ride as bare epoch-ms `startTime`/`endTime` instead of the `time-range-type` triple."""+ data_selector: str | None = None+ """Key holding the row list, for endpoints that wrap it in an object instead of returning an array."""+ page_size: int | None = None+ """Page rows with `pageSize`/`pageNumber` instead of reading a whole window in one response."""result_cap: int | None = None"""Rows the endpoint returns per request at most. A window at the cap is bisected."""extra_params: dict[str, Any] = field(default_factory=dict)@@ -148,6 +163,16 @@ APPDYNAMICS_ENDPOINTS: dict[str, AppdynamicsEndpointConfig] = {primary_keys=["application_id", "id"],fan_out_over_applications=True,),+ "backends": AppdynamicsEndpointConfig(+ name="backends",+ path="/controller/rest/applications/{application_id}/backends",+ primary_keys=["application_id", "id"],+ fan_out_over_applications=True,+ description=(+ "Backends (remote services, databases and message queues) that each application's "+ "tiers and business transactions call."+ ),+ ),"health_rule_violations": AppdynamicsEndpointConfig(name="health_rule_violations",path="/controller/rest/applications/{application_id}/problems/healthrule-violations",@@ -163,6 +188,28 @@ APPDYNAMICS_ENDPOINTS: dict[str, AppdynamicsEndpointConfig] = {"Only syncs the last 30 days on initial sync."),),+ "anomalies": AppdynamicsEndpointConfig(+ name="anomalies",+ path="/controller/anomaly/rest/api/v1/applications/{application_id}/anomalies",+ primary_keys=["application_id", "id"],+ fan_out_over_applications=True,+ time_windowed=True,+ uses_epoch_time_params=True,+ sends_output_json_param=False,+ data_selector="violationListItem",+ page_size=ANOMALIES_PAGE_SIZE,+ incremental_fields=time_window_incremental_fields("startTime"),+ extra_params={"fetchSuspectedCause": "false"},+ default_lookback_days=30,+ window_chunk_days=7,+ description=(+ "Anomaly detection violations, the machine-learning counterpart to health rule "+ "violations, synced by their start time. Suspected causes are not synced. Status "+ "changes to previously synced anomalies are only picked up on a full refresh. "+ "Only syncs the last 30 days on initial sync. Requires anomaly detection to be "+ "enabled on the controller."+ ),+ ),"metric_data": AppdynamicsEndpointConfig(name="metric_data",path="/controller/rest/applications/{application_id}/metric-data",@@ -234,6 +281,15 @@ APPDYNAMICS_ENDPOINTS: dict[str, AppdynamicsEndpointConfig] = {"time series into metric_data."),),+ "database_servers": AppdynamicsEndpointConfig(+ name="database_servers",+ path="/controller/rest/databases/servers",+ primary_keys=["id"],+ description=(+ "Database servers monitored by AppDynamics Database Visibility. Joins to the "+ "database backends that applications call."+ ),+ ),}ENDPOINTS = tuple(APPDYNAMICS_ENDPOINTS.keys())diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/source.pyindex f61a7652e03e..6d3a2e832946 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/source.py@@ -62,7 +62,7 @@ class AppdynamicsSource(ResumableSource[AppdynamicsSourceConfig, AppdynamicsResulabel="Splunk AppDynamics (Cisco)",releaseStatus=ReleaseStatus.ALPHA,keywords=["appdynamics", "cisco", "splunk", "apm"],- caption="""Sync your Splunk AppDynamics (Cisco) APM data (applications, business transactions, tiers, nodes, events, transaction snapshots, health rules, health rule violations, metric paths, and metric time series) into the PostHog Data warehouse.+ caption="""Sync your Splunk AppDynamics (Cisco) APM data (applications, business transactions, tiers, nodes, backends, events, transaction snapshots, health rules, health rule violations, anomalies, metric paths, metric time series, and monitored database servers) into the PostHog Data warehouse.Enter your controller URL (e.g. `https://mycompany.saas.appdynamics.com`) and your account name, then authenticate with an OAuth API client (recommended) or a username and password.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics.pyindex 4606fc1f91fe..2ebc3c51f1a9 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics.py@@ -26,6 +26,7 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.appdynamicvalidate_credentials,)from products.warehouse_sources.backend.temporal.data_imports.sources.appdynamics.settings import (+ ANOMALIES_PAGE_SIZE,APPDYNAMICS_ENDPOINTS,MAX_METRIC_PATHS,MAX_ROWS_PER_TIME_WINDOW,@@ -415,14 +416,21 @@ def _application_list_responder(tree: dict[str, Any], application_ids: list[int]class TestGetRows:- def test_applications_yields_rows_without_state(self) -> None:+ @parameterized.expand(+ [+ ("applications", "/controller/rest/applications"),+ ("database_servers", "/controller/rest/databases/servers"),+ ]+ )+ def test_account_level_endpoint_is_read_without_fanning_out(self, endpoint: str, expected_path: str) -> None:manager = FakeResumeManager()- batches, _ = _run_get_rows(- lambda path, params: FakeResponse(json_data=[{"id": 1, "name": "app"}]),- "applications",+ batches, session = _run_get_rows(+ lambda path, params: FakeResponse(json_data=[{"id": 1, "name": "thing"}]),+ endpoint,manager,)- assert batches == [[{"id": 1, "name": "app"}]]+ assert batches == [[{"id": 1, "name": "thing"}]]+ assert [path for path, _, _ in session.get_calls] == [expected_path]assert manager.saved == []def test_too_many_applications_is_rejected(self) -> None:@@ -703,6 +711,7 @@ class TestGetRows:[("events", {"event-types": "APPLICATION_DEPLOYMENT,APP_SERVER_RESTART", "severities": "INFO,WARN,ERROR"}),("request_snapshots", {"maximum-results": MAX_ROWS_PER_TIME_WINDOW}),+ ("anomalies", {"fetchSuspectedCause": "false"}),])@time_machine.travel("2024-01-31T00:00:00Z", tick=False)@@ -738,6 +747,84 @@ class TestGetRows:assert rules_path == "/controller/alerting/rest/v1/applications/7/health-rules"assert "output" not in rules_params+ @time_machine.travel("2024-01-31T00:00:00Z", tick=False)+ def test_anomalies_sends_epoch_window_bounds_and_unwraps_the_response(self) -> None:+ # The anomaly API takes bare epoch-ms bounds instead of the Controller REST+ # `time-range-type` triple, serves JSON with no `output` param, and returns its rows+ # wrapped in an object rather than as a bare array.+ watermark = FROZEN_NOW_MS - MILLIS_PER_DAY++ def responder(path: str, params: dict[str, Any]) -> FakeResponse:+ if path == "/controller/rest/applications":+ return FakeResponse(json_data=[{"id": 3}])+ return FakeResponse(json_data={"violationListItem": [{"id": 9, "startTime": params["startTime"]}]})++ batches, session = _run_get_rows(+ responder,+ "anomalies",+ FakeResumeManager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value=watermark,+ )++ path, params, _ = session.get_calls[1]+ assert path == "/controller/anomaly/rest/api/v1/applications/3/anomalies"+ assert params["startTime"] == watermark + 1+ assert params["endTime"] == FROZEN_NOW_MS+ assert "time-range-type" not in params+ assert "output" not in params+ assert batches == [[{"id": 9, "startTime": watermark + 1, "application_id": 3}]]++ @time_machine.travel("2024-01-31T00:00:00Z", tick=False)+ def test_anomalies_walks_pages_until_one_comes_back_short(self) -> None:+ # A full page means anomalies are still waiting, and the API documents no default page+ # size, so the stream sends one and pages on rather than trusting a single response.+ pages: dict[int, list[dict[str, Any]]] = {+ 0: [{"id": index} for index in range(ANOMALIES_PAGE_SIZE)],+ 1: [{"id": 999}],+ }++ def responder(path: str, params: dict[str, Any]) -> FakeResponse:+ if path == "/controller/rest/applications":+ return FakeResponse(json_data=[{"id": 1}])+ return FakeResponse(json_data={"violationListItem": pages.get(params["pageNumber"], [])})++ batches, session = _run_get_rows(+ responder,+ "anomalies",+ FakeResumeManager(),+ should_use_incremental_field=True,+ db_incremental_field_last_value=FROZEN_NOW_MS - MILLIS_PER_DAY,+ )++ assert [params["pageNumber"] for _, params, _ in session.get_calls[1:]] == [0, 1]+ assert all(params["pageSize"] == ANOMALIES_PAGE_SIZE for _, params, _ in session.get_calls[1:])+ assert [row["id"] for batch in batches for row in batch][-1] == 999++ @time_machine.travel("2024-01-31T00:00:00Z", tick=False)+ def test_anomalies_paging_draws_from_the_sync_wide_request_allowance(self) -> None:+ # Paging is per window but the fan-out limit is per sync, so a controller that returns+ # a full page every time can't multiply an accepted sync by the per-window page cap.+ def responder(path: str, params: dict[str, Any]) -> FakeResponse:+ if path == "/controller/rest/applications":+ return FakeResponse(json_data=[{"id": 1}])+ return FakeResponse(json_data={"violationListItem": [{"id": n} for n in range(ANOMALIES_PAGE_SIZE)]})++ logger = mock.MagicMock()+ # One window is estimated, so an allowance of one leaves room for a single extra page.+ with mock.patch.object(appdynamics_module, "MAX_FANOUT_REQUESTS", 2):+ _, session = _run_get_rows(+ responder,+ "anomalies",+ FakeResumeManager(),+ logger=logger,+ should_use_incremental_field=True,+ db_incremental_field_last_value=FROZEN_NOW_MS - MILLIS_PER_DAY,+ )++ assert [params["pageNumber"] for _, params, _ in session.get_calls[1:]] == [0, 1]+ assert logger.warning.call_count == 1+def test_metric_tree_walk_builds_reusable_paths_and_skips_leaves(self) -> None:tree = {"": [diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics_source.pyindex 22d2201e3681..5173f3497a7f 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/appdynamics/tests/test_appdynamics_source.py@@ -72,6 +72,7 @@ class TestAppdynamicsSource:}assert cursors == {"health_rule_violations": {"startTimeInMillis"},+ "anomalies": {"startTime"},"metric_data": {"startTimeInMillis"},"events": {"eventTime"},"request_snapshots": {"serverStartTime"},