Skip to content

Commit 75b2823

Browse files
jmgilmankukkok3
andauthored
chore: adds additional prometheus metrics to voting-node | NPG-000 (#756)
# Description Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change. Fixes # (issue) _if applicable_ ## Type of change Please delete options that are not relevant. - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ## How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [ ] Test A - [ ] Test B **Test Configuration**: _if applicable_ - Firmware version: - Hardware: - Toolchain: - SDK: **List of new dependencies**: _if applicable_ Provide a list of newly added dependencies in this PR, with the description of what are they doing and why do we need them. - Crate A: description - Crate B: description ## Checklist - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] Any dependent changes have been merged and published in downstream modules --------- Co-authored-by: Stefano Cunego <[email protected]>
1 parent 39a25e9 commit 75b2823

File tree

8 files changed

+321
-133
lines changed

8 files changed

+321
-133
lines changed

services/voting-node/Earthfile

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,24 @@ deps:
4343
# Install package dependencies without the voting_node package
4444
RUN poetry install --only main --no-root
4545
RUN poetry self add poetry-plugin-export
46-
46+
4747
# Copy the voting_node source code
4848
COPY --dir voting_node README.md ./
4949

5050
SAVE ARTIFACT .venv .venv
51-
SAVE IMAGE --cache-hint
51+
52+
lock:
53+
FROM +builder
54+
55+
WORKDIR /src/services/voting-node
56+
57+
COPY pyproject.toml .
58+
COPY poetry.lock .
59+
COPY ../../utilities/ideascale-importer+build/src /src/utilities/ideascale-importer
60+
61+
RUN poetry lock
62+
63+
SAVE ARTIFACT ./poetry.lock AS LOCAL poetry.lock
5264

5365
# Build for distribution
5466
build:

services/voting-node/blueprint.cue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ project: {
9494
GVC_API_URL: value: string | *"unused"
9595
IS_NODE_RELOADABLE: value: string | *"true"
9696
VOTING_HOST: value: string | *"0.0.0.0"
97-
VOTING_PORT: value: string | *"8000"
97+
VOTING_PORT: value: string | *"8080"
9898
VOTING_LOG_LEVEL: value: string | *"debug"
9999
JORM_PATH: value: string | *"jormungandr"
100100
JCLI_PATH: value: string | *"jcli"
@@ -123,7 +123,7 @@ project: {
123123
}
124124
}
125125
ports: {
126-
http: port: 8080
126+
metrics: port: 8080
127127
}
128128
securityContext: {}
129129
}
@@ -215,7 +215,9 @@ project: {
215215
}
216216
}
217217

218-
service: {}
218+
service: {
219+
scrape: true
220+
}
219221

220222
volumes: snapshot: {
221223
size: "1Gi"

services/voting-node/entry.sh

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -139,28 +139,7 @@ export SSH_SNAPSHOT_TOOL_KEYFILE=/root/.ssh/id_snapshot
139139
# Sleep if DEBUG_SLEEP is set
140140
debug_sleep
141141

142-
# Define the command to be executed
143-
CMD_TO_RUN="voting-node start"
144-
145-
# Add $* to the command so that additional flags can be passed
146-
ARGS=$*
147-
CMD="$CMD_TO_RUN $ARGS"
148-
149-
# Wait for DEBUG_SLEEP seconds if the DEBUG_SLEEP environment variable is set
150-
if [ -n "${DEBUG_SLEEP:-}" ]; then
151-
echo "DEBUG_SLEEP is set to ${DEBUG_SLEEP}. Sleeping..."
152-
sleep "$DEBUG_SLEEP"
153-
fi
154-
155142
echo ">>> Executing command..."
156143
# Expand the command with arguments and capture the exit code
157144
set +e
158-
eval "$CMD"
159-
EXIT_CODE=$?
160-
set -e
161-
162-
# If the exit code is 0, the Python executable returned successfully
163-
if [ $EXIT_CODE -ne 0 ]; then
164-
echo "Error: Python executable returned with exit code $EXIT_CODE"
165-
exit 1
166-
fi
145+
exec voting-node start "$@"
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"proposals": {
3+
"extra_field_mappings": {
4+
"auto_translated": "auto_translated",
5+
"brief": "challenge_brief",
6+
"budget_breakdown": "please_provide_a_detailed_budget_breakdown",
7+
"challenges_or_risks": "what_main_challenges_or_risks_do_you_foresee_to_deliver_this_project_successfully_",
8+
"full_solution": "please_describe_your_proposed_solution",
9+
"goal": "how_does_success_look_like_",
10+
"how_solution_address_challenge": "please_describe_how_your_proposed_solution_will_address_the_challenge_",
11+
"importance": "importance",
12+
"metrics": "key_metrics_to_measure",
13+
"new_proposal": "is_this_proposal_is_a_continuation_of_a_previously_funded_project_in_catalyst__or_an_entirely_new_o",
14+
"progress_metrics": "what_will_you_measure_to_track_your_project_s_progress__and_how_will_you_measure_it_",
15+
"relevant_link_1": "relevant_link_1",
16+
"relevant_link_2": "website__github_repository__or_any_other_relevant_link__",
17+
"relevant_link_3": "relevant_link_3",
18+
"return_in_a_later_round": "if_you_are_funded__will_you_return_to_catalyst_in_a_later_round_for_further_funding__please_explain",
19+
"sdg_rating": "sdg_rating",
20+
"solution": "problem_solution",
21+
"team_details": "please_provide_details_of_the_people_who_will_work_on_the_project_",
22+
"timeline_and_key_milestones": "please_provide_a_detailed_plan__a_timeline__and_key_milestones_for_delivering_your_proposal_"
23+
},
24+
"field_mappings": {
25+
"funds": [
26+
"requested_funds",
27+
"requested_funds_in_ada",
28+
"requested_funds_coti"
29+
],
30+
"proposer_relevant_experience": "relevant_experience",
31+
"proposer_url": [
32+
"relevant_link_1",
33+
"website__github_repository__or_any_other_relevant_link__",
34+
"relevant_link_3"
35+
],
36+
"public_key": "ada_payment_address__"
37+
}
38+
},
39+
"proposals_scores_csv": {
40+
"id_field": "proposal_id",
41+
"score_field": "Rating"
42+
}
43+
}

0 commit comments

Comments
 (0)