: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(aio): tighten dataset storage limits (#82712)
Radu Raiceafc16d03fe147
diff --git a/products/ai_observability/backend/api/datasets.py b/products/ai_observability/backend/api/datasets.pyindex c71ee1cd5a4f..579abf31d1b2 100644--- a/products/ai_observability/backend/api/datasets.py+++ b/products/ai_observability/backend/api/datasets.py@@ -522,7 +522,7 @@ class DatasetItemVersionPagination(LimitOffsetPagination):class DatasetExportRateThrottle(PersonalApiKeyOrUserRateThrottle):scope = "dataset_export"- rate = "10/minute"+ rate = "10/day"def _parse_dataset_export_id(export_id: str | None) -> int:diff --git a/products/ai_observability/backend/api/test/test_datasets.py b/products/ai_observability/backend/api/test/test_datasets.pyindex f31756c1c7aa..717e71bbc5f8 100644--- a/products/ai_observability/backend/api/test/test_datasets.py+++ b/products/ai_observability/backend/api/test/test_datasets.py@@ -3,6 +3,7 @@ from datetime import timedeltafrom posthog.test.base import APIBaseTestfrom unittest.mock import AsyncMock, MagicMock, patch+from django.core.cache import cachefrom django.db import IntegrityError, connection, transactionfrom django.db.models.deletion import RestrictedErrorfrom django.utils.timezone import now@@ -979,6 +980,21 @@ class TestDatasetsApi(APIBaseTest):self.assertEqual(content_response.content, asset.content)self.assertIn("attachment", content_response["Content-Disposition"])+ @patch("posthog.rate_limit.is_rate_limit_enabled", return_value=True)+ @patch("products.ai_observability.backend.api.datasets.DatasetExportRateThrottle.rate", new="1/day")+ @patch("products.exports.backend.facade.api.async_connect", new_callable=AsyncMock)+ def test_dataset_export_throttles_session_authenticated_requests(+ self, _async_connect: AsyncMock, *_args: object+ ) -> None:+ cache.clear()+ self.addCleanup(cache.clear)+ dataset = self._create_dataset()+ self._create_item(dataset["id"])+ export_url = f"{self.datasets_url}{dataset['id']}/exports/"++ self.assertEqual(self.client.post(export_url, {}, format="json").status_code, status.HTTP_201_CREATED)+ self.assertEqual(self.client.post(export_url, {}, format="json").status_code, status.HTTP_429_TOO_MANY_REQUESTS)+@patch("products.ai_observability.backend.api.datasets.is_impersonated", return_value=True)@patch("products.exports.backend.facade.api.async_connect", new_callable=AsyncMock)def test_dataset_export_logs_exported_asset_activity(diff --git a/products/ai_observability/backend/dataset_limits.py b/products/ai_observability/backend/dataset_limits.pyindex 067143fc6df9..ec48814e0fc9 100644--- a/products/ai_observability/backend/dataset_limits.py+++ b/products/ai_observability/backend/dataset_limits.py@@ -1,7 +1,7 @@MAX_DATASET_EXPORT_MEGABYTES = 250MAX_DATASET_EXPORT_BYTES = MAX_DATASET_EXPORT_MEGABYTES * 1_000_000-MAX_ITEMS_PER_DATASET = 5_000+MAX_ITEMS_PER_DATASET = 600# Reserve space for identifiers, provenance fields, JSON keys, and escaping in each JSONL row.MAX_DATASET_EXPORT_ROW_OVERHEAD_BYTES = 10_000diff --git a/products/ai_observability/backend/dataset_service.py b/products/ai_observability/backend/dataset_service.pyindex d506b2ae4b94..7db03f7776c6 100644--- a/products/ai_observability/backend/dataset_service.py+++ b/products/ai_observability/backend/dataset_service.py@@ -22,8 +22,8 @@ MAX_DATASET_DESCRIPTION_LENGTH = 10_000MAX_DATASET_NAME_LENGTH = 400MAX_CLIENT_ITEM_ID_LENGTH = 255MAX_SOURCE_ID_LENGTH = 255-MAX_DATASETS_PER_TEAM = 100-MAX_VERSIONS_PER_ITEM = 100+MAX_DATASETS_PER_TEAM = 20+MAX_VERSIONS_PER_ITEM = 40class DatasetValidationError(Exception):diff --git a/products/ai_observability/frontend/datasets/AIObservabilityDatasetsScene.tsx b/products/ai_observability/frontend/datasets/AIObservabilityDatasetsScene.tsxindex 987c24e7379e..9dae027b8756 100644--- a/products/ai_observability/frontend/datasets/AIObservabilityDatasetsScene.tsx+++ b/products/ai_observability/frontend/datasets/AIObservabilityDatasetsScene.tsx@@ -134,7 +134,8 @@ export function AIObservabilityDatasetsScene(): JSX.Element {<SceneContent><SceneTitleSectionname="Datasets"- description="Manage datasets for testing and evaluation."+ description="Create and manage datasets to test changes and evaluate your AI outputs. [Learn more](https://posthog.com/docs/ai-evals/datasets)"+ markdownresourceType={{ type: 'llm_datasets' }}/><div className="flex gap-x-4 gap-y-2 items-center flex-wrap py-4 -mt-4 mb-4 border-b justify-between">