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

fix facet support #100

Merged
merged 5 commits into from
Oct 11, 2023
Merged

fix facet support #100

merged 5 commits into from
Oct 11, 2023

Conversation

willkg
Copy link
Collaborator

@willkg willkg commented Oct 10, 2023

Fixes #99
Fixes #98

This makes it easier to see what Super Search is returning in the
response payload.
This changes the basic supersearchfacet mode to support multiple facets.
So you can now do:

supersearchfacet --_facets=product --_facets=platform \
    --_facets=release_channel

And it'll do one Super Search API query and print the information for
each facet in a separate group.

This also adds a "raw" format which prints the HTTP response without
doing anything to it.

This fixes support for cardinality. For example, this now works:

supersearchfacet --product=Firefox --_facets=_cardinality.build_id

# If it is in count/period mode, then we have to do one facet for each
# period and compose the results.
if "signature" not in params["_facets"] and "signature" in facet_data_payload["facets"]:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We should fix this in Crash Stats, but I'm not sure why Crash Stats does this and what might rely on it because it's been this way for years.


# Figure out what facet we're doing
facet_name = params["_facets"][0]
if format_type == "raw":
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Between this format and --verbose, you get a great idea of what the HTTP request and response look like.


for day_start, day_end in generate_periods(period, start_date, end_date):
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I can get rid of generate_periods, too.

Previously, we had our own implementation of histograms allowing us to
look at values over time. This reworks supersearchfacet to use Super
Search API _histogram and _histogram_interval to do the same thing, but
with a single Super Search API call.
facets = facet_data["facets"]
if format_type == "json":
console.print_json(json.dumps(facet_tables))
continue
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For JSON format, it's better to print the whole thing rather than break it up into fields, so we do that here. Further, we probably don't want the blank line between items.

:returns: a map of facet_name -> {headers: headers, records: records}

"""
# FIXME(willkg): add support for nested aggregations
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Also need to add support for cardinality values.

@willkg willkg merged commit b3e193d into main Oct 11, 2023
5 checks passed
@willkg willkg deleted the fix-facet branch October 11, 2023 00:55
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.

support multiple _facets support _histogram in super search api
1 participant