Skip to main content

Wagtail Metrics

Project description

https://img.shields.io/pypi/v/wagtail_metrics https://img.shields.io/pypi/pyversions/wagtail_metrics

Wagtail Metrics allows you to retrieve information about Wagtail pages.

Information providers for Wagtail pages are :

  • wagtail_page : retrieves all fields and blocks

  • request : get the HTTP status code of Wagtail pages

  • google_page_speed : collects scores on performance, accessibility, best practices and SEO

Usage

You can use Wagtail Metrics like this :

from wagtail.core.models import Site
from wagtail_metrics.checkup import Checkup

checkup = Checkup(providers=[
        'wagtail_page',
        'request',
        'google_page_speed'
])
for site in Site.objects.all():
    checkup.add_site(site)
checkup_json = checkup.to_json()

checkup_json is equal to :

{
    "stream_field__block__title": {
        "counter": 3,
        "values": {
            "generic title": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "stream_field__block__description": {
        "counter": 3,
        "values": {
            "different description 1": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "different description 2": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "different description 3": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "locale": {
        "counter": 3,
        "values": {
            "french": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "title": {
        "counter": 3,
        "values": {
            "Home": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "CMS": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "Wagtail": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "slug": {
        "counter": 3,
        "values": {
            "home": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "cms": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "wagtail": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "live": {
        "counter": 3,
        "values": {
            "true": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "owner": {
        "counter": 3,
        "values": {
            "none": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "seo_title": {
        "counter": 3,
        "values": {
            "": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "show_in_menus": {
        "counter": 3,
        "values": {
            "false": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "search_description": {
        "counter": 3,
        "values": {
            "": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "first_published_at": {
        "counter": 3,
        "values": {
            "none": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "last_published_at": {
        "counter": 3,
        "values": {
            "none": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "char_field": {
        "counter": 3,
        "values": {
            "Test char field": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "request__status_code": {
        "counter": 3,
        "values": {
            "200": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page_speed__performance": {
        "counter": 3,
        "values": {
            "99": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/"
                ]
            },
            "84": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/"
                ]
            },
            "75": {
                "counter": 1,
                "pages": [
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page_speed__accessibility": {
        "counter": 3,
        "values": {
            "95": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page_speed__best_practices": {
        "counter": 3,
        "values": {
            "100": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "google_page__speed_seo": {
        "counter": 3,
        "values": {
            "100": {
                "counter": 3,
                "pages": [
                    "https://www.snoweb.io/fr/",
                    "https://www.snoweb.io/fr/cms/",
                    "https://www.snoweb.io/fr/cms/wagtail/"
                ]
            }
        }
    },
    "stream_field__block_never_used__title": {
        "counter": 0,
        "values": {}
    }
}

Setup

Install with pip :

pip install wagtail_metrics

Set if needed in Django settings :

# Default value
WAGTAIL_METRICS_DEFAULT_EXCLUDE = [
    'sites_rooted_here',
    'aliases',
    'revisions',
    'group_permissions',
    'view_restrictions',
    'workflow_states',
    'wagtail_admin_comments',
    'subscribers',
    'id',
    'path',
    'depth',
    'numchild',
    'translation_key',
    'draft_title',
    'has_unpublished_changes',
    'url_path',
    'go_live_at',
    'expire_at',
    'expired',
    'locked',
    'locked_at',
    'locked_by',
    'latest_revision_created_at',
    'live_revision',
    'alias_of',
    'page_ptr',
    'index_entries',
    'content_type'
]
WAGTAIL_METRICS_INDENT_JSON = 4
# For Google page speed
WAGTAIL_METRICS_GOOGLE_API_KEY = 'xxx'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail_metrics-0.0.11.tar.gz (24.6 kB view details)

Uploaded Source

Built Distribution

wagtail_metrics-0.0.11-py3-none-any.whl (27.7 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_metrics-0.0.11.tar.gz.

File metadata

  • Download URL: wagtail_metrics-0.0.11.tar.gz
  • Upload date:
  • Size: 24.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for wagtail_metrics-0.0.11.tar.gz
Algorithm Hash digest
SHA256 3cddd8de10f5d3b883a916cafa7fa15e63b605d96909f61a79000df914d16db0
MD5 d8a46130c4257757af9b0efddb7600e2
BLAKE2b-256 8231b0701cd7a35930ab8b9707d39a249edc04d91f88dcb080f1cb73e8d7c215

See more details on using hashes here.

File details

Details for the file wagtail_metrics-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: wagtail_metrics-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 27.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for wagtail_metrics-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 e4287a93a8e3a588c1c76d664e661cf482882fa6a4e21c62af94a26eda5b1681
MD5 7a7c0e4e0e48551b1ca6aadc9abc74ec
BLAKE2b-256 c76ae5ec9bd8edc776c5eb9f2defa1c92c92b693132cbe8498cef9bbb06e7930

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page