Skip to content

Commit 1a32da4

Browse files
yashikakhuranaYashika Khurana
andauthored
feat(nimbus): Iframe monitoring dashboard (#15344)
Because - We want to include the feature monitoring dashboard (Grafana) on experimenter feature page, but before doing that I want to test the authworkflow, so adding it as a new url to test the iframe This commit - Adds the new url for the dashbaord, later will remove the url and include it self in a feature page Fixes #15342 --------- Co-authored-by: Yashika Khurana <yashikakhurana@Yashikas-MacBook-Pro.local>
1 parent 6d783ac commit 1a32da4

7 files changed

Lines changed: 80 additions & 0 deletions

File tree

experimenter/experimenter/experiments/models.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2591,6 +2591,13 @@ class Meta:
25912591
def __str__(self): # pragma: no cover
25922592
return f"{self.name} ({self.application})"
25932593

2594+
@property
2595+
def feature_monitoring_url(self):
2596+
application = (self.application or "").replace("-", "_")
2597+
return settings.FEATURE_MONITORING_URL.format(
2598+
slug=self.slug, application=application
2599+
)
2600+
25942601
def schemas_between_versions(
25952602
self,
25962603
min_version: packaging.version.Version,

experimenter/experimenter/experiments/tests/test_models.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5775,6 +5775,18 @@ def test_clone_screenshot_with_missing_image_skips(self):
57755775

57765776

57775777
class NimbusFeatureConfigTests(TestCase):
5778+
def test_feature_monitoring_url(self):
5779+
feature = NimbusFeatureConfigFactory.create(
5780+
slug="my-feature",
5781+
application=NimbusExperiment.Application.DESKTOP,
5782+
)
5783+
self.assertEqual(
5784+
feature.feature_monitoring_url,
5785+
settings.FEATURE_MONITORING_URL.format(
5786+
slug="my-feature", application="firefox_desktop"
5787+
),
5788+
)
5789+
57785790
def test_schemas_between_versions(self):
57795791
feature = NimbusFeatureConfigFactory.create()
57805792

experimenter/experimenter/nimbus_ui/constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ class NimbusUIConstants:
172172
"All statistically significant changes that have occurred in the experiment"
173173
)
174174
NOTABLE_CHANGES_ABSENT_TEXT = "There are no notable changes in this experiment"
175+
FEATURE_MONITORING_CARD_TITLE = "Feature Monitoring"
176+
FEATURE_MONITORING_OPEN_DASHBOARD_TEXT = "Open in Grafana"
177+
175178
FEATURE_PAGE_LINKS = {
176179
"feature_learn_more_url": "https://experimenter.info/getting-started/for-experiment-owners",
177180
"deliveries_table_tooltip": """This shows all Nimbus experiments, rollouts, Labs
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{% extends "experimenter_base.html" %}
2+
3+
{% load static %}
4+
5+
{% block content %}
6+
<div class="bg-body-tertiary py-4">
7+
<div class="container">
8+
<div class="mb-3 d-flex align-items-center justify-content-between">
9+
<div>
10+
<h4 class="fw-semibold mb-1">
11+
<i class="fa-solid fa-chart-line me-2"></i>
12+
Feature Monitoring — {{ feature_config.name }}
13+
</h4>
14+
<p class="text-muted mb-0 small">{{ feature_config.application }}</p>
15+
</div>
16+
<div class="d-flex gap-2">
17+
<a href="{% url 'nimbus-ui-features' %}?application={{ feature_config.application }}&feature_configs={{ feature_config.pk }}"
18+
class="btn btn-outline-secondary btn-sm">
19+
<i class="fa-solid fa-arrow-left me-1"></i>
20+
Back to Feature Page
21+
</a>
22+
<a href="{{ feature_config.feature_monitoring_url }}"
23+
target="_blank"
24+
rel="noopener noreferrer"
25+
class="btn btn-outline-primary btn-sm">
26+
<i class="fa-solid fa-arrow-up-right-from-square me-1"></i>
27+
Open in Grafana
28+
</a>
29+
</div>
30+
</div>
31+
<div class="card shadow-sm border-0 rounded-3">
32+
<div class="card-body p-0">
33+
<iframe src="{{ feature_config.feature_monitoring_url }}&kiosk"
34+
width="100%"
35+
height="800"
36+
frameborder="0"
37+
title="Feature Monitoring Dashboard"></iframe>
38+
</div>
39+
</div>
40+
</div>
41+
</div>
42+
{% endblock %}

experimenter/experimenter/nimbus_ui/urls.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
NimbusExperimentsListTableView,
3434
NimbusExperimentsPromoteToRolloutView,
3535
NimbusExperimentsSidebarCloneView,
36+
NimbusFeatureMonitoringView,
3637
NimbusFeaturesView,
3738
NimbusRolloutDetailView,
3839
OverviewUpdateView,
@@ -70,6 +71,11 @@
7071
NimbusFeaturesView.as_view(),
7172
name="nimbus-ui-features",
7273
),
74+
re_path(
75+
r"^feature-monitoring/(?P<pk>\d+)/$",
76+
NimbusFeatureMonitoringView.as_view(),
77+
name="nimbus-ui-feature-monitoring",
78+
),
7379
re_path(
7480
r"^tags/manage/$",
7581
TagsManageView.as_view(),

experimenter/experimenter/nimbus_ui/views.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,6 +1129,12 @@ def get_context_data(self, **kwargs):
11291129
return context
11301130

11311131

1132+
class NimbusFeatureMonitoringView(DetailView):
1133+
template_name = "nimbus_experiments/feature_monitoring.html"
1134+
model = NimbusFeatureConfig
1135+
context_object_name = "feature_config"
1136+
1137+
11321138
class NimbusExperimentsHomeView(FilterView):
11331139
template_name = "nimbus_experiments/home.html"
11341140
filterset_class = NimbusExperimentsHomeFilter

experimenter/experimenter/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,10 @@
436436
"https://mozilla.cloud.looker.com/dashboards/operational_monitoring::{slug}"
437437
)
438438
ROLLOUT_MONITORING_EXPIRATION_DAYS = 90
439+
FEATURE_MONITORING_URL = (
440+
"https://yardstick.mozilla.org/d/dtfz7xv/nimbus-feature-monitoring"
441+
"?orgId=1&var-feature_slug={slug}&var-application={application}"
442+
)
439443

440444
# Statsd via Markus
441445
STATSD_BACKEND = config(

0 commit comments

Comments
 (0)