From b49f72e9a19044fa527c4a10cdbb87b9a505c17e Mon Sep 17 00:00:00 2001 From: i-decosmis Date: Tue, 12 Dec 2023 17:45:39 +0100 Subject: [PATCH 1/3] added locust --- dvc.lock | 14 +++++------ locustfile.py | 22 +++++++++++++++++ .../meta.yaml | 15 ++++++++++++ .../metrics/Weighted_avg_f1 | 1 + .../metrics/Weighted_avg_precision | 1 + .../metrics/Weighted_avg_recall | 1 + .../metrics/accuracy | 1 + .../tags/mlflow.parentRunId | 1 + .../tags/mlflow.runName | 1 + .../tags/mlflow.source.git.commit | 1 + .../tags/mlflow.source.name | 1 + .../tags/mlflow.source.type | 1 + .../tags/mlflow.user | 1 + .../tags/model_type | 1 + .../meta.yaml | 15 ++++++++++++ .../metrics/Weighted_avg_f1 | 1 + .../metrics/Weighted_avg_precision | 1 + .../metrics/Weighted_avg_recall | 1 + .../metrics/accuracy | 1 + .../tags/mlflow.runName | 1 + .../tags/mlflow.source.git.commit | 1 + .../tags/mlflow.source.name | 1 + .../tags/mlflow.source.type | 1 + .../tags/mlflow.user | 1 + .../tags/model_type | 1 + mlruns/models/base_rf_model/meta.yaml | 2 +- .../models/base_rf_model/version-19/meta.yaml | 14 +++++++++++ mlruns/models/tuned_rf_model/meta.yaml | 2 +- .../tuned_rf_model/version-19/meta.yaml | 14 +++++++++++ reports/classification_report_tuned_rf.json | 24 +++++++++---------- reports/confusion_matrix_tuned_rf.json | 4 ++-- 31 files changed, 124 insertions(+), 23 deletions(-) create mode 100644 locustfile.py create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/meta.yaml create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_f1 create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_precision create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_recall create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/accuracy create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.parentRunId create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.runName create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.git.commit create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.name create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.type create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.user create mode 100644 mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/model_type create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/meta.yaml create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_f1 create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_precision create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_recall create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/accuracy create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.runName create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.git.commit create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.name create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.type create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.user create mode 100644 mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/model_type create mode 100644 mlruns/models/base_rf_model/version-19/meta.yaml create mode 100644 mlruns/models/tuned_rf_model/version-19/meta.yaml diff --git a/dvc.lock b/dvc.lock index bf05a4c2..d946eb83 100644 --- a/dvc.lock +++ b/dvc.lock @@ -130,8 +130,8 @@ stages: outs: - path: models/tuned_rf_model.pkl hash: md5 - md5: 71ac3c6753ba49feab4a7360be3c36e7 - size: 780851602 + md5: 023221cdcda215232b57aec9e91d8f72 + size: 780659602 predict: cmd: - python src/models/predict.py @@ -146,8 +146,8 @@ stages: size: 34199068 - path: models/tuned_rf_model.pkl hash: md5 - md5: 71ac3c6753ba49feab4a7360be3c36e7 - size: 780851602 + md5: 023221cdcda215232b57aec9e91d8f72 + size: 780659602 - path: src/models/predict.py hash: md5 md5: 422b5f22679fcc6ce1e308524a508457 @@ -163,13 +163,13 @@ stages: size: 687 - path: reports/classification_report_tuned_rf.json hash: md5 - md5: db96ae0765ec0a37ab6337172dd73232 - size: 688 + md5: 43567771ebaccc098a0e723b768fbb3b + size: 701 - path: reports/confusion_matrix_base_rf.json hash: md5 md5: 5bd49e3e36e33ae371bc1b67744c363c size: 155 - path: reports/confusion_matrix_tuned_rf.json hash: md5 - md5: 5ffa40c22ff9bd5dc8efcc12520b2f29 + md5: 5e323a96da9771f5495812f7580a1bb6 size: 155 diff --git a/locustfile.py b/locustfile.py new file mode 100644 index 00000000..82be6c9e --- /dev/null +++ b/locustfile.py @@ -0,0 +1,22 @@ +import time +from locust import HttpUser, task, between + +class TestUser(HttpUser): + wait_time = between(1, 5) + + @task + def get_features(self): + self.client.post('/get_features', json={"url":"www.google.it"}, name="Get Features") + '''x = self.client.post('/get_features', json={"url":"www.google.it"}) + y = x.json() + print(y)''' + + @task + def get_models(self): + self.client.get('/models', name="Get Models") + + @task + def scan(self): + self.client.post('/scan', json={"url":"www.google.it","model":"base_rf"}, name="Scan") + + \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/meta.yaml b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/meta.yaml new file mode 100644 index 00000000..17d7702a --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/meta.yaml @@ -0,0 +1,15 @@ +artifact_uri: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/artifacts +end_time: 1702399159339 +entry_point_name: '' +experiment_id: '573845569101247538' +lifecycle_stage: active +run_id: 5d925ffaa68d403b94dc614c913fa5fb +run_name: delightful-mule-19 +run_uuid: 5d925ffaa68d403b94dc614c913fa5fb +source_name: '' +source_type: 4 +source_version: '' +start_time: 1702399155566 +status: 3 +tags: [] +user_id: 75897e6620fc552361f424ffc621ee0c6c55322f diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_f1 b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_f1 new file mode 100644 index 00000000..e6844166 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_f1 @@ -0,0 +1 @@ +1702399159334 0.8967420943165961 0 diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_precision b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_precision new file mode 100644 index 00000000..78f63b87 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_precision @@ -0,0 +1 @@ +1702399159334 0.8968715419097099 0 diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_recall b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_recall new file mode 100644 index 00000000..4f3e1974 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/Weighted_avg_recall @@ -0,0 +1 @@ +1702399159334 0.89675 0 diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/accuracy b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/accuracy new file mode 100644 index 00000000..4f3e1974 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/metrics/accuracy @@ -0,0 +1 @@ +1702399159334 0.89675 0 diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.parentRunId b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.parentRunId new file mode 100644 index 00000000..26dfb014 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.parentRunId @@ -0,0 +1 @@ +be57f7deba8f4861a51c101064c1520c \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.runName b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.runName new file mode 100644 index 00000000..1785eedb --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.runName @@ -0,0 +1 @@ +delightful-mule-19 \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.git.commit b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.git.commit new file mode 100644 index 00000000..f2e8115f --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.git.commit @@ -0,0 +1 @@ +972145f000b501ad23b8076920c6f87453208c71 \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.name b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.name new file mode 100644 index 00000000..2dbad2f7 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.name @@ -0,0 +1 @@ +src/models/predict.py \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.type b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.type new file mode 100644 index 00000000..0c2c1fe9 --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.source.type @@ -0,0 +1 @@ +LOCAL \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.user b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.user new file mode 100644 index 00000000..36e7c51c --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/mlflow.user @@ -0,0 +1 @@ +75897e6620fc552361f424ffc621ee0c6c55322f \ No newline at end of file diff --git a/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/model_type b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/model_type new file mode 100644 index 00000000..cb090afe --- /dev/null +++ b/mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/tags/model_type @@ -0,0 +1 @@ +random_forest_tuned_model \ No newline at end of file diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/meta.yaml b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/meta.yaml new file mode 100644 index 00000000..00e5202a --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/meta.yaml @@ -0,0 +1,15 @@ +artifact_uri: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/artifacts +end_time: 1702399159341 +entry_point_name: '' +experiment_id: '573845569101247538' +lifecycle_stage: active +run_id: be57f7deba8f4861a51c101064c1520c +run_name: stylish-hog-713 +run_uuid: be57f7deba8f4861a51c101064c1520c +source_name: '' +source_type: 4 +source_version: '' +start_time: 1702399155271 +status: 3 +tags: [] +user_id: 75897e6620fc552361f424ffc621ee0c6c55322f diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_f1 b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_f1 new file mode 100644 index 00000000..7a4012ad --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_f1 @@ -0,0 +1 @@ +1702399155481 0.8929922686914129 0 diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_precision b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_precision new file mode 100644 index 00000000..63765616 --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_precision @@ -0,0 +1 @@ +1702399155481 0.8931136098332417 0 diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_recall b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_recall new file mode 100644 index 00000000..6f052511 --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/Weighted_avg_recall @@ -0,0 +1 @@ +1702399155481 0.893 0 diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/accuracy b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/accuracy new file mode 100644 index 00000000..6f052511 --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/metrics/accuracy @@ -0,0 +1 @@ +1702399155481 0.893 0 diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.runName b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.runName new file mode 100644 index 00000000..7477ef0e --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.runName @@ -0,0 +1 @@ +stylish-hog-713 \ No newline at end of file diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.git.commit b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.git.commit new file mode 100644 index 00000000..f2e8115f --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.git.commit @@ -0,0 +1 @@ +972145f000b501ad23b8076920c6f87453208c71 \ No newline at end of file diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.name b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.name new file mode 100644 index 00000000..2dbad2f7 --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.name @@ -0,0 +1 @@ +src/models/predict.py \ No newline at end of file diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.type b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.type new file mode 100644 index 00000000..0c2c1fe9 --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.source.type @@ -0,0 +1 @@ +LOCAL \ No newline at end of file diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.user b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.user new file mode 100644 index 00000000..36e7c51c --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/mlflow.user @@ -0,0 +1 @@ +75897e6620fc552361f424ffc621ee0c6c55322f \ No newline at end of file diff --git a/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/model_type b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/model_type new file mode 100644 index 00000000..5579cb21 --- /dev/null +++ b/mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/tags/model_type @@ -0,0 +1 @@ +random_forest_base_model \ No newline at end of file diff --git a/mlruns/models/base_rf_model/meta.yaml b/mlruns/models/base_rf_model/meta.yaml index 577308d7..9acee318 100644 --- a/mlruns/models/base_rf_model/meta.yaml +++ b/mlruns/models/base_rf_model/meta.yaml @@ -1,5 +1,5 @@ aliases: {} creation_timestamp: 1699354056057 description: null -last_updated_timestamp: 1702371461908 +last_updated_timestamp: 1702399155522 name: base_rf_model diff --git a/mlruns/models/base_rf_model/version-19/meta.yaml b/mlruns/models/base_rf_model/version-19/meta.yaml new file mode 100644 index 00000000..04ca2b30 --- /dev/null +++ b/mlruns/models/base_rf_model/version-19/meta.yaml @@ -0,0 +1,14 @@ +aliases: [] +creation_timestamp: 1702399155522 +current_stage: None +description: null +last_updated_timestamp: 1702399155522 +name: base_rf_model +run_id: be57f7deba8f4861a51c101064c1520c +run_link: null +source: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/artifacts/models +status: READY +status_message: null +storage_location: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/be57f7deba8f4861a51c101064c1520c/artifacts/models +user_id: null +version: 19 diff --git a/mlruns/models/tuned_rf_model/meta.yaml b/mlruns/models/tuned_rf_model/meta.yaml index 4a60e1be..ad25c595 100644 --- a/mlruns/models/tuned_rf_model/meta.yaml +++ b/mlruns/models/tuned_rf_model/meta.yaml @@ -1,5 +1,5 @@ aliases: {} creation_timestamp: 1699354060301 description: null -last_updated_timestamp: 1702371465095 +last_updated_timestamp: 1702399159298 name: tuned_rf_model diff --git a/mlruns/models/tuned_rf_model/version-19/meta.yaml b/mlruns/models/tuned_rf_model/version-19/meta.yaml new file mode 100644 index 00000000..980885c0 --- /dev/null +++ b/mlruns/models/tuned_rf_model/version-19/meta.yaml @@ -0,0 +1,14 @@ +aliases: [] +creation_timestamp: 1702399159298 +current_stage: None +description: null +last_updated_timestamp: 1702399159298 +name: tuned_rf_model +run_id: 5d925ffaa68d403b94dc614c913fa5fb +run_link: null +source: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/artifacts/models +status: READY +status_message: null +storage_location: file:///D:\Ivan\Desktop\lanubile\MalURLs\mlruns/573845569101247538/5d925ffaa68d403b94dc614c913fa5fb/artifacts/models +user_id: null +version: 19 diff --git a/reports/classification_report_tuned_rf.json b/reports/classification_report_tuned_rf.json index 65bf77c0..042175d6 100644 --- a/reports/classification_report_tuned_rf.json +++ b/reports/classification_report_tuned_rf.json @@ -1,27 +1,27 @@ { "safe_URL": { - "precision": 0.8903638151425762, + "precision": 0.88992628992629, "recall": 0.9055, - "f1-score": 0.8978681209717402, + "f1-score": 0.8976456009913258, "support": 2000.0 }, "unsafe_URL": { - "precision": 0.9038657171922686, - "recall": 0.8885, - "f1-score": 0.8961169944528493, + "precision": 0.9038167938931297, + "recall": 0.888, + "f1-score": 0.8958385876418663, "support": 2000.0 }, - "accuracy": 0.897, + "accuracy": 0.89675, "macro avg": { - "precision": 0.8971147661674224, - "recall": 0.897, - "f1-score": 0.8969925577122948, + "precision": 0.8968715419097099, + "recall": 0.8967499999999999, + "f1-score": 0.896742094316596, "support": 4000.0 }, "weighted avg": { - "precision": 0.8971147661674225, - "recall": 0.897, - "f1-score": 0.8969925577122947, + "precision": 0.8968715419097099, + "recall": 0.89675, + "f1-score": 0.8967420943165961, "support": 4000.0 } } \ No newline at end of file diff --git a/reports/confusion_matrix_tuned_rf.json b/reports/confusion_matrix_tuned_rf.json index ce11b5c9..a788f42a 100644 --- a/reports/confusion_matrix_tuned_rf.json +++ b/reports/confusion_matrix_tuned_rf.json @@ -5,8 +5,8 @@ 189 ], [ - 223, - 1777 + 224, + 1776 ] ] } \ No newline at end of file From 623df6a05137ff9d27d0db6bc0ea06422b748e70 Mon Sep 17 00:00:00 2001 From: i-decosmis Date: Tue, 12 Dec 2023 17:53:48 +0100 Subject: [PATCH 2/3] added prometheus to the gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index d8a20097..71a00d10 100644 --- a/.gitignore +++ b/.gitignore @@ -98,4 +98,6 @@ mlruns/0/meta.yaml # python virtual environment config *.cfg +tools/prometheus-2.48.1 + api_env/ \ No newline at end of file From 59f106bb632f77ce08bc02c74999e5b93619c81e Mon Sep 17 00:00:00 2001 From: i-decosmis Date: Tue, 12 Dec 2023 18:42:45 +0100 Subject: [PATCH 3/3] added prometheus and dockerfile for container --- .gitignore | 4 +++- docker-compose.yml | 10 ++++++++ locustfile.py => tools/locustfile.py | 0 tools/prometheus-2.48.1/Dockerfile | 2 ++ tools/prometheus-2.48.1/prometheus.yml | 32 ++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 1 deletion(-) rename locustfile.py => tools/locustfile.py (100%) create mode 100644 tools/prometheus-2.48.1/Dockerfile create mode 100644 tools/prometheus-2.48.1/prometheus.yml diff --git a/.gitignore b/.gitignore index 71a00d10..50d5ed8f 100644 --- a/.gitignore +++ b/.gitignore @@ -98,6 +98,8 @@ mlruns/0/meta.yaml # python virtual environment config *.cfg -tools/prometheus-2.48.1 +tools/prometheus-2.48.1/* +!/tools/prometheus-2.48.1/Dockerfile +!/tools/prometheus-2.48.1/prometheus.yml api_env/ \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 3d1154d6..64895100 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,3 +27,13 @@ services: networks: - local + prometheus: + image: simonegramegna/prometheus:latest + build: + context: ./tools/prometheus-2.48.1 + dockerfile: Dockerfile + ports: + - "9090:9090" + networks: + - local + diff --git a/locustfile.py b/tools/locustfile.py similarity index 100% rename from locustfile.py rename to tools/locustfile.py diff --git a/tools/prometheus-2.48.1/Dockerfile b/tools/prometheus-2.48.1/Dockerfile new file mode 100644 index 00000000..0e07679d --- /dev/null +++ b/tools/prometheus-2.48.1/Dockerfile @@ -0,0 +1,2 @@ +FROM prom/prometheus +ADD prometheus.yml /etc/prometheus/ diff --git a/tools/prometheus-2.48.1/prometheus.yml b/tools/prometheus-2.48.1/prometheus.yml new file mode 100644 index 00000000..45b230f5 --- /dev/null +++ b/tools/prometheus-2.48.1/prometheus.yml @@ -0,0 +1,32 @@ +# my global config +global: + scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute. + evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute. + # scrape_timeout is set to the global default (10s). + +# Alertmanager configuration +alerting: + alertmanagers: + - static_configs: + - targets: + # - alertmanager:9093 + +# Load rules once and periodically evaluate them according to the global 'evaluation_interval'. +rule_files: + # - "first_rules.yml" + # - "second_rules.yml" + +# A scrape configuration containing exactly one endpoint to scrape: +# Here it's Prometheus itself. +scrape_configs: + # The job name is added as a label `job=` to any timeseries scraped from this config. + - job_name: "prometheus" + + # metrics_path defaults to '/metrics' + # scheme defaults to 'http'. + + static_configs: + - targets: ["localhost:9090"] + - job_name: "docker" + static_configs: + - targets: ["host.docker.internal:9323"]