Skip to content

Commit 173fd76

Browse files
authored
Merge pull request #74 from foomo/feature/remove-pwa
Remove Deprecated PWA Category
2 parents 1c00d2d + 5d8295a commit 173fd76

File tree

7 files changed

+13
-104
lines changed

7 files changed

+13
-104
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ Or via JSON which adds additional parameters
6464
// URL can't be invalid
6565
// Strategy can only be mobile/desktop
6666
// If strategy is not specified, both desktop & mobile will be used
67-
// Categories can be any of accessibility/best-practices/performance/pwa/seo
67+
// Categories can be any of accessibility/best-practices/performance/seo
6868
// If categories are not specified, all categories will be used
6969
// Parameters are passed down to google pagespeed api
7070
@@ -86,7 +86,7 @@ Configuration of targets can be done via docker and via prometheus
8686
|------------------|----------------------|-----------------------------------------------|----------------------------------------------------------------------|----------|
8787
| -api-key | PAGESPEED_API_KEY | sets the google API key used for pagespeed | | False |
8888
| -targets | PAGESPEED_TARGETS | comma separated list of targets to measure | | False |
89-
| -categories | PAGESPEED_CATEGORIES | comma separated list of categories to check | accessibility,best-practices,performance,pwa,seo | False |
89+
| -categories | PAGESPEED_CATEGORIES | comma separated list of categories to check | accessibility,best-practices,performance,seo | False |
9090
| -t | NONE | multi-value target array (check docker comp) | | False |
9191
| -listener | PAGESPEED_LISTENER | sets the listener address for the exporters | :9271 | False |
9292
| -parallel | PAGESPEED_PARALLEL | sets the execution of targets to be parallel | false | False |
@@ -145,7 +145,7 @@ or
145145
$ docker run -p "9271:9271" --rm \
146146
--env PAGESPEED_API_KEY={KEY} \
147147
--env PAGESPEED_TARGETS=https://google.com,https://prometheus.io \
148-
--env PAGESPEED_CATEGORIES=accessibility,pwa \
148+
--env PAGESPEED_CATEGORIES=accessibility,seo \
149149
foomo/pagespeed_exporter
150150
```
151151

collector/collector.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ func collectLighthouseResults(prefix string, cats []string, lhr *pagespeedonline
177177
categories := map[string]*pagespeedonline.LighthouseCategoryV5{
178178
CategoryPerformance: lhr.Categories.Performance,
179179
CategoryAccessibility: lhr.Categories.Accessibility,
180-
CategoryPWA: lhr.Categories.Pwa,
181180
CategoryBestPractices: lhr.Categories.BestPractices,
182181
CategorySEO: lhr.Categories.Seo,
183182
}

collector/model.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const (
1515
CategoryAccessibility = "accessibility"
1616
CategoryBestPractices = "best-practices"
1717
CategorySEO = "seo"
18-
CategoryPWA = "pwa"
1918
CategoryPerformance = "performance"
2019

2120
Namespace = "pagespeed"
@@ -32,7 +31,6 @@ var availableCategories = map[string]bool{
3231
CategoryAccessibility: true,
3332
CategoryBestPractices: true,
3433
CategorySEO: true,
35-
CategoryPWA: true,
3634
CategoryPerformance: true,
3735
}
3836

collector/model_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
)
88

99
func TestCalculateScrapeRequests(t *testing.T) {
10-
allCategories := []string{"accessibility", "best-practices", "performance", "pwa", "seo"}
10+
allCategories := []string{"accessibility", "best-practices", "performance", "seo"}
1111

1212
tests := []struct {
1313
name string
@@ -27,9 +27,9 @@ func TestCalculateScrapeRequests(t *testing.T) {
2727
{Url: "http://test2.com", Strategy: StrategyDesktop, Categories: allCategories},
2828
{Url: "http://test2.com", Strategy: StrategyMobile, Categories: allCategories},
2929
}},
30-
{"single with categories", []string{"http://test.com"}, []string{"accessibility", "pwa"}, []ScrapeRequest{
31-
{Url: "http://test.com", Strategy: StrategyDesktop, Categories: []string{"accessibility", "pwa"}},
32-
{Url: "http://test.com", Strategy: StrategyMobile, Categories: []string{"accessibility", "pwa"}},
30+
{"single with categories", []string{"http://test.com"}, []string{"accessibility", "seo"}, []ScrapeRequest{
31+
{Url: "http://test.com", Strategy: StrategyDesktop, Categories: []string{"accessibility", "seo"}},
32+
{Url: "http://test.com", Strategy: StrategyMobile, Categories: []string{"accessibility", "seo"}},
3333
}},
3434
{"multiple with categories", []string{"http://test.com", "http://test2.com"}, []string{"best-practices"}, []ScrapeRequest{
3535
{Url: "http://test.com", Strategy: StrategyDesktop, Categories: []string{"best-practices"}},
@@ -51,14 +51,14 @@ func TestCalculateScrapeRequests(t *testing.T) {
5151
},
5252
}},
5353
{"json with category",
54-
[]string{`{"url":"http://test.com","strategy":"desktop","campaign":"campaign","source":"source","locale":"locale", "categories":["pwa"]}`}, nil, []ScrapeRequest{
54+
[]string{`{"url":"http://test.com","strategy":"desktop","campaign":"campaign","source":"source","locale":"locale", "categories":["seo"]}`}, nil, []ScrapeRequest{
5555
{
5656
Url: "http://test.com",
5757
Strategy: StrategyDesktop,
5858
Campaign: "campaign",
5959
Source: "source",
6060
Locale: "locale",
61-
Categories: []string{"pwa"},
61+
Categories: []string{"seo"},
6262
},
6363
}},
6464
{"json with wrong category",
@@ -92,7 +92,7 @@ func TestCalculateScrapeRequests(t *testing.T) {
9292
}
9393

9494
func TestPopulateCategories(t *testing.T) {
95-
allCategories := []string{"accessibility", "best-practices", "performance", "pwa", "seo"}
95+
allCategories := []string{"accessibility", "best-practices", "performance", "seo"}
9696

9797
tests := []struct {
9898
msg string
@@ -121,9 +121,9 @@ func TestPopulateCategories(t *testing.T) {
121121
{
122122
"input categories are set in request",
123123
&ScrapeRequest{},
124-
[]string{"best-practices", "pancake", "pwa"},
124+
[]string{"best-practices", "pancake", "seo"},
125125
&ScrapeRequest{
126-
Categories: []string{"best-practices", "pancake", "pwa"},
126+
Categories: []string{"best-practices", "pancake", "seo"},
127127
},
128128
},
129129
}

collector/scrape.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,6 @@ func (pss pagespeedScrapeService) scrape(request ScrapeRequest) (scrape *ScrapeR
118118
if err != nil {
119119
return nil, errors.Wrap(err, "could not initialize pagespeed service")
120120
}
121-
122121
call := service.Pagespeedapi.Runpagespeed(request.Url)
123122
call.Category(request.Categories...)
124123
call.Strategy(string(request.Strategy))

example/grafana/provisioning/dashboards/pagespeed.json

Lines changed: 0 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -309,93 +309,6 @@
309309
"transparent": true,
310310
"type": "gauge"
311311
},
312-
{
313-
"datasource": {
314-
"type": "prometheus",
315-
"uid": "${DS_PROMETHEUS}"
316-
},
317-
"description": "Lighthouse returns a Progressive Web App (PWA) score between 0 and 100. 0 is the worst possible score, and 100 is the best.\n\nThe PWA audits are based on the Baseline PWA Checklist, which lists 14 requirements. Lighthouse has automated audits for 11 of the 14 requirements. The remaining 3 can only be tested manually. Each of the 11 automated PWA audits are weighted equally, so each one contributes approximately 9 points to your PWA score.",
318-
"fieldConfig": {
319-
"defaults": {
320-
"color": {
321-
"mode": "thresholds"
322-
},
323-
"mappings": [
324-
{
325-
"options": {
326-
"match": "null",
327-
"result": {
328-
"text": "N/A"
329-
}
330-
},
331-
"type": "special"
332-
}
333-
],
334-
"max": 100,
335-
"min": 0,
336-
"thresholds": {
337-
"mode": "absolute",
338-
"steps": [
339-
{
340-
"color": "#d44a3a",
341-
"value": null
342-
},
343-
{
344-
"color": "rgba(237, 129, 40, 0.89)",
345-
"value": 50
346-
},
347-
{
348-
"color": "#299c46",
349-
"value": 90
350-
}
351-
]
352-
},
353-
"unit": "none"
354-
},
355-
"overrides": []
356-
},
357-
"gridPos": {
358-
"h": 4,
359-
"w": 4,
360-
"x": 12,
361-
"y": 1
362-
},
363-
"id": 13,
364-
"maxDataPoints": 100,
365-
"options": {
366-
"minVizHeight": 75,
367-
"minVizWidth": 75,
368-
"orientation": "horizontal",
369-
"reduceOptions": {
370-
"calcs": [
371-
"lastNotNull"
372-
],
373-
"fields": "",
374-
"values": false
375-
},
376-
"showThresholdLabels": false,
377-
"showThresholdMarkers": true,
378-
"sizing": "auto"
379-
},
380-
"pluginVersion": "10.4.3",
381-
"repeatDirection": "h",
382-
"targets": [
383-
{
384-
"datasource": {
385-
"type": "prometheus",
386-
"uid": "${DS_PROMETHEUS}"
387-
},
388-
"expr": "pagespeed_lighthouse_category_score{host=\"$host\",path=\"$path\",strategy=\"$strategy\",category=\"pwa\"} * 100",
389-
"format": "time_series",
390-
"intervalFactor": 1,
391-
"legendFormat": "",
392-
"refId": "A"
393-
}
394-
],
395-
"title": "PWA Score",
396-
"transparent": true,
397-
"type": "gauge"
398-
},
399312
{
400313
"datasource": {
401314
"type": "prometheus",

pagespeed_exporter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func parseFlags() {
9494
flag.StringVar(&pushGatewayUrl, "pushGatewayUrl", getenv("PUSHGATEWAY_URL", ""), "sets the push gateway to send the metrics. leave empty to ignore it")
9595
flag.StringVar(&pushGatewayJob, "pushGatewayJob", getenv("PUSHGATEWAY_JOB", "pagespeed_exporter"), "sets push gateway job name")
9696
targetsFlag := flag.String("targets", getenv("PAGESPEED_TARGETS", ""), "comma separated list of targets to measure")
97-
categoriesFlag := flag.String("categories", getenv("PAGESPEED_CATEGORIES", "accessibility,best-practices,performance,pwa,seo"), "comma separated list of categories. overridden by categories in JSON targets")
97+
categoriesFlag := flag.String("categories", getenv("PAGESPEED_CATEGORIES", "accessibility,best-practices,performance,seo"), "comma separated list of categories. overridden by categories in JSON targets")
9898
flag.Var(&targets, "t", "multiple argument parameters")
9999
flag.Parse()
100100

0 commit comments

Comments
 (0)