Skip to content

Commit adfbc7c

Browse files
ENG-2883 Remove fideslog (#7735)
Co-authored-by: eastandwestwind <eastandwestwind@gmail.com>
1 parent 27b9461 commit adfbc7c

41 files changed

Lines changed: 129 additions & 1587 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.fides/db_dataset.yml

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -2479,35 +2479,6 @@ dataset:
24792479
- name: updated_at
24802480
data_categories:
24812481
- system.operations
2482-
- name: userregistration
2483-
description: 'Records the registration status of this Fides deployment'
2484-
data_categories: null
2485-
fields:
2486-
- name: id
2487-
data_categories:
2488-
- system.operations
2489-
- name: created_at
2490-
data_categories:
2491-
- system.operations
2492-
- name: updated_at
2493-
data_categories:
2494-
- system.operations
2495-
- name: analytics_id
2496-
description: 'The identifier for this Fides deployment within Fideslog'
2497-
data_categories:
2498-
- system.operations
2499-
- name: opt_in
2500-
description: 'Whether the user has opted to share analytics data'
2501-
data_categories:
2502-
- system.operations
2503-
- name: user_email
2504-
description: 'The email of the user setting this opt_in preference'
2505-
data_categories:
2506-
- user.contact.email
2507-
- name: user_organization
2508-
description: 'The name of the organization this Fides deployment belongs to'
2509-
data_categories:
2510-
- user.workplace
25112482
- name: cookies
25122483
description: 'Fides Generated Description for Table: cookies'
25132484
data_categories: []
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
type: Removed
2+
description: Removed the fideslog analytics dependency
3+
pr: 7735
4+
labels: [db-migration]

docs/fides/docs/development/fideslog.md

Lines changed: 0 additions & 29 deletions
This file was deleted.

docs/fides/mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ nav:
2828
- Releases: development/releases.md
2929
- Using Postman: development/postman/using_postman.md
3030
- Updating the Database Diagram: development/update_erd_diagram.md
31-
- User Analytics: development/fideslog.md
3231
- Community:
3332
- Github, Slack, and Discord: community/overview.md
3433
- Community Hints and Tips: community/hints_tips.md

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies = [
2828
"PyMySQL==1.1.1",
2929
"SQLAlchemy-Utils==0.38.3",
3030
"acryl-datahub==1.3.1.3",
31-
"aiodns~=3.5.0",
31+
"aiohttp==3.13.3",
3232
"aiohappyeyeballs~=2.6.1",
3333
"alembic==1.8.1",
3434
"anyascii==0.3.2",
@@ -56,7 +56,6 @@ dependencies = [
5656
"fastapi-pagination[sqlalchemy]==0.15.0",
5757
"fastapi[all]==0.123.3",
5858
"fideslang==3.1.4a1",
59-
"fideslog==1.2.15",
6059
"firebase-admin==5.3.0",
6160
"flower==2.0.1",
6261
"google-auth==2.48.0",
@@ -249,7 +248,6 @@ module = [
249248
"dask.*",
250249
"deepdiff.*",
251250
"defusedxml.ElementTree.*",
252-
"fideslog.*",
253251
"firebase_admin.*",
254252
"google.api_core.*",
255253
"joblib.*",
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""drop legacy userregistration table
2+
3+
Revision ID: 25ffa8bf6a95
4+
Revises: a1ca9ddf3c3c
5+
Create Date: 2026-03-23 12:00:00.000000
6+
7+
"""
8+
9+
import sqlalchemy as sa
10+
from alembic import op
11+
12+
# revision identifiers, used by Alembic.
13+
revision = "25ffa8bf6a95"
14+
down_revision = "a1ca9ddf3c3c"
15+
branch_labels = None
16+
depends_on = None
17+
18+
19+
def upgrade() -> None:
20+
op.execute("DROP INDEX IF EXISTS ix_userregistration_id")
21+
op.execute("DROP TABLE IF EXISTS userregistration CASCADE")
22+
23+
24+
def downgrade() -> None:
25+
op.create_table(
26+
"userregistration",
27+
sa.Column("id", sa.String(length=255), nullable=False),
28+
sa.Column(
29+
"created_at",
30+
sa.DateTime(timezone=True),
31+
server_default=sa.text("now()"),
32+
nullable=True,
33+
),
34+
sa.Column(
35+
"updated_at",
36+
sa.DateTime(timezone=True),
37+
server_default=sa.text("now()"),
38+
nullable=True,
39+
),
40+
sa.Column("user_email", sa.String(), nullable=True),
41+
sa.Column("user_organization", sa.String(), nullable=True),
42+
sa.Column("analytics_id", sa.String(), nullable=False),
43+
sa.Column("opt_in", sa.Boolean(), nullable=False),
44+
sa.PrimaryKeyConstraint("id"),
45+
sa.UniqueConstraint("analytics_id"),
46+
)
47+
op.create_index(
48+
op.f("ix_userregistration_id"),
49+
"userregistration",
50+
["id"],
51+
unique=False,
52+
)

src/fides/api/analytics.py

Lines changed: 0 additions & 58 deletions
This file was deleted.

src/fides/api/app_setup.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import fides
2020
from fides.api.asgi_middleware import (
21-
AnalyticsLoggingMiddleware,
2221
AuditLogMiddleware,
2322
LogRequestMiddleware,
2423
ProfileRequestMiddleware,
@@ -129,9 +128,6 @@ def create_fides_app(
129128
if CONFIG.dev_mode:
130129
fastapi_app.add_middleware(ProfileRequestMiddleware)
131130

132-
if not CONFIG.user.analytics_opt_out:
133-
fastapi_app.add_middleware(AnalyticsLoggingMiddleware)
134-
135131
fastapi_app.add_middleware(LogRequestMiddleware)
136132

137133
if CONFIG.security.enable_audit_log_resource_middleware:

src/fides/api/asgi_middleware.py

Lines changed: 0 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,19 @@
77

88
from __future__ import annotations
99

10-
import asyncio
1110
import re
1211
from abc import ABC, abstractmethod
13-
from datetime import datetime, timezone
1412
from time import perf_counter
1513
from typing import Any, Awaitable, Callable, MutableMapping, Optional, Set
1614
from uuid import uuid4
1715

18-
from fideslog.sdk.python.event import AnalyticsEvent
1916
from loguru import logger
2017
from pyinstrument import Profiler
2118
from starlette.requests import Request
2219

23-
from fides.api.analytics import (
24-
accessed_through_local_host,
25-
in_docker_container,
26-
send_analytics_event,
27-
)
2820
from fides.api.middleware import handle_audit_log_resource
2921
from fides.api.request_context import set_request_id
30-
from fides.api.schemas.analytics import Event, ExtraData
3122
from fides.api.util.endpoint_utils import API_PREFIX
32-
from fides.api.util.logger import _log_exception
3323
from fides.config import CONFIG
3424

3525
# Type aliases for ASGI
@@ -228,107 +218,6 @@ async def handle_http(self, scope: Scope, receive: Receive, send: Send) -> None:
228218
).info("Request received")
229219

230220

231-
class AnalyticsLoggingMiddleware(BaseASGIMiddleware):
232-
"""
233-
Pure ASGI middleware that logs analytics events for each call to Fides endpoints.
234-
235-
Only logs for API endpoints (paths starting with API_PREFIX) and skips /health endpoints.
236-
"""
237-
238-
# Class-level set to hold references to pending tasks, preventing garbage collection
239-
# before completion. Tasks remove themselves from this set when done.
240-
_pending_tasks: set[asyncio.Task] = set()
241-
242-
def __init__(self, app: ASGIApp, api_prefix: str = API_PREFIX) -> None:
243-
super().__init__(app)
244-
self.api_prefix = api_prefix
245-
246-
async def handle_http(self, scope: Scope, receive: Receive, send: Send) -> None:
247-
path = self.get_path(scope)
248-
249-
# Skip non-API endpoints and health endpoints
250-
if not path.startswith(self.api_prefix) or path.endswith("/health"):
251-
await self.app(scope, receive, send)
252-
return
253-
254-
method = self.get_method(scope)
255-
fides_source: Optional[str] = self.get_header(scope, b"x-fides-source") or None
256-
hostname = self.get_host(scope)
257-
full_url = self.build_url(scope)
258-
259-
now = datetime.now(tz=timezone.utc)
260-
endpoint = f"{method}: {full_url}"
261-
262-
# Capture status and detect HTTP errors
263-
captured: dict[str, Any] = {"status": 500, "error_class": None}
264-
265-
async def send_wrapper(message: Message) -> None:
266-
if message["type"] == "http.response.start":
267-
status_code: int = message.get("status", 500)
268-
captured["status"] = status_code
269-
if status_code >= 400:
270-
captured["error_class"] = "HTTPException"
271-
await send(message)
272-
273-
try:
274-
await self.app(scope, receive, send_wrapper)
275-
except Exception as e:
276-
captured["status"] = 500
277-
captured["error_class"] = e.__class__.__name__
278-
_log_exception(e, CONFIG.dev_mode)
279-
raise
280-
finally:
281-
# Schedule analytics logging as a background task.
282-
# Store task reference to prevent garbage collection before completion.
283-
task = asyncio.create_task(
284-
self._log_analytics(
285-
endpoint,
286-
hostname,
287-
captured["status"],
288-
now,
289-
fides_source,
290-
captured["error_class"],
291-
)
292-
)
293-
self._pending_tasks.add(task)
294-
# Task will be passed as argument to discard when it completes
295-
task.add_done_callback(self._pending_tasks.discard)
296-
297-
async def _log_analytics(
298-
self,
299-
endpoint: str,
300-
hostname: Optional[str],
301-
status_code: int,
302-
event_created_at: datetime,
303-
fides_source: Optional[str],
304-
error_class: Optional[str],
305-
) -> None:
306-
"""Log analytics event if not opted out."""
307-
if CONFIG.user.analytics_opt_out:
308-
return
309-
310-
try:
311-
await send_analytics_event(
312-
AnalyticsEvent(
313-
docker=in_docker_container(),
314-
event=Event.endpoint_call.value,
315-
event_created_at=event_created_at,
316-
local_host=accessed_through_local_host(hostname),
317-
endpoint=endpoint,
318-
status_code=status_code,
319-
error=error_class or None,
320-
extra_data=(
321-
{ExtraData.fides_source.value: fides_source}
322-
if fides_source
323-
else None
324-
),
325-
)
326-
)
327-
except Exception:
328-
# Analytics should never break the request
329-
pass
330-
331-
332221
class AuditLogMiddleware(BaseASGIMiddleware):
333222
"""
334223
Pure ASGI middleware that logs audit information for non-GET requests.

src/fides/api/db/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@
9191
Property,
9292
)
9393
from fides.api.models.questionnaire import ChatMessage, Questionnaire
94-
from fides.api.models.registration import UserRegistration
9594
from fides.api.models.saas_template_dataset import SaasTemplateDataset
9695
from fides.api.models.storage import StorageConfig
9796
from fides.api.models.system_compass_sync import SystemCompassSync

0 commit comments

Comments
 (0)