Skip to content

Commit

Permalink
bug-1933774: omit collector-added fields from Crash Annotations tab (#…
Browse files Browse the repository at this point in the history
…6823)

* bug-1933774: omit collector-added fields from Crash Annotations tab

This removes the collector-added fields from the Crash Annotations tab
of the report view. It's confusing that these were there.

This also adds "version" to the Debug tab. This value is the version of
the raw crash structure in storage. It's relevant to Socorro internals,
but nothing else.

* Remove old code

This said to remove it after 2022. It's after 2022 now.
  • Loading branch information
willkg authored Dec 3, 2024
1 parent 8980ee7 commit 7d024ee
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 35 deletions.
56 changes: 30 additions & 26 deletions webapp/crashstats/crashstats/jinja2/crashstats/report_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -909,17 +909,19 @@ <h2>Public data</h2>
</div>
<table class="record data-table hardwrapped">
<tbody>
{% for key in public_raw_keys %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% for key in public_annotations %}
{% if key not in fields_from_collector %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand All @@ -936,17 +938,19 @@ <h2>Protected data</h2>
</div>
<table class="record data-table hardwrapped">
<tbody>
{% for key in protected_raw_keys %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% for key in protected_annotations %}
{% if key not in fields_from_collector %}
<tr title="{{ fields_desc.get(make_raw_crash_key(key), empty_desc) }}">
<th class="w-2/12" scope="row">
{% if key %}
{{ key }}
{% else %}
<i>empty key</i>
{% endif %}
</th>
<td class="w-10/12"><pre>{{ raw[key] }}</pre></td>
</tr>
{% endif %}
{% endfor %}
</tbody>
</table>
Expand Down Expand Up @@ -1203,6 +1207,10 @@ <h4>Collector</h4>
<th scope="row">submitted_timestamp</th>
<td>{{ raw.submitted_timestamp | human_readable_iso_date }} UTC</td>
</tr>
<tr>
<th scope="row">version</th>
<td>{{ raw.version }}</td>
</tr>
<tr>
<th scope="row">Throttleable</th>
<td>{{ raw.Throttleable|default("--") }}</td>
Expand Down Expand Up @@ -1273,10 +1281,6 @@ <h4>Processor</h4>
{% if report and report.stackwalk_version %}
{{ report.stackwalk_version }}
{% endif %}
{# FIXME(willkg): this is the old locaion; remove in December 2022 #}
{% if report and report.json_dump and report.json_dump.stackwalk_version %}
{{ report.json_dump.stackwalk_version }}
{% endif %}
</td>
</tr>
<tr>
Expand Down
29 changes: 20 additions & 9 deletions webapp/crashstats/crashstats/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,19 +202,30 @@ def report_index(request, crash_id, default_context=None):
)
context["report"]["mac_crash_info"] = mac_crash_info

all_public_raw_keys = raw_api.public_keys()
context["public_raw_keys"] = [x for x in context["raw"] if x in all_public_raw_keys]
all_public_annotations = raw_api.public_keys()
context["public_annotations"] = [
x for x in context["raw"] if x in all_public_annotations
]

if request.user.has_perm("crashstats.view_pii"):
# If the user can see PII or this is their crash report, include everything
context["protected_raw_keys"] = [
x for x in context["raw"] if x not in all_public_raw_keys
context["protected_annotations"] = [
x for x in context["raw"] if x not in all_public_annotations
]
else:
context["protected_raw_keys"] = []

# Sort keys case-insensitively
context["public_raw_keys"].sort(key=lambda s: s.lower())
context["protected_raw_keys"].sort(key=lambda s: s.lower())
context["protected_annotations"] = []

# Set of fields added to the raw crash by the collector that are not annotations
context["fields_from_collector"] = {
"metadata",
"uuid",
"submitted_timestamp",
"version",
}

# Sort annotation keys case-insensitively
context["public_annotations"].sort(key=lambda s: s.lower())
context["protected_annotations"].sort(key=lambda s: s.lower())

data_urls = []
if request.user.has_perm("crashstats.view_pii"):
Expand Down

0 comments on commit 7d024ee

Please sign in to comment.