Try faultline to track your Node.js projects

Getting start $ git clone https://github.com/faultline/faultline.git $ cd faultline $ npm install Edit config. […]

広告ここから
広告ここまで

目次

    Getting start

    $ git clone https://github.com/faultline/faultline.git
    $ cd faultline
    $ npm install
    

    Edit config.yml

    config.default.yml

    # faultline service name
    serviceName: faultline
    # AWS deploy region
    region: ap-northeast-1
    # S3 bucket name
    s3BucketName: (EDITME)
    # Dynamodb table prefix
    dynamodbTablePrefix: faultline
    # Dynamodb Read Capacity Units
    dynamodbReadCapacityUnits: 1
    # Dynamodb Write Capacity Units
    dynamodbWriteCapacityUnits: 1
    # Error tracking count interval (year / month / day / hour / minute)
    timeunit: minute
    # faultline API Key for full control (!This is not API Gateway API Key!)
    masterApiKey: (EDITME)
    # faultline API Key for POST errors only (!This is not API Gateway API Key!)
    clientApiKey: (EDITME)
    # faultline error data Retention (days / -1 is unlimited)
    errorDataRetentionInDays: -1
    # faultline functions CloudWatchLogs Retention (days / -1 is unlimited)
    logRetentionInDays: 180
    # Use AWS KMS Key to encrypt POST params (notifications) ( 0 or 1 )
    useKms: 0
    # AWS KMS Key alias
    kmsKeyAlias: faultline
    

    config.yml example

    # faultline service name
    serviceName: faultline
    # AWS deploy region
    region: ap-northeast-1
    # S3 bucket name
    s3BucketName: faultline-test
    # Dynamodb table prefix
    dynamodbTablePrefix: faultline-test
    # Dynamodb Read Capacity Units
    dynamodbReadCapacityUnits: 1
    # Dynamodb Write Capacity Units
    dynamodbWriteCapacityUnits: 1
    # Error tracking count interval (year / month / day / hour / minute)
    timeunit: minute
    # faultline API Key for full control (!This is not API Gateway API Key!)
    masterApiKey: 0mTk4gTwbYgW
    # faultline API Key for POST errors only (!This is not API Gateway API Key!)
    clientApiKey: s4V63ZhO092a
    # faultline error data Retention (days / -1 is unlimited)
    errorDataRetentionInDays: -1
    # faultline functions CloudWatchLogs Retention (days / -1 is unlimited)
    logRetentionInDays: 180
    # Use AWS KMS Key to encrypt POST params (notifications) ( 0 or 1 )
    useKms: 1
    # AWS KMS Key alias
    kmsKeyAlias: faultline
    

    Deploy

    $ AWS_PROFILE=XXxxXXX npm run deploy
    ...
    CloudFormation - UPDATE_COMPLETE - AWS::CloudFormation::Stack - faultline-v0
    Serverless: Stack update finished...
    Service Information
    service: faultline
    stage: v0
    region: ap-northeast-1
    stack: faultline-v0
    api keys:
      None
    endpoints:
      GET - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects
      DELETE - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}
      POST - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors
      GET - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors
      GET - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors/{message}
      PATCH - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors/{message}
      DELETE - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors/{message}
      GET - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors/{message}/occurrences
      GET - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/projects/{project}/errors/{message}/occurrences/{reversedUnixtime}
      POST - https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0/encrypt
    functions:
      projectsList: faultline-v0-projectsList
      projectsDelete: faultline-v0-projectsDelete
      errorsPost: faultline-v0-errorsPost
      errorsList: faultline-v0-errorsList
      errorsGet: faultline-v0-errorsGet
      errorsPatch: faultline-v0-errorsPatch
      errorsDelete: faultline-v0-errorsDelete
      occurrencesList: faultline-v0-occurrencesList
      occurrencesGet: faultline-v0-occurrencesGet
      callNotifications: faultline-v0-callNotifications
      deleteExpiredErrors: faultline-v0-deleteExpiredErrors
      encrypt: faultline-v0-encrypt
    
    Stack Outputs
    ErrorsGetLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-errorsGet:1
    EncryptLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-encrypt:1
    ErrorsDeleteLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-errorsDelete:1
    OccurrencesListLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-occurrencesList:1
    ErrorsPatchLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-errorsPatch:1
    OccurrencesGetLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-occurrencesGet:1
    DeleteExpiredErrorsLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-deleteExpiredErrors:1
    ServerlessDeploymentBucketName: faultline-v0-serverlessdeploymentbucket-1spgr5g27e44a
    ProjectsDeleteLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-projectsDelete:1
    ProjectsListLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-projectsList:1
    ErrorsListLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-errorsList:1
    ErrorsPostLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-errorsPost:1
    CallNotificationsLambdaFunctionQualifiedArn: arn:aws:lambda:ap-northeast-1:999999999999:function:faultline-v0-callNotifications:1
    ServiceEndpoint: https://XXXXXXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0
    

    Send example data

    Make new directory to create example scripts.

    $ cd ../
    $ mkdir faultline-example
    $ cd faultline-example
    

    Init npm & install faultline-js.

    $ npm init -y
    $ npm install --save faultline-js
    

    Create example scripts

    var faultlineJs = require('faultline-js');
    var faultline = new faultlineJs({
                      project: 'faultline-js',
                      apiKey: 's4V63ZhO092a', // your clientApiKey
                      endpoint: 'https://XXXXXX.execute-api.ap-northeast-1.amazonaws.com/v0',
                      notifications: []
                    });
    faultline.notify('example');
    console.log('notification sent');
    

    Run examples

    $ node example.js 
    notification sent
    

    Setup web ui

    $ cd ../
    $ git clone [email protected]:faultline/faultline-webui.git
    $ cd faultline-webui
    $ npm install
    

    update config.js

    var config = {
        endpoint: 'https://XXXXX.execute-api.ap-northeast-1.amazonaws.com/v0', // faultline endpoint here
        masterApiKey: '0mTk4gTwbYgW' // faultline API Key, here
    };
    

    view

    $ open index.html
    

    広告ここから
    広告ここまで

    Random posts

    Home
    Search
    Bookmark