Skip to content

Instantly share code, notes, and snippets.

@MichaelDrogalis
Last active December 15, 2023 23:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MichaelDrogalis/d98d2ec2b50dd737e5950205b687caa9 to your computer and use it in GitHub Desktop.
Save MichaelDrogalis/d98d2ec2b50dd737e5950205b687caa9 to your computer and use it in GitHub Desktop.

Run it yourself

  1. Get ShadowTraffic
  2. Make a file called heap-readings.json (see below)
  3. Run it with docker run --env-file license.env -v ./heap-readings.json:/home/config.json shadowtraffic/shadowtraffic:latest --config /home/config.json --sample 15000 --quiet --no-pretty --stdout > data.json

To visualize the output:

  1. Download Visidata
  2. Make a file called vgraph.vdj (see below)
  3. Run vd -p vgraph.vdj
{
"generators": [
{
"table": "heapReadings",
"row": {
"jvm-id": "jvm-1",
"timestamp": {
"_gen": "formatDateTime",
"ms": { "_gen": "now" }
},
"heapSize": {
"_gen": "add",
"args": [
1200,
{
"_gen": "multiply",
"args": [
800,
{
"_gen": "sin",
"degrees": { "_gen": "sequentialInteger" }
},
{
"_gen": "normalDistribution",
"mean": 0.6,
"sd": 0.1
}
]
}
]
}
},
"localConfigs": {
"throttle": {
"ms": 5
}
}
},
{
"table": "heapReadings",
"row": {
"jvm-id": "jvm-2",
"timestamp": {
"_gen": "formatDateTime",
"ms": { "_gen": "now" }
},
"heapSize": {
"_gen": "add",
"args": [
1500,
{
"_gen": "multiply",
"args": [
1000,
{
"_gen": "sin",
"degrees": { "_gen": "sequentialInteger" }
},
{
"_gen": "normalDistribution",
"mean": 0.8,
"sd": 0.2
}
]
}
]
}
},
"localConfigs": {
"throttle": {
"ms": 13
}
}
},
{
"table": "heapReadings",
"row": {
"jvm-id": "jvm-3",
"timestamp": {
"_gen": "formatDateTime",
"ms": { "_gen": "now" }
},
"heapSize": {
"_gen": "add",
"args": [
1100,
{
"_gen": "multiply",
"args": [
300,
{
"_gen": "sin",
"degrees": { "_gen": "sequentialInteger" }
},
{
"_gen": "normalDistribution",
"mean": 0.95,
"sd": 0.01
}
]
}
]
}
},
"localConfigs": {
"throttle": {
"ms": 8
}
}
}
],
"connections": {
"pg": {
"kind": "postgres",
"connectionConfigs": {
"host": "localhost",
"port": 5432,
"username": "postgres",
"password": "postgres",
"db": "mydb"
}
}
}
}
#!vd -p
{"longname": "open-file", "input": "locations.json", "keystrokes": "o"}
{"sheet": "locations", "col": "value", "row": "", "longname": "expand-col", "input": "", "keystrokes": "(", "comment": "expand current column of containers one level"}
{"sheet": "locations", "col": "value.location", "row": "", "longname": "expand-col", "input": "", "keystrokes": "(", "comment": "expand current column of containers one level"}
{"sheet": "locations", "col": "value.location.latitude", "row": "", "longname": "key-col", "input": "", "keystrokes": "!", "comment": "toggle current column as a key column"}
{"sheet": "locations", "col": "value.flightId", "row": "", "longname": "key-col", "input": "", "keystrokes": "!", "comment": "toggle current column as a key column"}
{"sheet": "locations", "col": "value.location.longitude", "row": "", "longname": "plot-column", "input": "", "keystrokes": ".", "comment": "plot current numeric column vs key columns; numeric key column is used for x-axis, while categorical key columns determine color"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment