Artillery output flag does not provide plugin:ensure metric - json

I am currently working on Performance Testing against our API, while facing the following problem.
Running command: artillery run --output reports/report.json tests/dev/get-user-settings.yml, gives back an output/report in JSON format in the terminal, including 'Checks' tag (at the very bottom), that I've included in the plugin portion of the yml configuration file, like so:
However, the issue, is that this same JSON output does not provide the 'Checks' metrics (in my case they're max and maxErrorRate) in the report.json:
{
"aggregate": {
"counters": {
"vusers.created_by_name.0": 300,
"vusers.created": 300,
"http.requests": 300,
"http.codes.200": 300,
"http.responses": 300,
"vusers.failed": 0,
"vusers.completed": 300
},
"rates": {
"http.request_rate": 10
},
"firstCounterAt": 1673975540669,
"firstHistogramAt": 1673975542459,
"lastCounterAt": 1673975570709,
"lastHistogramAt": 1673975570709,
"firstMetricAt": 1673975540669,
"lastMetricAt": 1673975570709,
"period": 1673975570000,
"summaries": {
"http.response_time": {
"min": 409,
"max": 1749,
"count": 300,
"p50": 478.3,
"median": 478.3,
"p75": 507.8,
"p90": 671.9,
"p95": 1465.9,
"p99": 1587.9,
"p999": 1587.9
},
"vusers.session_length": {
"min": 534.6,
"max": 1880.2,
"count": 300,
"p50": 620.3,
"median": 620.3,
"p75": 685.5,
"p90": 837.3,
"p95": 1620,
"p99": 1755,
"p999": 1826.6
}
},
"histograms": {
"http.response_time": {
"min": 409,
"max": 1749,
"count": 300,
"p50": 478.3,
"median": 478.3,
"p75": 507.8,
"p90": 671.9,
"p95": 1465.9,
"p99": 1587.9,
"p999": 1587.9
},
"vusers.session_length": {
"min": 534.6,
"max": 1880.2,
"count": 300,
"p50": 620.3,
"median": 620.3,
"p75": 685.5,
"p90": 837.3,
"p95": 1620,
"p99": 1755,
"p999": 1826.6
}
}
},
"intermediate": [
{
"counters": {
"vusers.created_by_name.0": 97,
"vusers.created": 97,
"http.requests": 97,
"http.codes.200": 90,
"http.responses": 90,
"vusers.failed": 0,
"vusers.completed": 90
},
"rates": {
"http.request_rate": 10
},
"http.request_rate": null,
"firstCounterAt": 1673975540669,
"firstHistogramAt": 1673975542459,
"lastCounterAt": 1673975549975,
"lastHistogramAt": 1673975549912,
"firstMetricAt": 1673975540669,
"lastMetricAt": 1673975549975,
"period": "1673975540000",
"summaries": {
"http.response_time": {
"min": 424,
"max": 1749,
"count": 90,
"p50": 497.8,
"median": 497.8,
"p75": 658.6,
"p90": 1495.5,
"p95": 1556.5,
"p99": 1587.9,
"p999": 1587.9
},
"vusers.session_length": {
"min": 550.9,
"max": 1880.2,
"count": 90,
"p50": 632.8,
"median": 632.8,
"p75": 804.5,
"p90": 1686.1,
"p95": 1720.2,
"p99": 1826.6,
"p999": 1826.6
}
},
"histograms": {
"http.response_time": {
"min": 424,
"max": 1749,
"count": 90,
"p50": 497.8,
"median": 497.8,
"p75": 658.6,
"p90": 1495.5,
"p95": 1556.5,
"p99": 1587.9,
"p999": 1587.9
},
"vusers.session_length": {
"min": 550.9,
"max": 1880.2,
"count": 90,
"p50": 632.8,
"median": 632.8,
"p75": 804.5,
"p90": 1686.1,
"p95": 1720.2,
"p99": 1826.6,
"p999": 1826.6
}
}
},
{
"counters": {
"http.codes.200": 100,
"http.responses": 100,
"vusers.failed": 0,
"vusers.completed": 100,
"vusers.created_by_name.0": 100,
"vusers.created": 100,
"http.requests": 100
},
"rates": {
"http.request_rate": 10
},
"http.request_rate": null,
"firstCounterAt": 1673975550024,
"firstHistogramAt": 1673975550298,
"lastCounterAt": 1673975559974,
"lastHistogramAt": 1673975559701,
"firstMetricAt": 1673975550024,
"lastMetricAt": 1673975559974,
"period": "1673975550000",
"summaries": {
"http.response_time": {
"min": 422,
"max": 753,
"count": 100,
"p50": 468.8,
"median": 468.8,
"p75": 497.8,
"p90": 645.6,
"p95": 685.5,
"p99": 713.5,
"p999": 713.5
},
"vusers.session_length": {
"min": 544,
"max": 1626.6,
"count": 100,
"p50": 608,
"median": 608,
"p75": 645.6,
"p90": 837.3,
"p95": 854.2,
"p99": 1587.9,
"p999": 1587.9
}
},
"histograms": {
"http.response_time": {
"min": 422,
"max": 753,
"count": 100,
"p50": 468.8,
"median": 468.8,
"p75": 497.8,
"p90": 645.6,
"p95": 685.5,
"p99": 713.5,
"p999": 713.5
},
"vusers.session_length": {
"min": 544,
"max": 1626.6,
"count": 100,
"p50": 608,
"median": 608,
"p75": 645.6,
"p90": 837.3,
"p95": 854.2,
"p99": 1587.9,
"p999": 1587.9
}
}
},
{
"counters": {
"http.codes.200": 100,
"http.responses": 100,
"vusers.failed": 0,
"vusers.completed": 100,
"vusers.created_by_name.0": 100,
"vusers.created": 100,
"http.requests": 100
},
"rates": {
"http.request_rate": 10
},
"http.request_rate": null,
"firstCounterAt": 1673975560024,
"firstHistogramAt": 1673975560274,
"lastCounterAt": 1673975569975,
"lastHistogramAt": 1673975569710,
"firstMetricAt": 1673975560024,
"lastMetricAt": 1673975569975,
"period": "1673975560000",
"summaries": {
"http.response_time": {
"min": 409,
"max": 700,
"count": 100,
"p50": 468.8,
"median": 468.8,
"p75": 497.8,
"p90": 518.1,
"p95": 561.2,
"p99": 685.5,
"p999": 685.5
},
"vusers.session_length": {
"min": 534.6,
"max": 1624.8,
"count": 100,
"p50": 608,
"median": 608,
"p75": 632.8,
"p90": 727.9,
"p95": 788.5,
"p99": 837.3,
"p999": 837.3
}
},
"histograms": {
"http.response_time": {
"min": 409,
"max": 700,
"count": 100,
"p50": 468.8,
"median": 468.8,
"p75": 497.8,
"p90": 518.1,
"p95": 561.2,
"p99": 685.5,
"p999": 685.5
},
"vusers.session_length": {
"min": 534.6,
"max": 1624.8,
"count": 100,
"p50": 608,
"median": 608,
"p75": 632.8,
"p90": 727.9,
"p95": 788.5,
"p99": 837.3,
"p999": 837.3
}
}
},
{
"counters": {
"http.codes.200": 10,
"http.responses": 10,
"vusers.failed": 0,
"vusers.completed": 10,
"vusers.created_by_name.0": 3,
"vusers.created": 3,
"http.requests": 3
},
"rates": {
"http.request_rate": 3
},
"firstCounterAt": 1673975570025,
"firstHistogramAt": 1673975570298,
"lastCounterAt": 1673975570709,
"lastHistogramAt": 1673975570709,
"firstMetricAt": 1673975570025,
"lastMetricAt": 1673975570709,
"period": "1673975570000",
"http.request_rate": null,
"summaries": {
"http.response_time": {
"min": 445,
"max": 587,
"count": 10,
"p50": 468.8,
"median": 468.8,
"p75": 478.3,
"p90": 550.1,
"p95": 550.1,
"p99": 550.1,
"p999": 550.1
},
"vusers.session_length": {
"min": 571.5,
"max": 730.5,
"count": 10,
"p50": 596,
"median": 596,
"p75": 620.3,
"p90": 699.4,
"p95": 699.4,
"p99": 699.4,
"p999": 699.4
}
},
"histograms": {
"http.response_time": {
"min": 445,
"max": 587,
"count": 10,
"p50": 468.8,
"median": 468.8,
"p75": 478.3,
"p90": 550.1,
"p95": 550.1,
"p99": 550.1,
"p999": 550.1
},
"vusers.session_length": {
"min": 571.5,
"max": 730.5,
"count": 10,
"p50": 596,
"median": 596,
"p75": 620.3,
"p90": 699.4,
"p95": 699.4,
"p99": 699.4,
"p999": 699.4
}
}
}
]
}
Here, I will also attach modified get-user-settings.yml file (due to corporate sensitive info) below:
config:
#Ensure api-id is up to date.
target: "api/endpoint"
plugins:
ensure: {}
phases:
- duration: 30 #seconds
arrivalRate: 10 #requests per second
http:
timeout: 30
name: lambda-name Load Test
defaults:
headers:
# replace TOKEN with authorization token
authorization: "Bearer {{jwt}}"
ensure:
max: 2000 #ms are allowed for the maximum recorded response time
maxErrorRate: 1 #% of the returned 500 error codes are allowed
scenarios:
- flow:
# Update urls as required.
- get:
url: "/settings"
I have also tried using DEBUG env variable to expand the possibilities as to how to indicate plugins:ensure metrics into the report.json file, but so far no luck.
DEBUG=plugin:expect artillery run tests/dev/get-user-settings.yml

Related

Converting JSON data to model class Flutter

I want to convert JSON data to model class, I used this https://javiercbk.github.io/json_to_dart/ but I am not getting what I want, can you please assist.
My JSON data
[
{
"Id": 0,
"SourceId": 0,
"ServiceId": 11,
"CategoryId": 5,
"Category": "Valuation",
"Description": "AdjustedValues",
"Value": [],
"ServiceResponsePropertyId": 474,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 11,
"CategoryId": 1,
"Category": "General",
"Description": "ServiceStatus",
"Value": {
"StatusCode": 1,
"StatusDescription": "Ok",
"StatusDetail": "",
"RestServiceStatus": null,
"ServiceResource": null
},
"ServiceResponsePropertyId": 475,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "CarId",
"Value": 120354,
"ServiceResponsePropertyId": 100,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "Year",
"Value": 2017,
"ServiceResponsePropertyId": 103,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 6
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "Full Model Description",
"Value": "2017 AUDI A3 Sedan 1.0T FSI S tronic [2016-2017]",
"ServiceResponsePropertyId": 104,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "Model",
"Value": "A3 Sedan 1.0T FSI S tronic [2016-2017]",
"ServiceResponsePropertyId": 105,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 5
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "ImageUrl",
"Value": "https://cdn.lightstoneauto.co.za/PHOTOS/AUDI/120354_1_Z7.jpg",
"ServiceResponsePropertyId": 107,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "Make",
"Value": "AUDI",
"ServiceResponsePropertyId": 110,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 3
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "Type",
"Value": "AUDI A3 Sedan",
"ServiceResponsePropertyId": 111,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 4
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 6,
"CategoryId": 1,
"Category": "General",
"Description": "ServiceStatus",
"Value": {
"StatusCode": 1,
"StatusDescription": "Ok",
"StatusDetail": "",
"RestServiceStatus": null,
"ServiceResource": null
},
"ServiceResponsePropertyId": 125,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 7,
"CategoryId": 1,
"Category": "General",
"Description": "ServiceStatus",
"Value": {
"StatusCode": 1,
"StatusDescription": "Ok",
"StatusDetail": "",
"RestServiceStatus": null,
"ServiceResource": null
},
"ServiceResponsePropertyId": 126,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 9999
},
{
"CarId": 0,
"SpecCategory": "General",
"Id": -1,
"SourceId": -1,
"ServiceId": 7,
"CategoryId": 1,
"Category": "General",
"Description": "Body shape",
"Value": "Sedan",
"ServiceResponsePropertyId": 320,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 9999
},
{
"CarId": 0,
"SpecCategory": "General",
"Id": -6,
"SourceId": -6,
"ServiceId": 7,
"CategoryId": 1,
"Category": "General",
"Description": "Drive type",
"Value": "4x2",
"ServiceResponsePropertyId": 154,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 9999
},
{
"CarId": 0,
"SpecCategory": "General",
"Id": -7,
"SourceId": -7,
"ServiceId": 7,
"CategoryId": 1,
"Category": "General",
"Description": "Fuel type",
"Value": "Petrol",
"ServiceResponsePropertyId": 153,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 9999
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "LastFiveSales",
"Value": [
{
"SaleId": 698229,
"CarId": 120354,
"SaleYear": 2017,
"SaleDateTime": "2022-06-09T15:30:38Z",
"SalePrice": 299900.0,
"MunicipalityName": "CITY OF TSHWANE",
"Id": 0,
"SourceId": 0,
"ServiceId": 0,
"CategoryId": 0,
"Category": null,
"Description": null,
"Value": null,
"ServiceResponsePropertyId": 0,
"MappingId": 1,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
},
{
"SaleId": 695530,
"CarId": 120354,
"SaleYear": 2017,
"SaleDateTime": "2022-05-30T13:24:17Z",
"SalePrice": 289995.0,
"MunicipalityName": "CITY OF TSHWANE",
"Id": 0,
"SourceId": 0,
"ServiceId": 0,
"CategoryId": 0,
"Category": null,
"Description": null,
"Value": null,
"ServiceResponsePropertyId": 0,
"MappingId": 1,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
},
{
"SaleId": 685020,
"CarId": 120354,
"SaleYear": 2017,
"SaleDateTime": "2022-04-14T12:27:37Z",
"SalePrice": 366948.0,
"MunicipalityName": "EMFULENI",
"Id": 0,
"SourceId": 0,
"ServiceId": 0,
"CategoryId": 0,
"Category": null,
"Description": null,
"Value": null,
"ServiceResponsePropertyId": 0,
"MappingId": 1,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
},
{
"SaleId": 683843,
"CarId": 120354,
"SaleYear": 2017,
"SaleDateTime": "2022-04-11T15:00:38Z",
"SalePrice": 315500.0,
"MunicipalityName": "UMHLATHUZE",
"Id": 0,
"SourceId": 0,
"ServiceId": 0,
"CategoryId": 0,
"Category": null,
"Description": null,
"Value": null,
"ServiceResponsePropertyId": 0,
"MappingId": 1,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
},
{
"SaleId": 652718,
"CarId": 120354,
"SaleYear": 2017,
"SaleDateTime": "2022-04-01T11:53:45Z",
"SalePrice": 339900.0,
"MunicipalityName": "CITY OF TSHWANE",
"Id": 0,
"SourceId": 0,
"ServiceId": 0,
"CategoryId": 0,
"Category": null,
"Description": null,
"Value": null,
"ServiceResponsePropertyId": 0,
"MappingId": 1,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
}
],
"ServiceResponsePropertyId": 481,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 0
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "ServiceStatus",
"Value": {
"StatusCode": 1,
"StatusDescription": "Ok",
"StatusDetail": "",
"RestServiceStatus": null,
"ServiceResource": null
},
"ServiceResponsePropertyId": 482,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 13818024,
"SortOrder": 0
},
{
"EstimateType": "Auction",
"CarId": 0,
"Id": 1,
"SourceId": 1,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Auction Estimate",
"Value": 189400.0,
"ServiceResponsePropertyId": 494,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"EstimateType": "Cost",
"CarId": 0,
"Id": 2,
"SourceId": 2,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Cost Estimate",
"Value": 238300.0,
"ServiceResponsePropertyId": 495,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"EstimateType": "Cost",
"CarId": 0,
"Id": 3,
"SourceId": 3,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Cost Estimate High",
"Value": 259800.0,
"ServiceResponsePropertyId": 496,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 3
},
{
"EstimateType": "Cost",
"CarId": 0,
"Id": 4,
"SourceId": 4,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Cost Estimate Low",
"Value": 218700.0,
"ServiceResponsePropertyId": 497,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 2
},
{
"EstimateType": "Retail",
"CarId": 0,
"Id": 5,
"SourceId": 5,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Retail Estimate",
"Value": 300800.0,
"ServiceResponsePropertyId": 498,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"EstimateType": "Retail",
"CarId": 0,
"Id": 6,
"SourceId": 6,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Retail Estimate High",
"Value": 327900.0,
"ServiceResponsePropertyId": 499,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 3
},
{
"EstimateType": "Retail",
"CarId": 0,
"Id": 7,
"SourceId": 7,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Retail Estimate Low",
"Value": 276000.0,
"ServiceResponsePropertyId": 500,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 2
},
{
"EstimateType": "Trade",
"CarId": 0,
"Id": 8,
"SourceId": 8,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Trade Estimate",
"Value": 261300.0,
"ServiceResponsePropertyId": 501,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 1
},
{
"EstimateType": "Trade",
"CarId": 0,
"Id": 9,
"SourceId": 9,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Trade Estimate High",
"Value": 284900.0,
"ServiceResponsePropertyId": 502,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 3
},
{
"EstimateType": "Trade",
"CarId": 0,
"Id": 10,
"SourceId": 10,
"ServiceId": 12,
"CategoryId": 5,
"Category": "Valuation",
"Description": "Trade Estimate Low",
"Value": 239800.0,
"ServiceResponsePropertyId": 503,
"MappingId": 0,
"IsVisible": true,
"PackageRequestId": 13818024,
"SortOrder": 2
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 11,
"CategoryId": 7,
"Category": "Report",
"Description": "ReportUrl",
"Value": "https://pdf.lightstoneauto.co.za/Index.aspx?sourceurl=https://cdn.lightstoneauto.co.za/REPORTS/LIVE/ba22673b-0f05-4ae9-b212-0369a7c793ad.html",
"ServiceResponsePropertyId": 0,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
},
{
"Id": 0,
"SourceId": 0,
"ServiceId": 11,
"CategoryId": 7,
"Category": "Report",
"Description": "HtmlUrl",
"Value": "https://cdn.lightstoneauto.co.za/REPORTS/LIVE/ba22673b-0f05-4ae9-b212-0369a7c793ad.html",
"ServiceResponsePropertyId": 0,
"MappingId": 0,
"IsVisible": false,
"PackageRequestId": 0,
"SortOrder": 0
}
]
I want to show only type "Value" on the UI, so can anyone assist on how can I create the model class with this json data then show the "Value" on a list or text so can anyone please help on how do I go about this?? I have stuck for a while now. Your help will be appreciated, thanks in advance.
class DartClass {
int? id;
int? sourceId;
int? serviceId;
int? categoryId;
String? category;
String? description;
dynamic value;
int? serviceResponsePropertyId;
int? mappingId;
bool? isVisible;
int? packageRequestId;
int? sortOrder;
DartClass(
{this.id,
this.sourceId,
this.serviceId,
this.categoryId,
this.category,
this.description,
this.value,
this.serviceResponsePropertyId,
this.mappingId,
this.isVisible,
this.packageRequestId,
this.sortOrder});
DartClass.fromJson(Map<String, dynamic> json) {
id = json['Id'];
sourceId = json['SourceId'];
serviceId = json['ServiceId'];
categoryId = json['CategoryId'];
category = json['Category'];
description = json['Description'];
value = json['Value'];
serviceResponsePropertyId = json['ServiceResponsePropertyId'];
mappingId = json['MappingId'];
isVisible = json['IsVisible'];
packageRequestId = json['PackageRequestId'];
sortOrder = json['SortOrder'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = {};
data['Id'] = id;
data['SourceId'] = sourceId;
data['ServiceId'] = serviceId;
data['CategoryId'] = categoryId;
data['Category'] = category;
data['Description'] = description;
data['Value'] = value;
data['ServiceResponsePropertyId'] = serviceResponsePropertyId;
data['MappingId'] = mappingId;
data['IsVisible'] = isVisible;
data['PackageRequestId'] = packageRequestId;
data['SortOrder'] = sortOrder;
return data;
}
}

Vegalite: pie chart not aggregating together

I have a json date values that I'm adding to the vega-lite for visualization in pie chart. The legends seem to render properly (there's 2 distinct legends for 2020 q3 and 2020 q4). But the pie chart itself doesn't seem to aggregate together. How would I make sure that all the 2020Q4 are grouping together? How do I fix my spec??
pie chart with no aggregation for same data
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 880,
"height": 376,
"config": {
"range": {
"category": {
"scheme": "tableau20"
}
},
"legend": {
"labelColor": "#333",
"labelFontSize": 11,
"symbolSize": 30,
"symbolType": "circle",
"symbolStrokeWidth": 0,
"titleColor": "#333",
"titleFontSize": 14,
"titlePadding": 10,
"titleFontWeight": 500
},
"autosize": {
"type": "fit",
"contains": "padding"
},
"font": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"",
"axisLeft": {
"labelFontSize": 14,
"labelColor": "#333",
"labelLimit": 180,
"titleFontSize": 16,
"titleLimit": 180
},
"style": {
"label": {
"align": "left",
"baseline": "middle",
"dx": 4
},
"cell": {
"stroke": "transparent"
}
}
},
"layer": [
{
"mark": {
"type": "arc",
"innerRadius": {
"expr": "min(width,height)/5"
},
"outerRadius": {
"expr": "min(width,height)/4"
},
"tooltip": true,
"padAngle": 0.01
},
"params": [
{
"name": "highlight",
"select": {
"type": "point",
"on": "mouseover"
}
},
{
"name": "select",
"select": "point"
}
]
},
{
"mark": {
"type": "text",
"radius": {
"expr": "min(width,height)/4+min(width,height)/5/2"
},
"stroke": "#666666",
"limit": {
"expr": "min(width,height)/5"
}
},
"encoding": {
"text": {
"field": "color",
"title": "Due date",
"type": "nominal",
"timeUnit": "yearquarter"
}
}
}
],
"encoding": {
"color": {
"field": "color",
"title": "Due date",
"type": "nominal",
"timeUnit": "yearquarter"
},
"theta": {
"field": "thetaAggregated",
"type": "quantitative",
"title": "Values",
"stack": true
},
"fillOpacity": {
"condition": [
{
"param": "select",
"value": 1
}
],
"value": 0.3
}
},
"transform": [
{
"calculate": "datetime(datum.color.year, datum.color.month, datum.color.date)",
"as": "color"
},
{
"joinaggregate": [
{
"op": "count",
"field": "theta",
"as": "thetaAggregated"
}
],
"groupby": [
"color"
]
}
],
"data": {
"values": [
{
"color": {
"year": 2020,
"month": 9,
"date": 30,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "rec79Wjae6P45XNpl"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 20,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recrQaNcIH4wueWrT"
},
{
"color": {
"year": 2020,
"month": 8,
"date": 29,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recwVzB5CNu0E6x9J"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 25,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recp8FrOTOgSqQlxV"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 5,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recpgd5QYGyHPz6oC"
},
{
"color": {
"year": 2020,
"month": 10,
"date": 7,
"hours": 16,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recerFXuq7ply21Ba"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 18,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recNfz0B2qasVXfwS"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 12,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recriiVtRVuueAwTP"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 19,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recbGumPg7L28cUrh"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 26,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recrhgU6BXOBYY8F4"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 31,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recJzAP0NPlzck0aa"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 32,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "rec2spYZGJTOnq32F"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 17,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recldmzqvJhcZ9oqy"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 25,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recegvuNEeNoSyyMT"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 4,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recDwkAeTWQ9KzDXS"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 9,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recKTwDYDpXsKAiAC"
}
]
}
}
Instead of joinaggregate, you can use aggregate transform as it will help you to generate new data set which you can utilize for the values pie chart. Simply convert the color values using calculate and expressions and then perform aggregation.
Below is the code snippet or refer editor:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"width": 880,
"height": 376,
"config": {
"range": {"category": {"scheme": "tableau20"}},
"legend": {
"labelColor": "#333",
"labelFontSize": 11,
"symbolSize": 30,
"symbolType": "circle",
"symbolStrokeWidth": 0,
"titleColor": "#333",
"titleFontSize": 14,
"titlePadding": 10,
"titleFontWeight": 500
},
"autosize": {"type": "fit", "contains": "padding"},
"font": "-apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, Helvetica, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Segoe UI Symbol\"",
"axisLeft": {
"labelFontSize": 14,
"labelColor": "#333",
"labelLimit": 180,
"titleFontSize": 16,
"titleLimit": 180
},
"style": {
"label": {"align": "left", "baseline": "middle", "dx": 4},
"cell": {"stroke": "transparent"}
}
},
"layer": [
{
"mark": {
"type": "arc",
"innerRadius": {"expr": "min(width,height)/5"},
"outerRadius": {"expr": "min(width,height)/4"},
"tooltip": true,
"padAngle": 0.01
},
"params": [
{"name": "highlight", "select": {"type": "point", "on": "mouseover"}},
{"name": "select", "select": "point"}
]
},
{
"mark": {
"type": "text",
"stroke": "#666666",
"radius": {"expr": "min(width,height)/4+min(width,height)/5/2"},
"limit": {"expr": "min(width,height)/5"}
},
"encoding": {
"text": {"field": "quarterTime", "title": "Due date", "type": "nominal"}
}
}
],
"encoding": {
"color": {"field": "quarterTime", "title": "Due date", "type": "nominal"},
"theta": {
"field": "thetaAggregated",
"type": "quantitative",
"title": "Values",
"stack": true
},
"fillOpacity": {
"condition": [{"param": "select", "value": 1}],
"value": 0.3
}
},
"transform": [
{
"calculate": "datetime(datum.color.year, datum.color.month, datum.color.date)",
"as": "color"
},
{"calculate": "timeFormat(datum.color,'%Y Q%q')", "as": "quarterTime"},
{
"aggregate": [{"op": "count", "field": "theta", "as": "thetaAggregated"}],
"groupby": ["quarterTime"]
}
],
"data": {
"values": [
{
"color": {
"year": 2020,
"month": 9,
"date": 30,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "rec79Wjae6P45XNpl"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 20,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recrQaNcIH4wueWrT"
},
{
"color": {
"year": 2020,
"month": 8,
"date": 29,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recwVzB5CNu0E6x9J"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 25,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recp8FrOTOgSqQlxV"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 5,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recpgd5QYGyHPz6oC"
},
{
"color": {
"year": 2020,
"month": 10,
"date": 7,
"hours": 16,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recerFXuq7ply21Ba"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 18,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recNfz0B2qasVXfwS"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 12,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recriiVtRVuueAwTP"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 19,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recbGumPg7L28cUrh"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 26,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recrhgU6BXOBYY8F4"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 31,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recJzAP0NPlzck0aa"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 32,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "rec2spYZGJTOnq32F"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 17,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recldmzqvJhcZ9oqy"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 25,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recegvuNEeNoSyyMT"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 4,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recDwkAeTWQ9KzDXS"
},
{
"color": {
"year": 2020,
"month": 9,
"date": 9,
"hours": 17,
"minutes": 0,
"seconds": 0,
"milliseconds": 0
},
"theta": "recKTwDYDpXsKAiAC"
}
]
}
}

Vega does not correctly read timestamps from python `time.time()`

I have the following vega chart:
{
"$schema": "https://vega.github.io/schema/vega-lite/v5.json",
"data": {
"name": "data",
"values": [
{
"action_hidden_size": 128,
"async_envs": true,
"charts_path": "charts/sweep",
"entropy_coef": 0.01,
"env": "BreakoutNoFrameskip-v0",
"episode length": 168.8265306122449,
"episode return": 1.0714285714285714,
"epsilon": 0.0001,
"fps": 427.7912197785782,
"gamma": 0.99,
"gpt": "1558M",
"gradient norm": 0.04117301106452942,
"jit": true,
"lambda_": 1,
"learning_rate": 0.0009,
"log_interval": 100,
"log_level": "INFO",
"logger": "hasura",
"loss": -0.028508108109235764,
"num_envs": 16,
"num_steps": 5,
"resnet": false,
"rnn": false,
"run ID": 1459,
"seed": 0,
"step": 64000,
"subcommand": "sweep",
"sweep_id": 19,
"time": 1625243790.698869,
"training_steps": -1
},
{
"action_hidden_size": 64,
"async_envs": true,
"charts_path": "charts/sweep",
"entropy_coef": 0.01,
"env": "BreakoutNoFrameskip-v0",
"episode length": 178.2111111111111,
"episode return": 1.288888888888889,
"epsilon": 0.00001,
"fps": 437.3014892700601,
"gamma": 0.99,
"gpt": "1558M",
"gradient norm": 0.0920964702963829,
"jit": true,
"lambda_": 1,
"learning_rate": 0.0005,
"log_interval": 100,
"log_level": "INFO",
"logger": "hasura",
"loss": 0.008676287718117237,
"num_envs": 16,
"num_steps": 10,
"resnet": false,
"rnn": false,
"run ID": 1456,
"seed": 0,
"step": 64000,
"subcommand": "sweep",
"sweep_id": 23,
"time": 1625243788.6341043,
"training_steps": -1
},
{
"action_hidden_size": 64,
"async_envs": true,
"charts_path": "charts/sweep",
"entropy_coef": 0.01,
"env": "BreakoutNoFrameskip-v0",
"episode length": 178.75581395348837,
"episode return": 1.430232558139535,
"epsilon": 0.00001,
"fps": 462.03207466360925,
"gamma": 0.99,
"gpt": "1558M",
"gradient norm": 0.041478127241134644,
"jit": true,
"lambda_": 1,
"learning_rate": 0.0005,
"log_interval": 100,
"log_level": "INFO",
"logger": "hasura",
"loss": 0.0075914873741567135,
"num_envs": 16,
"num_steps": 10,
"resnet": false,
"rnn": false,
"run ID": 1452,
"seed": 0,
"step": 64000,
"subcommand": "sweep",
"sweep_id": 23,
"time": 1625243776.3521159,
"training_steps": -1
},
{
"action_hidden_size": 128,
"async_envs": true,
"charts_path": "charts/sweep",
"entropy_coef": 0.01,
"env": "BreakoutNoFrameskip-v0",
"episode length": 161.39583333333334,
"episode return": 0.9166666666666666,
"epsilon": 0.0001,
"fps": 271.2519726477831,
"gamma": 0.99,
"gpt": "1558M",
"gradient norm": 0.0941310003399849,
"jit": true,
"lambda_": 1,
"learning_rate": 0.0009,
"log_interval": 100,
"log_level": "INFO",
"logger": "hasura",
"loss": -0.025099074468016624,
"num_envs": 16,
"num_steps": 5,
"resnet": false,
"rnn": false,
"run ID": 1455,
"seed": 0,
"step": 32000,
"subcommand": "sweep",
"sweep_id": 19,
"time": 1625243760.262077,
"training_steps": -1
},
{
"action_hidden_size": 128,
"async_envs": true,
"charts_path": "charts/sweep",
"entropy_coef": 0.01,
"env": "BreakoutNoFrameskip-v0",
"episode length": 156.8181818181818,
"episode return": 0.8863636363636364,
"epsilon": 0.0001,
"fps": 279.50948832177323,
"gamma": 0.99,
"gpt": "1558M",
"gradient norm": 0.06209081411361694,
"jit": true,
"lambda_": 1,
"learning_rate": 0.0009,
"log_interval": 100,
"log_level": "INFO",
"logger": "hasura",
"loss": -0.02385426126420498,
"num_envs": 16,
"num_steps": 5,
"resnet": false,
"rnn": false,
"run ID": 1459,
"seed": 0,
"step": 32000,
"subcommand": "sweep",
"sweep_id": 19,
"time": 1625243755.579455,
"training_steps": -1
}
]
},
"encoding": {
"x": {
"type": "temporal",
"field": "time"
},
"y": {
"type": "quantitative",
"field": "episode return"
},
"color": {
"type": "nominal",
"field": "run ID"
}
},
"height": 400,
"mark": "line",
"width": 600
}
Here is a link to a vega editor with this chart.
As you can see, the time-stamps do not appear to be rendering correctly. The "time" fields are derived from python's time.time() method. Should I be using a different format?
According to the documentation, vega should accept a "a timestamp number (e.g., 1552199579097)` for "temporal" fields.
I've also looked at this issue which seems to indicate that this should work in the latest Vega, although per that issue, I am not sure if I need a field along the lines of
"format": {
"parse": {
"date": "number"
}
}
Thank you.
Python's time.time() returns a timestamp in seconds since the zero epoch.
Javascript timestamps are expected to be in milliseconds since the zero epoch.
So, to correctly use Python timestamps in vega-lite charts, you'll have to multiply them by 10^6:
"transform": [
{"calculate": "1000000 * datum.time", "as": "time"}
],

Get the codec_name of a specific stream

I need to extract the codec_name of the second video stream (artwork) of a video file.
So I do this :
$ ffprobe -hide_banner -v error -show_streams -of json Resurrection_Sunday_Online_Experience_12_April_2020_5.30pm_New_Creation_Church.mp4 | jq . > ffmpeg_output.json
The json file look like this :
$ cat ffmpeg_output.json
{
"streams": [
{
"index": 0,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Main",
"codec_type": "video",
"codec_time_base": "1411877/84712500",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 854,
"height": 480,
"coded_width": 864,
"coded_height": 480,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "427:240",
"pix_fmt": "yuv420p",
"level": 31,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"refs": 1,
"is_avc": "true",
"nal_length_size": "4",
"r_frame_rate": "30/1",
"avg_frame_rate": "42356250/1411877",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 677700960,
"duration": "7530.010667",
"bit_rate": "387395",
"bits_per_raw_sample": "8",
"nb_frames": "225900",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "und",
"handler_name": "VideoHandler"
}
},
{
"index": 1,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "-1",
"codec_type": "audio",
"codec_time_base": "1/48000",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "48000",
"channels": 2,
"channel_layout": "stereo",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/48000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 361441280,
"duration": "7530.026667",
"bit_rate": "125374",
"max_bit_rate": "129296",
"nb_frames": "352970",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0,
"timed_thumbnails": 0
},
"tags": {
"language": "und",
"handler_name": "SoundHandler"
}
},
{
"index": 2,
"codec_name": "mjpeg",
"codec_long_name": "Motion JPEG",
"profile": "192",
"codec_type": "video",
"codec_time_base": "0/1",
"codec_tag_string": "[0][0][0][0]",
"codec_tag": "0x0000",
"width": 1280,
"height": 720,
"coded_width": 1280,
"coded_height": 720,
"has_b_frames": 0,
"sample_aspect_ratio": "1:1",
"display_aspect_ratio": "16:9",
"pix_fmt": "yuvj420p",
"level": -99,
"color_range": "pc",
"color_space": "bt470bg",
"chroma_location": "center",
"refs": 1,
"r_frame_rate": "90000/1",
"avg_frame_rate": "0/0",
"time_base": "1/90000",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 677702430,
"duration": "7530.027000",
"bits_per_raw_sample": "8",
"disposition": {
"default": 0,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 1,
"timed_thumbnails": 0
}
}
]
}
I tried this but it does not extract the codec_name properly
$ cat ffmpeg_output.json | jq '[select(.streams[].codec_type=="video")][1].codec_name'
null
I also noticed it selected all the streams :
$ cat ffmpeg_output.json | jq '[select(.streams[].codec_type=="video")][1]' | grep codec_type
"codec_type": "video",
"codec_type": "audio",
"codec_type": "video",
Can you help me ?
Your jq filter is simply incorrect. Your select() expression is wrong. Remember the select() expression returns a Boolean value and your condition .streams[].codec_type=="video" is asserted true for two of the provided input objects i.e. for streams with "index": 0 and "index": 2, and for each of these true conditions, the filter prints all the 3 objects i.e. replicates the whole JSON because the select() was at the top level.
You need to make the select() after .streams
.streams[] | select(.codec_type=="video").codec_name
For selecting a object at a specific index, use the standard array notation .[0], .[1]
[ .streams[] | select(.codec_type=="video") ][1] | .codec_name
You don't need JQ for this particular case.
$ ffprobe -hide_banner -v error -of compact=nk=1:p=0 -select_streams v:1 -show_entries stream=codec_name video.mp4
h264

How to extract loadingExperience and originLoadingExperience timings & percentage from google pagespeedinsights api json data?

I am trying to develop an application which uses google Pagespeedinsights API as the backend. When i am running the pagespeedinsights for a particular url using the command curl https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url=desired url i am getting a json data as the response.
Sample JSON response
{
"captchaResult": "CAPTCHA_NOT_NEEDED",
"kind": "pagespeedonline#result",
"id": "https://jsonlint.com/",
"loadingExperience": {
"id": "https://jsonlint.com/",
"metrics": {
"FIRST_INPUT_DELAY_MS": {
"percentile": 98,
"distributions": [
{
"min": 0,
"max": 50,
"proportion": 0.9191070896432152
},
{
"min": 50,
"max": 250,
"proportion": 0.05804188226370113
},
{
"min": 250,
"proportion": 0.022851028093083734
}
],
"category": "AVERAGE"
},
"FIRST_CONTENTFUL_PAINT_MS": {
"percentile": 2784,
"distributions": [
{
"min": 0,
"max": 1000,
"proportion": 0.5647038808001577
},
{
"min": 1000,
"max": 2500,
"proportion": 0.3140323071688247
},
{
"min": 2500,
"proportion": 0.12126381203101773
}
],
"category": "SLOW"
}
},
"overall_category": "SLOW",
"initial_url": "https://jsonlint.com/"
},
"originLoadingExperience": {
"id": "https://jsonlint.com",
"metrics": {
"FIRST_INPUT_DELAY_MS": {
"percentile": 98,
"distributions": [
{
"min": 0,
"max": 50,
"proportion": 0.9194600615254058
},
{
"min": 50,
"max": 250,
"proportion": 0.05766680810438103
},
{
"min": 250,
"proportion": 0.022873130370213216
}
],
"category": "AVERAGE"
},
"FIRST_CONTENTFUL_PAINT_MS": {
"percentile": 2774,
"distributions": [
{
"min": 0,
"max": 1000,
"proportion": 0.5685563670116814
},
{
"min": 1000,
"max": 2500,
"proportion": 0.3111175327063521
},
{
"min": 2500,
"proportion": 0.1203261002819664
}
],
"category": "SLOW"
}
},
"overall_category": "SLOW",
"initial_url": "https://jsonlint.com/"
}
I am doing it programatically.
String pythonScript = "import os\n" + "os.system(\"curl https://www.googleapis.com/pagespeedonline/v5/runPagespeed?url="+pageSpeedMetrics.getCompanyUrl()+" > "+PYTHON_FILE_LOCATION+fileName+"\")";
BufferedWriter out = new BufferedWriter(new FileWriter(PYTHON_FILE_LOCATION.concat(PAGESPEEDINSIGHT_PYTHON_FILE_NAME)));
out.write(pythonScript);
out.close();
System.out.println(pythonScript);
Process p = r.exec("python "+PYTHON_FILE_LOCATION.concat(PAGESPEEDINSIGHT_PYTHON_FILE_NAME)+"");
p.waitFor();
JSONObject json = new JSONObject();
json.put("crux_loading_experience", jsonPagespeedInsight.getJSONObject("loadingExperience"));
json.put("crux_origin_loading_experience", jsonPagespeedInsight.getJSONObject("originLoadingExperience"));
But when i am doing it online using https://developers.google.com/speed/pagespeed/insights/ i can see the FCP & FID timing & percentage values , but in json file it is not there . How is it generated ?
Thanks in advance !!!