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

Update frontend to match new data API response format #479

Closed
robhudson opened this issue May 7, 2020 · 0 comments
Closed

Update frontend to match new data API response format #479

robhudson opened this issue May 7, 2020 · 0 comments
Assignees

Comments

@robhudson
Copy link
Member

robhudson commented May 7, 2020

In PR #462 the API response format changed. This issue will outline how to get set up locally for testing and what the new API format looks like.

To get set up locally with data, run the following commands:

  • git checkout -b transpose-frontend origin/transpose-frontend, or if you've already checked it out locally, switch to that branch.
  • make build, then make shell, then ./manage.py migrate to install the new tables and migrate existing data.
  • ./manage.py import_desktop_aggs nightly for the "nightly" channel. Repeat for "beta" and "release" if you want the full set of data across channels.
  • Exit out of the shell and launch the app like usual.

To view the data locally you can launch the the backend with make up and hit it with curl. Here's an example curl command:

curl -X POST -H "Content-Type: application/json" -d '{"query": {"aggregationLevel": "version", "channel": "beta", "os": "Windows", "process": "parent", "probe": "gc_ms"}}' localhost:8000/api/v1/data/ | python -m json.tool

Here's an example response, truncated a bit:

{
    "response": [
        {
            "version": "74",
            "os": "Windows",
            "build_id": "*",
            "process": "parent",
            "metric": "gc_ms",
            "metric_key": "",
            "metric_type": "histogram-exponential",
            "total_users": 14315648,
            "histogram": {
                "0": 75661.0819,
                "1": 365553.2612,
                ...
            },
            "percentiles": {
                "5": 3,
                "25": 40,
                "50": 57,
                "75": 81,
                "95": 160
            },
            "client_agg_type": "summed_histogram",
            "total_addressable_market": 2874783
        },
       {
            "version": "75",
            "os": "Windows",
            "build_id": "*",
            "process": "parent",
            "metric": "gc_ms",
            "metric_key": "",
            "metric_type": "histogram-exponential",
            "total_users": 12303058,
            "histogram": {
                "0": 47542.252,
                "1": 269477.5914,
                ...
            },
            "percentiles": {
                "5": 6,
                "25": 40,
                "50": 57,
                "75": 81,
                "95": 190
            },
            "client_agg_type": "summed_histogram",
            "total_addressable_market": 2631611
        },
        ...
    ]
}
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

No branches or pull requests

2 participants