Skip to content

Support separate analytics URL configuration (parity with Node SDK) #213

@adamvialpando

Description

@adamvialpando

Problem

The Python SDK's AnalyticsProcessor derives its endpoint from api_url:

# flagsmith/analytics.py
class AnalyticsProcessor:
    def __init__(self, environment_key, base_api_url, timeout=3):
        self.analytics_endpoint = base_api_url + ANALYTICS_ENDPOINT  # "analytics/flags/"

When a user points the SDK at the Edge Proxy via api_url, flag analytics POSTs go to <edge-proxy>/analytics/flags/, which the Edge Proxy does not handle. Analytics events are silently dropped, so the flag analytics dashboard shows no data for users running local-eval mode behind the Edge Proxy.

Proposed change

Add an optional analytics_url parameter to the Flagsmith constructor that overrides the analytics endpoint independently of api_url. Matches the Node SDK pattern where analyticsUrl is configurable separately from apiUrl.

Example

Flagsmith(
    environment_key="...",
    api_url="https://edge-proxy.local/api/v1/",
    analytics_url="https://edge.api.flagsmith.com/api/v1/analytics/flags/",
    enable_local_evaluation=True,
    enable_analytics=True,
)

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions