Skip to content
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

metrics formatting: preserve trailing whitespace #1320

Merged
merged 4 commits into from
Jul 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 62 additions & 62 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
with:
name: kalium-dist
path: /home/runner/work/tessera/tessera/encryption/encryption-kalium/build/distributions/
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Build and upload binaries
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Build and upload binaries
# url: ${{ secrets.SLACK_WEBHOOK }}

checkdependencies:
name: Check dependencies for any security advisories
Expand All @@ -80,13 +80,13 @@ jobs:
check-latest: true
- name: Execute gradle dependencyCheckAnalyze task
run: ./gradlew dependencyCheckAnalyze -x test
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Check dependencies for any security advisories
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Check dependencies for any security advisories
# url: ${{ secrets.SLACK_WEBHOOK }}

test:
name: Unit tests
Expand All @@ -102,13 +102,13 @@ jobs:
check-latest: true
- name: Execute gradle test
run: ./gradlew test -x dependencyCheckAnalyze -x :tests:acceptance-test:test -x javadoc -x :cli:config-cli:jacocoTestCoverageVerification --info
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Unit tests
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Unit tests
# url: ${{ secrets.SLACK_WEBHOOK }}

itest:
name: Integration tests
Expand Down Expand Up @@ -168,13 +168,13 @@ jobs:
with:
name: itest-logs
path: /home/runner/work/tessera/tessera/tests/acceptance-test/build/logs
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Integration tests
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Integration tests
# url: ${{ secrets.SLACK_WEBHOOK }}

remote_enclave_itest:
name: Remote enclave integration tests
Expand Down Expand Up @@ -234,13 +234,13 @@ jobs:
with:
name: remote_enclave_itest-logs
path: /home/runner/work/tessera/tessera/tests/acceptance-test/build/logs
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Remote enclave integration tests
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Remote enclave integration tests
# url: ${{ secrets.SLACK_WEBHOOK }}

cucumber_itest:
name: Cucumber itests
Expand Down Expand Up @@ -300,13 +300,13 @@ jobs:
with:
name: cucumber_itest-logs
path: /home/runner/work/tessera/tessera/tests/acceptance-test/build/logs
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Cucumber itests
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Cucumber itests
# url: ${{ secrets.SLACK_WEBHOOK }}

vaultTests:
name: Key vault integration tests
Expand Down Expand Up @@ -375,12 +375,12 @@ jobs:
with:
name: vault-itest-logs
path: /home/runner/work/tessera/tessera/tests/acceptance-test/build/logs
- uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Key vault integration tests
url: ${{ secrets.SLACK_WEBHOOK }}
# - uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Key vault integration tests
# url: ${{ secrets.SLACK_WEBHOOK }}

recovery_itest:
name: Recovery integration tests
Expand Down Expand Up @@ -440,13 +440,13 @@ jobs:
with:
name: recovery-itest-logs
path: /home/runner/work/tessera/tessera/tests/acceptance-test/build/logs
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Recovery integration tests
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Recovery integration tests
# url: ${{ secrets.SLACK_WEBHOOK }}

build_image:
name: Build develop Docker image
Expand Down Expand Up @@ -536,13 +536,13 @@ jobs:
with:
name: gauge-reports
path: /tmp/acctests/gauge
- name: Send slack notification
uses: homoluctus/[email protected]
if: always()
with:
type: ${{job.status}}
job_name: Quorum acceptance tests
url: ${{ secrets.SLACK_WEBHOOK }}
# - name: Send slack notification
# uses: homoluctus/[email protected]
# if: always()
# with:
# type: ${{job.status}}
# job_name: Quorum acceptance tests
# url: ${{ secrets.SLACK_WEBHOOK }}

push_docker_develop:
name: Push develop image to DockerHub
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ public Response getMetrics() {
List<MBeanMetric> metrics = metricsEnquirer.getMBeanMetrics(type);
PrometheusProtocolFormatter formatter = new PrometheusProtocolFormatter();

formattedMetrics.append(formatter.format(metrics, type)).append("\n");
formattedMetrics.append(formatter.format(metrics, type));
}

return Response.status(Response.Status.OK)
.header(HttpHeaders.CONTENT_TYPE, TEXT_PLAIN)
.entity(formattedMetrics.toString().trim())
.entity(formattedMetrics.toString())
chris-j-h marked this conversation as resolved.
Show resolved Hide resolved
.build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public String format(final List<MBeanMetric> metrics, AppType appType) {
.append("\n");
}

return formattedMetrics.toString().trim();
return formattedMetrics.toString();
}

private String sanitize(final String input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void noArgResourceResponseCorrectlyFormatted() {

AppType type = AppType.P2P;

String expectedResponse = "tessera_P2P_GET_upCheck_AverageTime_ms 100";
String expectedResponse = "tessera_P2P_GET_upCheck_AverageTime_ms 100\n";

assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
Expand All @@ -41,7 +41,7 @@ public void singleArgResourceResponseCorrectlyFormatted() {
AppType type = AppType.P2P;

String expectedResponse =
"tessera_P2P_POST_resend_ResendRequest_RequestRate_requestsPerSeconds 1.3";
"tessera_P2P_POST_resend_ResendRequest_RequestRate_requestsPerSeconds 1.3\n";

assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
Expand All @@ -53,7 +53,7 @@ public void singleArrayArgResourceResponseCorrectlyFormatted() {

AppType type = AppType.P2P;

String expectedResponse = "tessera_P2P_POST_push_byte_MinTime_ms 3.4";
String expectedResponse = "tessera_P2P_POST_push_byte_MinTime_ms 3.4\n";

assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
Expand All @@ -66,7 +66,7 @@ public void multipleArgResourceResponseCorrectlyFormatted() {

AppType type = AppType.P2P;

String expectedResponse = "tessera_P2P_GET_receiveRaw_StringString_AverageTime_ms 5.2";
String expectedResponse = "tessera_P2P_GET_receiveRaw_StringString_AverageTime_ms 5.2\n";

assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
Expand All @@ -82,9 +82,8 @@ public void multipleMetricsResponseCorrectlyFormatted() {
AppType type = AppType.P2P;

String expectedResponse =
"tessera_P2P_GET_upCheck_AverageTime_ms 100"
+ "\n"
+ "tessera_P2P_POST_resend_ResendRequest_RequestRate_requestsPerSeconds 1.3";
"tessera_P2P_GET_upCheck_AverageTime_ms 100\n"
+ "tessera_P2P_POST_resend_ResendRequest_RequestRate_requestsPerSeconds 1.3\n";

assertThat(protocolFormatter.format(mockMetrics, type)).isEqualTo(expectedResponse);
}
Expand Down