Skip to content

feat(mcp-insights): project flag #95218

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

Merged
merged 4 commits into from
Jul 11, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
3 changes: 3 additions & 0 deletions src/sentry/api/serializers/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ class ProjectSerializerBaseResponse(_ProjectSerializerOptionalBaseResponse):
hasInsightsQueues: bool
hasInsightsLlmMonitoring: bool
hasInsightsAgentMonitoring: bool
hasInsightsMCP: bool


class ProjectSerializerResponse(ProjectSerializerBaseResponse):
Expand Down Expand Up @@ -553,6 +554,7 @@ def serialize(
"hasInsightsQueues": bool(obj.flags.has_insights_queues),
"hasInsightsLlmMonitoring": bool(obj.flags.has_insights_llm_monitoring),
"hasInsightsAgentMonitoring": bool(obj.flags.has_insights_agent_monitoring),
"hasInsightsMCP": bool(obj.flags.has_insights_mcp),
"isInternal": obj.is_internal_project(),
"isPublic": obj.public,
# Projects don't have avatar uploads, but we need to maintain the payload shape for
Expand Down Expand Up @@ -801,6 +803,7 @@ def serialize( # type: ignore[override] # intentionally different data shape
hasInsightsQueues=bool(obj.flags.has_insights_queues),
hasInsightsLlmMonitoring=bool(obj.flags.has_insights_llm_monitoring),
hasInsightsAgentMonitoring=bool(obj.flags.has_insights_agent_monitoring),
hasInsightsMCP=bool(obj.flags.has_insights_mcp),
platform=obj.platform,
platforms=attrs["platforms"],
latestRelease=attrs["latest_release"],
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/apidocs/examples/organization_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,7 @@ class OrganizationExamples:
"hasInsightsQueues": False,
"hasInsightsLlmMonitoring": False,
"hasInsightsAgentMonitoring": False,
"hasInsightsMCP": False,
"platform": "node",
"platforms": [],
"latestRelease": None,
Expand Down Expand Up @@ -452,6 +453,7 @@ class OrganizationExamples:
"hasInsightsQueues": False,
"hasInsightsLlmMonitoring": False,
"hasInsightsAgentMonitoring": False,
"hasInsightsMCP": False,
"latestRelease": None,
}
],
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/apidocs/examples/project_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"hasInsightsQueues": False,
"hasInsightsLlmMonitoring": False,
"hasInsightsAgentMonitoring": False,
"hasInsightsMCP": False,
"isInternal": False,
"isPublic": False,
"avatar": {"avatarType": "letter_avatar", "avatarUuid": None},
Expand Down Expand Up @@ -343,6 +344,7 @@
"hasInsightsQueues": True,
"hasInsightsLlmMonitoring": False,
"hasInsightsAgentMonitoring": False,
"hasInsightsMCP": False,
"platform": "node-express",
"platforms": [],
"latestRelease": None,
Expand Down
2 changes: 2 additions & 0 deletions src/sentry/apidocs/examples/team_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ class TeamExamples:
"hasInsightsQueues": False,
"hasInsightsLlmMonitoring": False,
"hasInsightsAgentMonitoring": False,
"hasInsightsMCP": False,
"isInternal": False,
"isPublic": False,
"avatar": {"avatarType": "letter_avatar", "avatarUuid": None},
Expand Down Expand Up @@ -307,6 +308,7 @@ class TeamExamples:
"hasInsightsQueues": False,
"hasInsightsLlmMonitoring": False,
"hasInsightsAgentMonitoring": False,
"hasInsightsMCP": False,
"isInternal": False,
"isPublic": False,
"avatar": {"avatarType": "letter_avatar", "avatarUuid": None},
Expand Down
3 changes: 3 additions & 0 deletions src/sentry/models/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,9 @@ class flags(TypedClassBitField):
# This Project has sent insight agent monitoring spans
has_insights_agent_monitoring: bool

# This Project has sent insight MCP spans
has_insights_mcp: bool

bitfield_default = 10

objects: ClassVar[ProjectManager] = ProjectManager(cache_fields=["pk"])
Expand Down
1 change: 1 addition & 0 deletions src/sentry/projects/services/project/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ class RpcProjectFlags(RpcModel):
has_insights_llm_monitoring: bool
has_flags: bool
has_insights_agent_monitoring: bool
has_insights_mcp: bool


class RpcProject(RpcModel):
Expand Down
1 change: 1 addition & 0 deletions static/app/types/project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export type Project = {
hasInsightsDb: boolean;
hasInsightsHttp: boolean;
hasInsightsLlmMonitoring: boolean;
hasInsightsMCP: boolean;
hasInsightsQueues: boolean;
hasInsightsScreenLoad: boolean;
hasInsightsVitals: boolean;
Expand Down
3 changes: 3 additions & 0 deletions tests/sentry/api/serializers/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,7 @@ def test_has_insight_module_flags(self):
assert result["hasInsightsQueues"] is False
assert result["hasInsightsLlmMonitoring"] is False
assert result["hasInsightsAgentMonitoring"] is False
assert result["hasInsightsMCP"] is False

self.project.first_event = timezone.now()
self.project.update(flags=F("flags").bitor(Project.flags.has_insights_http))
Expand All @@ -468,6 +469,7 @@ def test_has_insight_module_flags(self):
self.project.update(flags=F("flags").bitor(Project.flags.has_insights_queues))
self.project.update(flags=F("flags").bitor(Project.flags.has_insights_llm_monitoring))
self.project.update(flags=F("flags").bitor(Project.flags.has_insights_agent_monitoring))
self.project.update(flags=F("flags").bitor(Project.flags.has_insights_mcp))

result = serialize(self.project, self.user, ProjectSummarySerializer())
assert result["hasInsightsHttp"] is True
Expand All @@ -480,6 +482,7 @@ def test_has_insight_module_flags(self):
assert result["hasInsightsQueues"] is True
assert result["hasInsightsLlmMonitoring"] is True
assert result["hasInsightsAgentMonitoring"] is True
assert result["hasInsightsMCP"] is True

def test_has_flags_flag(self):
result = serialize(self.project, self.user, ProjectSummarySerializer())
Expand Down
Loading