Plays videos using Prometheus, e.g. Bad Apple.

Overview

prom_bad_apple

Plays videos using Prometheus, e.g. Bad Apple.

preview

Inspiration

A while back I thought this blog post and the corresponding source code were kind of fun. After seeing some of kevinjycui's bad apple videos I thought combining these two ideas could be an interesting (and hilariously terrible) idea.

How to use

  • Download a video e.g. bad_apple.mkv
  • Figure out the output resolution, you should scale 1:1 with height being the number of time series you want.
  • Get a png sequence ffmpeg -i bad_apple.mkv -vf "scale=180:135" -vsync 0 frames\out%06d.png
  • If you would like to make sure that the y axis doesn't change, you can add 1px white bars to each frame. e.g.
    • ffmpeg -i frames\out%06d.png -vf "crop=in_w:in_h-1:0:1,pad=iw+0:ih+1:0:1:#FFFFFF@1,format=rgb24" -y frames\out%06d.png
    • ffmpeg -i frames\out%06d.png -vf "crop=in_w:in_h-1:0:-1,pad=iw+0:ih+1:0:-1:#FFFFFF@1,format=rgb24" -y frames\out%06d.png
  • go run main.go
  • Loop over the files and send them to promtool tsdb create-blocks-from openmetrics
  • docker compose up
  • Wait for Prometheus to compact etc. so it doesn't take 20 years to render.
  • Run prom_record.ahk or some other script to record all the frames from the UI.
  • cd to wherever you stored your screenshots.
  • Generate the video file ffmpeg -framerate 30 -i '%06d.png' -c:v libx264 -pix_fmt yuv420p out.mp4
