-
Notifications
You must be signed in to change notification settings - Fork 202
locust fingerprints with all dependencies added #311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mr-mosi
wants to merge
10
commits into
google:master
Choose a base branch
from
mr-mosi:locust-new
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c1df54d
locust fingerprints added
e5dda44
move to google/fingerprinters/web/scripts/updater/community
e309cfb
add binproto and fix update.sh bugs:(
631849f
Update .gitignore
tooryx 38828ea
delete old locust files
7e10d09
mv locust.binproto to community dir
bda87a4
fix bugs according to reviews, add new versions, ...
a667803
Merge branch 'google:master' into locust-new
mr-mosi 0513ffe
remove two versions that don't have a git branch, update docker-compo…
6a44a58
don't need to add env to docker-compose
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,4 +28,7 @@ eclipsebin | |
\#*\# | ||
|
||
# VSCode history | ||
.history | ||
.history | ||
|
||
# Python Module Compile Bytecode | ||
__pycache__/ |
12 changes: 12 additions & 0 deletions
12
google/fingerprinters/web/scripts/updater/community/locust/app/docker-compose.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
services: | ||
master: | ||
image: "locustio/locust:${LC_VERSION}" | ||
ports: | ||
- "8089:8089" | ||
volumes: | ||
- ./locustfile.py:/mnt/locust/locustfile.py | ||
command: -f /mnt/locust/locustfile.py --master -H http://master:8089 | ||
healthcheck: | ||
test: [ "CMD", "python3", "-c", "import socket; socket.create_connection(('localhost', 8089), timeout=1)" ] | ||
interval: 3s | ||
retries: 10 |
17 changes: 17 additions & 0 deletions
17
google/fingerprinters/web/scripts/updater/community/locust/app/locustfile.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
try: | ||
from locust import HttpUser, TaskSet, task | ||
except ImportError: | ||
# For older versions of Locust | ||
from locust import HttpLocust as HttpUser, TaskSet, task | ||
|
||
|
||
class UserTasks(TaskSet): | ||
@task | ||
def hello_world(self): | ||
self.client.get("/hello") | ||
self.client.get("/world") | ||
|
||
|
||
class HelloWorldUser(HttpUser): | ||
host = "http://127.0.0.1:8089" | ||
task_set = UserTasks |
18 changes: 18 additions & 0 deletions
18
google/fingerprinters/web/scripts/updater/community/locust/getAllTags.py
mr-mosi marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import requests | ||
|
||
|
||
def get_locust_tags(): | ||
url = "https://hub.docker.com/v2/repositories/locustio/locust/tags" | ||
tags = [] | ||
while url: | ||
response = requests.get(url) | ||
data = response.json() | ||
tags.extend([tag['name'] for tag in data['results']]) | ||
url = data['next'] | ||
return tags | ||
|
||
|
||
if __name__ == "__main__": | ||
tags = get_locust_tags() | ||
for tag in tags: | ||
print(tag) |
93 changes: 93 additions & 0 deletions
93
google/fingerprinters/web/scripts/updater/community/locust/update.sh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2025 Google LLC | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
set -e | ||
|
||
source ../../common.sh | ||
|
||
SCRIPT_PATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)" | ||
# Root path to the web fingerprinter plugin. | ||
PROJECT_ROOT="$(cd -- "${SCRIPT_PATH}/../../../.." >/dev/null 2>&1 ; pwd -P)" | ||
# Path to the configurations for starting a live instance of Locust. | ||
APP_PATH="${SCRIPT_PATH}/app" | ||
# Path to the temporary data holder. | ||
TMP_DATA="/tmp/lc_fingerprints" | ||
# Path to the local git repository for Locsut codebase. | ||
GIT_REPO="${TMP_DATA}/repo" | ||
# Path to the directory of all the updated fingerprints data. | ||
FINGERPRINTS_PATH="${TMP_DATA}/fingerprints" | ||
# Json data of the final result. | ||
JSON_DATA="${FINGERPRINTS_PATH}/fingerprint.json" | ||
# Binary proto data of the final result. | ||
BIN_DATA="${FINGERPRINTS_PATH}/fingerprint.binproto" | ||
# Read all the versions to be fingerprinted. | ||
readarray -t ALL_VERSIONS < "${SCRIPT_PATH}/versions.txt" | ||
|
||
mkdir -p "${FINGERPRINTS_PATH}" | ||
|
||
BINPROTO="${PROJECT_ROOT}/src/main/resources/fingerprinters/web/data/community/locust.binproto" | ||
|
||
startLocust() { | ||
local version="$1" | ||
pushd "${APP_PATH}" >/dev/null | ||
LC_VERSION="${version}" docker compose up -d --wait | ||
popd >/dev/null | ||
} | ||
|
||
stopLocust() { | ||
local version="$1" | ||
pushd "${APP_PATH}" >/dev/null | ||
LC_VERSION="${version}" docker compose down --volumes --remove-orphans | ||
popd >/dev/null | ||
} | ||
|
||
# Convert the existing data file to a human-readable json file. | ||
convertFingerprint \ | ||
$BINPROTO \ | ||
"${JSON_DATA}" | ||
|
||
# Fetch Locust codebase. | ||
if [[ ! -d "${GIT_REPO}" ]] ; then | ||
git clone https://github.com/locustio/locust.git "${GIT_REPO}" | ||
fi | ||
|
||
# Update for all the versions listed in "versions.txt" file. | ||
for LC_VERSION in "${ALL_VERSIONS[@]}"; do | ||
echo "Fingerprinting Locust version ${LC_VERSION} ..." | ||
# Start a live instance of Locust. | ||
startLocust "${LC_VERSION}" | ||
|
||
# Checkout the repository to the correct tag. | ||
checkOutRepo "${GIT_REPO}" "${LC_VERSION}" | ||
|
||
updateFingerprint \ | ||
"locust" \ | ||
mr-mosi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"${LC_VERSION}" \ | ||
"${FINGERPRINTS_PATH}" \ | ||
"${GIT_REPO}" \ | ||
"http://localhost:8089" | ||
|
||
# Stop the live instance of Locust. | ||
stopLocust "${LC_VERSION}" | ||
done | ||
|
||
convertFingerprint "${JSON_DATA}" "${BIN_DATA}" | ||
|
||
echo "Fingerprint updated for MLflow. Please commit the following file:" | ||
echo " ${BIN_DATA}" | ||
echo "to" | ||
echo " ${BINPROTO}" | ||
|
132 changes: 132 additions & 0 deletions
132
google/fingerprinters/web/scripts/updater/community/locust/versions.txt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
2.33.0 | ||
2.32.10 | ||
2.32.9 | ||
2.32.8 | ||
2.32.7 | ||
2.32.6 | ||
2.32.5 | ||
2.32.4 | ||
2.32.3 | ||
2.32.2 | ||
2.32.1 | ||
2.32.0 | ||
2.31.8 | ||
2.31.7 | ||
2.31.6 | ||
2.31.5 | ||
2.31.4 | ||
2.31.3 | ||
2.31.2 | ||
2.31.1 | ||
2.31.0 | ||
2.30.1 | ||
2.29.1 | ||
2.29.0 | ||
2.28.0 | ||
2.27.0 | ||
2.26.0 | ||
2.25.0 | ||
2.24.1 | ||
2.24.0 | ||
2.23.1 | ||
2.23.0 | ||
2.22.0 | ||
2.21.0 | ||
2.20.2 | ||
2.20.1 | ||
2.20.0 | ||
2.19.1 | ||
2.19.0 | ||
2.18.4 | ||
2.18.3 | ||
2.18.2 | ||
2.18.1 | ||
2.17.0 | ||
2.16.1 | ||
2.16.0 | ||
2.15.1 | ||
2.15.0 | ||
2.14.2 | ||
2.14.1 | ||
2.14.0 | ||
2.13.2 | ||
2.13.1 | ||
2.13.0 | ||
2.12.2 | ||
2.12.1 | ||
2.12.0 | ||
2.11.1 | ||
2.11.0 | ||
2.10.2 | ||
2.10.1 | ||
2.10.0 | ||
2.9.0 | ||
2.8.6 | ||
2.8.5 | ||
2.8.4 | ||
2.8.3 | ||
2.8.2 | ||
2.8.1 | ||
2.8.0 | ||
2.7.3 | ||
2.7.2 | ||
2.7.1 | ||
2.7.0 | ||
2.6.1 | ||
2.6.0 | ||
2.5.1 | ||
2.5.0 | ||
2.4.3 | ||
2.4.2 | ||
2.4.1 | ||
2.4.0 | ||
2.2.3 | ||
2.2.2 | ||
2.2.1 | ||
2.2.0b0 | ||
2.2.0 | ||
2.1.0 | ||
2.0.0b3 | ||
2.0.0b2 | ||
2.0.0b1 | ||
2.0.0b0 | ||
1.6.0 | ||
1.5.3 | ||
1.5.2 | ||
1.5.1 | ||
1.5.0 | ||
1.4.4 | ||
1.4.3 | ||
1.4.2 | ||
1.4.1 | ||
1.4.0 | ||
1.3.2 | ||
1.3.1 | ||
1.3.0 | ||
1.2.3 | ||
1.2.2 | ||
1.2.1 | ||
1.2 | ||
1.1.1 | ||
1.1 | ||
1.0.3 | ||
1.0.2 | ||
0.14.5 | ||
1.0.1 | ||
1.0 | ||
1.0b2 | ||
0.14.6 | ||
1.0b1 | ||
0.14.4 | ||
0.14.3 | ||
0.14.2 | ||
0.14.1 | ||
0.14.0 | ||
0.13.5 | ||
0.13.4 | ||
0.13.3 | ||
0.13.2 | ||
0.13.1 | ||
0.13.0 | ||
0.12.2 | ||
0.12.1 |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.