Giter VIP home page Giter VIP logo

tsprofiler's Introduction

TSProfiler

a profiler for time series data - breaking changes may occur, since currently under development.

Build Status GoDoc

+------------+       +------------+      +---------------+
| TimeSeries | +---> | TSProfiler | +--> |  Statistical  |
|    Data    |       |            |      |    Profile    |
+------------+       +------------+      +---------------+

Purpose

TSProfiler provides a go implementation to convert time series stream data like monitoring data online into statistical representative profiles. TSProfiler is integrated into the KVM monitoring tool kvmtop directly, or for distributed setups into the DisResc Monitoring Library.

The core concept bases on Markov Chains to represent the probability of a discretized utilisation states, and a Decision Tree to handle periodic recurrent Markov transition matrices (the period tree). Automatic phase detection further identifies pattern changes.

TSProfiler Architecture

Usage Guide

Command line tool csv2tsprofile

The TSProfiler comes with a command line tool to read a CSV file and generate a TSProfile. Get the most recent stable build from Releases.

Usage:
  csv2tsprofile [OPTIONS]

Reads time series values from a CSV file and generates a tsprofile

Application Options:
      --states=
      --buffersize=
      --history=
      --filterstddevs=
      --fixedbound
      --fixedmin=              if fixedbound is set, set the min value (default: 0)
      --fixedmax=              if fixedbound is set, set the max value (default: 100)
      --periodsize=            comma separated list of ints, specifies descrete states per period
      --phasechangelikeliness=
      --phasechangehistory=
      --output=                path to write profile to, stdout if '-' (default: -)
      --out.history=           path to write last historic values to, stdout if '-', empty to disable
      --out.phases=
      --out.periods=
      --out.states=

Help Options:
  -h, --help                   Show this help message

Example: csv2tsprofile --states 4 --history 1 --filterstddevs 4 --buffersize 6 --periodsize 2,24,48 path/to/tsinput.csv

Command line tool tspredictor

The TSPredictor reads a TSProfile and the current position to provide simulation or likeliness calculations for future next states. The mode can be either 0 (root tx), 1 (detected phases), or 2 (periods). Simulation or likeliness has to be specified as the requested task.

Usage:
  tspredictor [OPTIONS]

Reads a TSProfile from file and runs tasks on in (Simulate or Likeliness)

Application Options:
      --steps=
      --mode=
      --periodDepth=
  -p, --profile=
  -h, --history=

Help Options:
  -h, --help         Show this help message

Example (with csv2tsprofile):

csv2tsprofile \
	--fixedbound \
	--fixedmin 0 \
	--fixedmax 100 \
	--states 10 \
	--buffersize 1 \
	--history 1 \
	--periodsize 16,4 \
	--phasechangelikeliness 0.50 \
	--phasechangehistory 10 \
	--out.history /tmp/history.json \
	--output /tmp/profile.json \
	--out.phases /tmp/out.phases.log \
	--out.periods /tmp/out.periods.log \
	--out.states /tmp/out.states.log \
	tsinput.csv

tspredictor \
	--profile /tmp/profile.json \
	--history /tmp/history.json \
	--steps 4 \
	--mode 0 \
	simulate		

Integrate into Go Code via TSProfiler API

Create a new TSProfiler:

tsprofiler := profiler.NewProfiler(models.Settings{
		Name:          "profiler-hostX",
		BufferSize:    10,
		States:        4,
		FilterStdDevs: 4,
		History:       1,
		FixBound:      false,
		PeriodSize:    []int{60,720,1440},
		// ... many more settings
		OutputFreq:     time.Duration(20) * time.Second,
		OutputCallback: profileOutput,
	})

func profileOutput(data models.TSProfile) {
  // handle profiler output via OutputFreq
}

// get profile independently of OutputFreq
profile := profiler.Get()

Provide metric value to profiler:

metrics := make([]models.TSInputMetric, 0)
metrics = append(metrics, models.TSInputMetric{
		Name:  "CPU-Util",
		Value: float64(utilValue),
		FixedMin: options.FixedMin, // optional, required for FixBound = true
		FixedMax: options.FixedMax, // optional, required for FixBound = true
	})
tsinput := models.TSInput{
		Metrics: metrics,
	}
profiler.Put(tsinput)

tsprofiler's People

Contributors

cha87de avatar

Stargazers

 avatar  avatar

Watchers

 avatar

tsprofiler's Issues

Interdependencies

Each metric is considered independently at the moment in TSProfiler. Yet it is very likely that the metrics given to the tsprofiler correlate somehow. This metric interdependency should be considered and used in the output profile.

Seasonality

The txmatrix at the moment is updated and represents a statistical model of the overall considered time interval. TSProfiler should consider different patterns and represent the likeliness of a pattern to occur.

ChangeDimension for counter matrizes wrong

The change dimension (needed for non-fixed min/max boundaries) is not working correctly when multiple small extensions of the min/max area appear successively.

Example:

ChangeDimension(
    ChangeDimension(map[string][]int64{
        "3": []int64{0, 0, 0, 145},
    }, models.TSStats{
        Min: 50, Max: 55,
    }, models.TSStats{
        Min: 40, Max: 90,
    }, 4),

    models.TSStats{
        Min: 40, Max: 90,
    }, models.TSStats{
        Min: 0, Max: 100,
    }, 4
)

Result:

map[string][]int64{
    // "2": []int64{0, 0, 145, 0},  // THIS IS RIGHT
    "3": []int64{0, 0, 0, 145}, // THIS IS WRONG BUT RETURNED!
}

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.