All Projects → Nordstrom → serverless-lighthouse-template

Nordstrom / serverless-lighthouse-template

Licence: other
Run lighthouse audits from headless chrome in lambda.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to serverless-lighthouse-template

datadog-sidekiq
A Rust app to track Sidekiq enqueued & processed jobs in Datadog
Stars: ✭ 14 (-44%)
Mutual labels:  datadog, datadog-metrics
Puppeteer Functions
Puppeteer Firebase Functions demo
Stars: ✭ 75 (+200%)
Mutual labels:  example, headless-chrome
python-in-browser
🐍🛥🌟 Running Python in the browser with Batavia and Starlette
Stars: ✭ 12 (-52%)
Mutual labels:  example
kuberbs
K8s deployment rollback system based on system observability principles of modern stacks
Stars: ✭ 61 (+144%)
Mutual labels:  datadog
datadog-smartmon
DataDog plugin to report hard drive metrics
Stars: ✭ 15 (-40%)
Mutual labels:  datadog
vue-vuex-todomvc
Example TodoMVC Vue.js app with Vuex store and server backend via REST
Stars: ✭ 41 (+64%)
Mutual labels:  example
Agora-C Sharp-SDK
The simple ways to use Agora RTC SDK with C#
Stars: ✭ 18 (-28%)
Mutual labels:  example
auth0-instrumentation
The goal of this package is to make it easier to collect information about our services through logs, metrics and error catching.
Stars: ✭ 18 (-28%)
Mutual labels:  datadog
mooseware
💀 Skeleton for writing a middleware handler
Stars: ✭ 47 (+88%)
Mutual labels:  example
mocking-with-jest
API Testing with Jest
Stars: ✭ 41 (+64%)
Mutual labels:  example
EnttPong
Built for EnTT, at the request of the developer as a demo.
Stars: ✭ 51 (+104%)
Mutual labels:  example
thal
译文:Puppeteer 与 Chrome Headless —— 从入门到爬虫
Stars: ✭ 651 (+2504%)
Mutual labels:  headless-chrome
document-server-integration
Examples on how to integrate ONLYOFFICE Document Server into your own website or application
Stars: ✭ 68 (+172%)
Mutual labels:  example
ddd-example-ecommerce
Domain-driven design example in Java with Spring framework
Stars: ✭ 73 (+192%)
Mutual labels:  example
haskell-tic-tac-toe
A multiplayer web real-time implementation of the famous Tic Tac Toe game in Haskell.
Stars: ✭ 51 (+104%)
Mutual labels:  example
apollo-link-tracer
Trace your apollo queries and mutations with https://github.com/apollographql/apollo-link
Stars: ✭ 20 (-20%)
Mutual labels:  datadog
dog-statsd
🐶 DataDog StatsD Client
Stars: ✭ 38 (+52%)
Mutual labels:  datadog
node-opencv-templatematching-test
Test for template matching using node-opencv
Stars: ✭ 20 (-20%)
Mutual labels:  example
golang-cognito-example
Golang example of using AWS Cognito APIs (Register, Login, Verify Phone, Refresh token)
Stars: ✭ 74 (+196%)
Mutual labels:  example
discord-giveaways-bot
🎁Giveways Bot using the discord-giveaways package
Stars: ✭ 118 (+372%)
Mutual labels:  example

Serverless Lighthouse

Using headless Chrome and Lambda, Serverless Lighthouse analyzes web apps and web pages, collecting modern performance metrics and insights on developer best practices.

Deployment

Install the required packages.

npm install --global serverless
npm install --save lighthouse
npm install --save serverless-plugin-chrome
npm install --save-dev serverless-attach-managed-policy

Once the packages are installed you must set your AWS credentials by defining AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environmental variables, or using an AWS profile. You can read more about this on the Serverless Credentials Guide.

In short, either:

export AWS_PROFILE=<your-profile-name>

or

export AWS_ACCESS_KEY_ID=<your-key-here>
export AWS_SECRET_ACCESS_KEY=<your-secret-key-here>

Then, to deploy the service and all of its functions:

serverless deploy -v

Use this to quickly upload and overwrite your AWS Lambda code on AWS, allowing you to develop faster.

serverless deploy function -f auditor

Usage

You can easily add a target to be audited and manipulate the performance data.

Setting up a test.

By adding in some serverless configs you can create a desktop or mobile audit target.

functions:
  auditor:
    handler: handler.audit
    events:
      - schedule:
          name: lighthouse-audit-trigger
          description: 'Audit the input target.'
          rate: rate(5 minutes)
          enabled: true
          input:
            target: https://www.example.com/
            mobile: false

This will create a desktop audit of "https://www.example.com/" and will run every 5 minutes.

Manipulate Performance Data

The output of the audit is a json blob that is anywhere from 30mb to 80mb in size. This can be saved off to a file and loaded in the Lighthouse Viewer at a later time.

You can use Lighthouse programmatically and manipulate the json blob

lighthouse(url, flags).then(function(results) {
  console.log('timestamp: ' + results.generatedTime)
  console.log('target: ' + results.url)
  console.log('total-time: ' + results.timing.total)
  console.log('score: ' + results.score)
})

Docs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].