Skip to content

Generalize Japan overview into multi-country webcompat dashboard#506

Open
martinbalfanz wants to merge 4 commits intomozilla:mainfrom
martinbalfanz:japan-webcompat-dashboard-clean
Open

Generalize Japan overview into multi-country webcompat dashboard#506
martinbalfanz wants to merge 4 commits intomozilla:mainfrom
martinbalfanz:japan-webcompat-dashboard-clean

Conversation

@martinbalfanz
Copy link
Copy Markdown
Contributor

Checklist for reviewer:

  • Commits should reference a bug or github issue, if relevant (if a bug is
    referenced, the pull request should include the bug number in the title)
  • Scan the PR and verify that no changes (particularly to
    .circleci/config.yml) will cause environment variables (particularly
    credentials) to be exposed in test logs
  • Ensure the container image will be using permissions granted to
    telemetry-airflow
    responsibly.

Note for deployments: In order to push images built by this PR, the user who merges the PR
must be in the telemetry Github team.
This is because deploys depend on the
data-eng-airflow-gcr CircleCI context.
See DENG-8850 for additional discussion.

@martinbalfanz martinbalfanz requested a review from a team as a code owner March 24, 2026 12:33
host_min_ranks_condition = "MIN(sightline_rank) <= 1000 OR MIN(global_rank) <= 1000"
pretty_name = "Sightline"

[japan_1000]
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure that moving stuff in this file is a good idea; I'm not sure we don't rely on the order anywhere.

[country]
title = "Country"
type = "enum"
value = "{% for key, metric in metrics.items() if metric.country_code %}{% if loop.first %}{{ metric.pretty_name }}{% endif %}{% endfor %}"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's also OK to just not set the value here, then we don't try to overwrite it on deploy.

WHERE bugs.resolution = "" AND
CASE "{{ param("country") }}"
{% for key, metric in metrics.items() if metric.country_code %}
WHEN "{{ metric.pretty_name }}" THEN bugs.is_{{ key }}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WHEN "{{ metric.pretty_name }}" THEN bugs.is_{{ key }}
WHEN "{{ metric.pretty_name }}" THEN {{ metric.condition("bugs") }}

CASE "{{ param("country") }}"
{% for key, metric in metrics.items() if metric.country_code %}
WHEN "{{ metric.pretty_name }}" THEN (
(bugs.is_{{ key }} AND NOT bugs.is_global_1000)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
(bugs.is_{{ key }} AND NOT bugs.is_global_1000)
({{ metric.condition(bugs) }} AND NOT bugs.is_global_1000)

(`country_webcompat_overview`) and are meaningful only for country-specific
metrics:

* `country_code` - ISO country code string (e.g. `"jp"`, `"us"`). When
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already the dashboards entry you can put on metrics like

[metric]

dashboards = ["country_webcompat_overview"]

Then you can loop over just the metrics that are defined to be on that dashboard like {% for metric in dashboard_metrics %} […] {% endfor %}

(this is arguably the wrong way around and it's better separation of logic if each dashboard defines which metrics it wants to include, but it does seem likely to be less typing for common cases when we define it like this).

- Restore core/global_5000 to their original position in metrics.toml
- Remove value from country parameter
- Use metric.condition() in query templates
- Switch from country_code filtering to dashboards field; update all
  templates to use dashboard_metrics
- Update docs to reflect that country_code is not a filter
@martinbalfanz martinbalfanz requested a review from jgraham March 25, 2026 10:37
type = "site_reports_field"
host_min_ranks_condition = "MIN(japan_rank) <= 1000"
pretty_name = "Japan"
country_code = "jp"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can remove all of these country_code values and the associated code in the metrics.py file and the documentation, since they're not used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants