Giter Club home page Giter Club logo

of-fn-calls-per-period's Introduction

OpenFaaS - Functions call count per period

After having been using this this CLI project for a while I thought, why not turn it into a function?

The structure of this project is based on [OpenFaaS with MongoDB] (https://github.com/alexellis/mongodb-function) from @alexellisuk

Build locally

  1. Clone this repository
$ git clone https://github.com/padiazg/of-fn-calls-per-period.git
  1. Replace "padiazg/" prefix from Docker Hub in stack.yml with your own account

  2. Build/deploy Create new function, make sure to specify call-count as the name of your function.

$ faas-cli new call-count --lang node

Now you can build/deploy

faas-cli build && faas-cli deploy

Use directly from Docker Hub

of-fn-calls-per-period

  1. Create deploy.yml
provider:
  name: faas
  gateway: http://127.0.0.1:8080

functions:
  calls-per-period:
    image: padiazg/of-fn-calls-per-period
    environment:
      write_timeout: 10s
      read_timeout: 10s
      prometheus: http://your_prometheus_ip:9090
      timezone: America/Asuncion        # here you sould put your timezone
  1. Deploy with faas-cli Deploy your function using faas-cli
faas-cli deploy

Parameters:

Parameters must be passed in JSON format:
Examples:

{"start": "2018-03-30", "end": "2018-07-31"}
{"start": "2018-03-30", "end": "2018-07-31", "format": "json"}
{"start": "2018-03-30", "end": "2018-07-31", "step": "3h", "format": "table"}
  • start: Start day for the query (mandatory).
  • end: End day for the query (mandatory).
  • step: Period of time in wich the results are grouped.
  • format: Format of the output. Defaults to 'table'.
    Posible values are:
    • table
    • json

Examples

Output as ascii-table.

  • Select Text
  • Request body: {"start": "2018-03-30", "end": "2018-07-31"}

Output as JSON.

  • Select JSON
  • Request body: {"start": "2018-03-30", "end": "2018-07-31", "format": "json"}

of-fn-calls-per-period's People

Contributors

padiazg avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.