Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(flags): add GET feature_flags/:id/status for determining flag staleness #26340

Merged
merged 51 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
c9c0e69
(WIP) feat(flags): add GET feature_flags/:id/status for getting stale…
havenbarnes Nov 15, 2024
8cabf20
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 18, 2024
6393b43
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 19, 2024
ebb3d79
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 19, 2024
d5d7fe5
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 19, 2024
54315d7
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 20, 2024
e831e92
finished + tested
havenbarnes Nov 21, 2024
c9de2fd
cleanup
havenbarnes Nov 21, 2024
f7bacde
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 21, 2024
865673c
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 21, 2024
91cb491
Fix linter
havenbarnes Nov 21, 2024
6724a4e
cleanup
havenbarnes Nov 21, 2024
4969eb9
tweak
havenbarnes Nov 21, 2024
25e2abf
Merge branch 'master' into detect-stale-flags
havenbarnes Nov 21, 2024
5f73662
Merge branch 'master' into detect-stale-flags
havenbarnes Nov 25, 2024
5554015
Merge branch 'master' into detect-stale-flags
havenbarnes Nov 25, 2024
c9340ba
Merge branch 'master' into detect-stale-flags
havenbarnes Nov 25, 2024
20b15ad
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 25, 2024
cfd96e8
adjust a little after chatting with Dylan
havenbarnes Nov 25, 2024
799cba3
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes Nov 25, 2024
836185c
Merge branch 'master' into detect-stale-flags
havenbarnes Nov 26, 2024
acbe9a5
tweak
havenbarnes Nov 26, 2024
d32b0b0
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes Nov 26, 2024
4873a02
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Nov 26, 2024
c9418aa
Update posthog/models/feature_flag/flag_status.py
havenbarnes Nov 26, 2024
3dccf1d
Update posthog/models/feature_flag/flag_status.py
havenbarnes Nov 26, 2024
9062d8c
Merge branch 'master' into detect-stale-flags
dmarticus Nov 26, 2024
51bc657
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Dec 2, 2024
76360f9
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Dec 2, 2024
f785cb7
tweak select clause
havenbarnes Dec 2, 2024
1c7f2bb
fix copy
havenbarnes Dec 2, 2024
864dd33
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Dec 2, 2024
2aa65be
update tests
havenbarnes Dec 2, 2024
23320f0
Update query snapshots
github-actions[bot] Dec 2, 2024
3b6a43a
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 2, 2024
e6727a7
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Dec 2, 2024
d2d42b2
tweak
havenbarnes Dec 2, 2024
20a349e
Update query snapshots
github-actions[bot] Dec 2, 2024
af637e5
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 2, 2024
5334c34
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Dec 3, 2024
550870c
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes Dec 3, 2024
90c0f19
Update query snapshots
github-actions[bot] Dec 3, 2024
c89d215
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 3, 2024
09b600f
Merge branch 'master' of https://github.com/PostHog/posthog into dete…
havenbarnes Dec 4, 2024
c1633fa
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes Dec 4, 2024
b8ff72c
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 5, 2024
c93f1a3
Use proper term "rolled out" instead of "enabled"
havenbarnes Dec 5, 2024
f4767ed
Merge branch 'detect-stale-flags' of https://github.com/PostHog/posth…
havenbarnes Dec 5, 2024
f7010cc
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 5, 2024
fe22911
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 6, 2024
80c20c6
Merge branch 'master' into detect-stale-flags
havenbarnes Dec 6, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions posthog/api/feature_flag.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from posthog.models.feedback.survey import Survey
from posthog.models.group_type_mapping import GroupTypeMapping
from posthog.models.property import Property
from posthog.models.feature_flag.flag_status import FeatureFlagStatusChecker, FeatureFlagStatus
from posthog.queries.base import (
determine_parsed_date_for_property_matching,
)
Expand Down Expand Up @@ -836,6 +837,20 @@ def all_activity(self, request: request.Request, **kwargs):

return activity_page_response(activity_page, limit, page, request)

@action(methods=["GET"], detail=True, required_scopes=["feature_flag:read"])
def status(self, request: request.Request, **kwargs):
feature_flag_id = kwargs["pk"]

checker = FeatureFlagStatusChecker(
feature_flag_id=feature_flag_id,
)
flag_status, reason = checker.get_status()

return Response(
{"status": flag_status, "reason": reason},
status=status.HTTP_404_NOT_FOUND if flag_status == FeatureFlagStatus.UNKNOWN else status.HTTP_200_OK,
)

@action(methods=["GET"], detail=True, required_scopes=["activity_log:read"])
def activity(self, request: request.Request, **kwargs):
limit = int(request.query_params.get("limit", "10"))
Expand Down
Loading
Loading