Skip to content

Commit

Permalink
Add script for generating metrics on read_root
Browse files Browse the repository at this point in the history
  • Loading branch information
Brett Beutell committed May 31, 2023
1 parent 2912896 commit c8cce38
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,11 @@ Update the VSCode Extension settings to use the url to your local Prometheus ser
"autometrics.prometheusUrl": "http://localhost:8063"
}
```

### Generating Data

There is a script in the root of the repo that can be executed to generate data inside Prometheus. See: `generate-traffic.sh`

You can copy-paste the script into a shell, or execute it directly from the repo.

Traffic will appear for the `read_root` function.
11 changes: 11 additions & 0 deletions generate-traffic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

# This script will fetch a URL using curl at a random interval between 100ms and 5s
while true; do
# Generate a random sleep time between 100ms and 5s
sleep_time=$(awk -v min=0.1 -v max=5 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
sleep "$sleep_time"

# Fetch the URL using curl
curl -s -o /dev/null "https://example.com" # Replace "https://example.com" with your desired URL
done

0 comments on commit c8cce38

Please sign in to comment.