Code Monkey home page Code Monkey logo

overops-functions's Introduction

OverOps Functions

Public OverOps User Defined Functions

Full manifest of all libraries can be found here - https://git.io/fxDIW

Our Collection consists of two types of functions:

Anomaly Functions:

An Anomaly UDF is a function that would be used to determine whether the volume of specific events is considered anomalous by comparing it to a target threshold within a view/timeframe. Anomaly function will run periodically (the rate is adjustable - i.e. each 1/5/15... minutes) and search for anomalies. Read more about Anomaly functions at: https://doc.overops.com/docs/managing-and-creating-alerts#section-anomaly-functions.

Channel Functions:

The Function-alerting channel in “Alert Settings” screen enables to select a function to activate when alert is triggered. Read more about Channel functions at: https://doc.overops.com/docs/managing-and-creating-alerts#section-channel-functions.

List of UDF libraries in this repository:

Anomaly Functions

1. Relative Threshold -

Compare the event volume within the view against a target threshold and rate. The rate is defined as number of events / throughput. Throughput can set as the number of times the method containing the event was called, or the number of times the application thread calling into the event executed. See code at: https://git.io/fx6sl

2. Automatic Entry point Timers -

Automatically set timers on application entry points based on average runtime. See code at: https://git.io/fxiy0

3. Severity -

Mark events as New if they were introduced in an active deployment and are important. Mark events as Regressed if they have crossed a volume threshold against a previous timeframe. See code at: https://git.io/fxiSl

Channel Functions:

1. Routing -

Classify incoming events according to the functional component within the code (Code Tier) from which they originated. The classification will be done by adding a label to events which belong to the same Code Tier (for example - "aws.lambda", "Java-lang", "Network Errors", etc..) See code at: https://git.io/fx6s8

2. Apply Label -

Applies a specific input label to events. See code at: https://git.io/fx6sc

UDF Structure

Every UDF must have two methods: validateInput and execute. Optionally, there may also be an install method.

public class MyFunction {

  // required - return string if valid, throw exception if not
  public static String validateInput(String rawInput) {
    return getMyInput(rawInput).toString();
  }

  // required - this method is called when the UDF is executed
  public static void execute(String rawContextArgs, String rawInput) {

    // parse raw parameter input
    MyInput input = getMyInput(rawInput);

    // parse context
    ContextArgs args = (new Gson()).fromJson(rawContextArgs, ContextArgs.class);

    // get an API Client
    ApiClient apiClient = args.apiClient();

    //
    //  Make API calls
    //
    //  "meat and potatoes" of the UDF goes here
    //

  }

  // optional - this method is called when the UDF is applied to a view
  public static void install(String rawContextArgs, String rawInput) {

    //
    //  This code is run once
    //  For example, retroactively apply the function to historic data
    //

  }

  // helper for parsing input parameters
  private static MyInput getMyInput(String rawInput) {

    // params cannot be empty
    if (Strings.isNullOrEmpty(rawInput))
      throw new IllegalArgumentException("Input is empty");

    MyInput input;

    // parse params
    try {
      input = MyInput.of(rawInput);
    } catch (Exception e) {
      throw new IllegalArgumentException(e.getMessage(), e);
    }

    // validate input
    if (input.foo <= 0)
      throw new IllegalArgumentException("'foo' must be positive");

    return input;
  }

  // extend Input to easily parse parameters
  static class MyInput extends Input {

    // input parameters
    public int foo;

    // parse input
    private MyInput(String raw) {
      super(raw);
    }

    @Override
    public String toString() {
      StringBuilder builder = new StringBuilder();

      builder.append("MyUDF (");
      builder.append(foo);
      builder.append(")");

      return builder.toString();
    }

    static MyInput of(String raw) {
      return new MyInput(raw);
    }

  }

}

For more details on UDFs and how to write your own, see User Defined Functions. UDFs can be uploaded through the OverOps UI or with the UDF Uploader.

overops-functions's People

Contributors

ccaspanello avatar chook avatar daverted avatar davidlevanon avatar dfieldfl avatar dor-levi avatar guycastel avatar jenjenp avatar kaminerd avatar m-tsur avatar mahara13 avatar mdamour-harness avatar nivstein avatar noammat avatar timveil avatar tohayon avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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.