Comments
  • Add sh script using promtool pinned by bingo

    Add sh script using promtool pinned by bingo

    Hey there,

    This adds a shell script, for folks that would prefer using bash or zsh instead of powershell. Also uses promtool package pinned by bingo.

    Let me know if this PR needs any modifications.

    opened by ar2pi 1
  • Fix: allow overlapping blocks

    Fix: allow overlapping blocks

    Hey there,

    Not sure if you're open to contributions nor if this is the right way to do it...

    But while trying out the project with a simple video (this one to be exact), I faced the following error when running promtool tsdb create-blocks-from openmetrics [...]:

    prometheus_1  | level=error ts=2021-08-12T03:12:17.882Z caller=db.go:766 component=tsdb msg=reloadBlocks err="invalid block sequence: block time ranges overlap: [mint: 1628676000000, maxt: 1628676299001, range: 4m59s, blocks: 2]: <ulid: 01FCW4B0D0C46EF2YZDG3YWJ0J, mint: 1628676000000, maxt: 1628676299001, range: 4m59s>, <ulid: 01FCW52YXKKZ8HPXZY2QY5R5FS, mint: 1628676000000, maxt: 1628676299001, range: 4m59s>\n[mint: 1628640000000, maxt: 1628647199001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW521C9JHXC2S7MMEWN72AQ, mint: 1628640000000, maxt: 1628647199001, range: 1h59m59s>, <ulid: 01FCW514MC9DAVTAJBBSTDR5P7, mint: 1628640000000, maxt: 1628661599001, range: 5h59m59s>\n[mint: 1628647200000, maxt: 1628654399001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW514MC9DAVTAJBBSTDR5P7, mint: 1628640000000, maxt: 1628661599001, range: 5h59m59s>, <ulid: 01FCW527GHM1V3BTMGWJXSZ3JC, mint: 1628647200000, maxt: 1628654399001, range: 1h59m59s>\n[mint: 1628654400000, maxt: 1628661599001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW514MC9DAVTAJBBSTDR5P7, mint: 1628640000000, maxt: 1628661599001, range: 5h59m59s>, <ulid: 01FCW52DHMMZCKX6PPTAEVVM9A, mint: 1628654400000, maxt: 1628661599001, range: 1h59m59s>\n[mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW52KK7F98KR9N1G9D4VPYG, mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s>, <ulid: 01FCW5153RF2BMBBGXMCAW5916, mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s>\n[mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW52ST0Q92GDK8DC85CYFNS, mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s>, <ulid: 01FCW4AV94BCM4ZD6RHK1Z3M37, mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s>"
    prometheus_1  | level=info ts=2021-08-12T03:12:50.308Z caller=compact.go:692 component=tsdb msg="Found overlapping blocks during compaction" ulid=01FCW5J83D5PWCKMJ5P9FD4H3X
    prometheus_1  | level=info ts=2021-08-12T03:12:50.454Z caller=compact.go:454 component=tsdb msg="compact blocks" count=4 mint=1628640000000 maxt=1628661599001 ulid=01FCW5J83D5PWCKMJ5P9FD4H3X sources="[01FCW514MC9DAVTAJBBSTDR5P7 01FCW521C9JHXC2S7MMEWN72AQ 01FCW527GHM1V3BTMGWJXSZ3JC 01FCW52DHMMZCKX6PPTAEVVM9A]" duration=245.7086ms
    prometheus_1  | level=error ts=2021-08-12T03:12:52.058Z caller=db.go:780 component=tsdb msg="compaction failed" err="reloadBlocks blocks: invalid block sequence: block time ranges overlap: [mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW5153RF2BMBBGXMCAW5916, mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s>, <ulid: 01FCW52KK7F98KR9N1G9D4VPYG, mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s>\n[mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW4AV94BCM4ZD6RHK1Z3M37, mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s>, <ulid: 01FCW52ST0Q92GDK8DC85CYFNS, mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s>\n[mint: 1628676000000, maxt: 1628676299001, range: 4m59s, blocks: 2]: <ulid: 01FCW52YXKKZ8HPXZY2QY5R5FS, mint: 1628676000000, maxt: 1628676299001, range: 4m59s>, <ulid: 01FCW4B0D0C46EF2YZDG3YWJ0J, mint: 1628676000000, maxt: 1628676299001, range: 4m59s>"
    prometheus_1  | level=error ts=2021-08-12T03:14:53.812Z caller=db.go:766 component=tsdb msg=reloadBlocks err="invalid block sequence: block time ranges overlap: [mint: 1628676000000, maxt: 1628676299001, range: 4m59s, blocks: 2]: <ulid: 01FCW4B0D0C46EF2YZDG3YWJ0J, mint: 1628676000000, maxt: 1628676299001, range: 4m59s>, <ulid: 01FCW52YXKKZ8HPXZY2QY5R5FS, mint: 1628676000000, maxt: 1628676299001, range: 4m59s>\n[mint: 1628640000000, maxt: 1628647199001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW521C9JHXC2S7MMEWN72AQ, mint: 1628640000000, maxt: 1628647199001, range: 1h59m59s>, <ulid: 01FCW514MC9DAVTAJBBSTDR5P7, mint: 1628640000000, maxt: 1628661599001, range: 5h59m59s>\n[mint: 1628647200000, maxt: 1628654399001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW514MC9DAVTAJBBSTDR5P7, mint: 1628640000000, maxt: 1628661599001, range: 5h59m59s>, <ulid: 01FCW527GHM1V3BTMGWJXSZ3JC, mint: 1628647200000, maxt: 1628654399001, range: 1h59m59s>\n[mint: 1628654400000, maxt: 1628661599001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW514MC9DAVTAJBBSTDR5P7, mint: 1628640000000, maxt: 1628661599001, range: 5h59m59s>, <ulid: 01FCW52DHMMZCKX6PPTAEVVM9A, mint: 1628654400000, maxt: 1628661599001, range: 1h59m59s>\n[mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW52KK7F98KR9N1G9D4VPYG, mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s>, <ulid: 01FCW5153RF2BMBBGXMCAW5916, mint: 1628661600000, maxt: 1628668799001, range: 1h59m59s>\n[mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW4AV94BCM4ZD6RHK1Z3M37, mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s>, <ulid: 01FCW52ST0Q92GDK8DC85CYFNS, mint: 1628668800000, maxt: 1628675999001, range: 1h59m59s>"
    [...]
    

    It went away simply enabling the storage.tsdb.allow-overlapping-blocks as described in the docs: https://prometheus.io/docs/prometheus/latest/storage/#usage

    A simple warning is shown now and backfill proceeds as expected

    prometheus_1  | level=info ts=2021-08-12T03:36:56.469Z caller=compact.go:692 component=tsdb msg="Found overlapping blocks during compaction" ulid=01FCW6YCC5TREHFSPCD8F6KD6J
    prometheus_1  | level=info ts=2021-08-12T03:36:57.462Z caller=compact.go:454 component=tsdb msg="compact blocks" count=8 mint=1629266400000 maxt=1629331199001 ulid=01FCW6YCC5TREHFSPCD8F6KD6J sources="[01FCW6WGGW3GGZ1F6X9KYBBDKK 01FCW6WQ6K2BFBKDDKR45QAAAQ 01FCW6WY7CPTAJFEVT6NBRCZK9 01FCW6X5393PBK8C3CEFX1WRDX 01FCW6XC0MR7CKVTMTZK2B1P12 01FCW6XK4MTGEY093JD5A78Q85 01FCW6XRPE4C8C53MPNB5J50M0 01FCW6Y5NZZRMHFQ1TXHR88JVT]" duration=1.0261382s
    prometheus_1  | level=warn ts=2021-08-12T03:36:57.597Z caller=db.go:1084 component=tsdb msg="Overlapping blocks found during reloadBlocks" detail="[mint: 1629331200000, maxt: 1629338399001, range: 1h59m59s, blocks: 2]: <ulid: 01FCW6YCDRTMSPCZQWM05FXQ2J, mint: 1629331200000, maxt: 1629338399001, range: 1h59m59s>, <ulid: 01FCW64189DDKV7ACDJG5V0RV9, mint: 1629331200000, maxt: 1629352799001, range: 5h59m59s>"
    prometheus_1  | level=info ts=2021-08-12T03:36:57.617Z caller=db.go:1239 component=tsdb msg="Deleting obsolete block" block=01FCW6WGGW3GGZ1F6X9KYBBDKK
    prometheus_1  | level=info ts=2021-08-12T03:36:57.638Z caller=db.go:1239 component=tsdb msg="Deleting obsolete block" block=01FCW6WY7CPTAJFEVT6NBRCZK9
    [...]
    

    Let me know if this PR needs any modifications.

    opened by ar2pi 1
  • Fix / simplify mode descriptions in readme

    Fix / simplify mode descriptions in readme

    Fixes use of "rgb" where "grayscale" should have been used.

    Also removing specific numbers around overrides since the total number has changed at various points / in different videos. Later I may add support for adjustable bit depth per channel.

    opened by MacroPower 0
  • Update docs

    Update docs

    • Adds preview image/gif for every mode.
    • Updates docs for latest version of grafana-image-renderer-cli.
    • Moves usage/installation docs to the docs folder.
    • Makes renderer usage docs a lot easier to read.
    • Other misc improvements.
    opened by MacroPower 0
  • Switch to Grafana 8.0

    Switch to Grafana 8.0

    This PR switches to Grafana 8 and Image Renderer 3.

    I've kept the old dashboard, which behaves almost the same as before. It takes about 5-10% less time to render each frame versus Grafana 7.

    I've also added a new dashboard which uses the new Time Series panel (pvr-dash-8), which takes about 50-60% less time to render each frame versus the old Graph panel. The downside is that it looks (in my opinion) slightly worse, as the horizontal gaps between pixels are slightly easier to see.

    For the new dashboard, I just wrote jsonnet for the overrides since I couldn't find anything in the grafana libraries for the Time Series panel. You have to manually paste the output in the grafana-created dashboard json.

    opened by MacroPower 0
Owner
Jacob Colvin
Versatilist Engineer @8451
Jacob Colvin
A long-running Go program that watches a Youtube playlist for new videos, and downloads them using yt-dlp or other preferred tool.

ytdlwatch A long-running Go program that watches a Youtube playlist for new videos, and downloads them using yt-dlp or other preferred tool. Ideal for

Raine Virta 9 Jul 25, 2022
This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) without YouTube API

Free YouTube Stats Badge This project will help you to create Live img.shields.io Badges which will Count YouTube Stats (Subscriber, Views, Videos) wi

Pushpender Singh 3 Oct 11, 2022
A go (golang) library to search videos in YouTube.

YT Search A go (golang) library to search videos in YouTube. Installation go get github.com/AnjanaMadu/YTSearch Usage package main import ( "fmt"

Anjana Madu 4 Oct 1, 2022
Nvidia GPU exporter for prometheus using nvidia-smi binary

nvidia_gpu_exporter Nvidia GPU exporter for prometheus, using nvidia-smi binary to gather metrics. Introduction There are many Nvidia GPU exporters ou

Utku Özdemir 199 Jan 5, 2023
Openshift's hpessa-exporter allows users to export SMART information of local storage devices as Prometheus metrics, by using HPE Smart Storage Administrator tool

hpessa-exporter Overview Openshift's hpessa-exporter allows users to export SMART information of local storage devices as Prometheus metrics, by using

Shachar Sharon 0 Jan 17, 2022
Vulnerability-exporter - A Prometheus Exporter for managing vulnerabilities in kubernetes by using trivy

Kubernetes Vulnerability Exporter A Prometheus Exporter for managing vulnerabili

null 24 Dec 4, 2022
Translate Prometheus Alerts into Kubernetes pod readiness

prometheus-alert-readiness Translates firing Prometheus alerts into a Kubernetes readiness path. Why? By running this container in a singleton deploym

Coralogix 20 Oct 31, 2022
A beginner friendly introduction to prometheus 🔥

Prometheus-Basics A beginner friendly introduction to prometheus. Table of Contents What is prometheus ? What are metrics and why is it important ? Ba

S Santhosh Nagaraj 1.6k Dec 29, 2022
Doraemon is a Prometheus based monitor system

English | 中文 Doraemon Doraemon is a Prometheus based monitor system ,which are made up of three components——the Rule Engine,the Alert Gateway and the

Qihoo 360 632 Nov 28, 2022
A set of tests to check compliance with the Prometheus Remote Write specification

Prometheus Remote Write Compliance Test This repo contains a set of tests to check compliance with the Prometheus Remote Write specification. The test

Tom Wilkie 103 Dec 4, 2022
Automating Kubernetes Rollouts with Argo and Prometheus. Checkout the demo URL below

observe-argo-rollout Demo for Automating and Monitoring Kubernetes Rollouts with Argo and Prometheus Performing Demo The demo can be found on Katacoda

null 33 Nov 16, 2022
📡 Prometheus exporter that exposes metrics from SpaceX Starlink Dish

Starlink Prometheus Exporter A Starlink exporter for Prometheus. Not affiliated with or acting on behalf of Starlink(™) ?? Starlink Monitoring System

DanOpsTech 87 Dec 19, 2022
A tool to dump and restore Prometheus data blocks.

promdump promdump dumps the head and persistent blocks of Prometheus. It supports filtering the persistent blocks by time range. Why This Tool When de

Ivan Sim 111 Dec 16, 2022
🦥 Easy and simple Prometheus SLO generator

Sloth Introduction Use the easiest way to generate SLOs for Prometheus. Sloth generates understandable, uniform and reliable Prometheus SLOs for any k

Xabier Larrakoetxea Gallego 1.4k Jan 4, 2023
Prometheus rule linter

pint pint is a Prometheus rule linter. Usage There are two modes it works in: CI PR linting Ad-hoc linting of a selected files or directories Pull Req

Cloudflare 502 Jan 2, 2023
Prometheus exporter for Chia node metrics

chia_exporter Prometheus metric collector for Chia nodes, using the local RPC API Building and Running With the Go compiler tools installed: go build

Kevin Retzke 33 Sep 19, 2022
k6 prometheus output extension

xk6-prometheus A k6 extension implements Prometheus HTTP exporter as k6 output extension. Using xk6-prometheus output extension you can collect metric

Iván Szkiba 38 Nov 22, 2022
Generate Prometheus rules for your SLOs

prometheus-slo Generates Prometheus rules for alerting on SLOs. Based on https://developers.soundcloud.com/blog/alerting-on-slos. Usage Build and Run

Ganesh Vernekar 16 Nov 27, 2022
NVIDIA GPU metrics exporter for Prometheus leveraging DCGM

DCGM-Exporter This repository contains the DCGM-Exporter project. It exposes GPU metrics exporter for Prometheus leveraging NVIDIA DCGM. Documentation

NVIDIA Corporation 236 Dec 27, 2022