Skip to content

Commit

Permalink
Merge pull request #1320 from macfarla/newline
Browse files Browse the repository at this point in the history
metrics formatting: preserve trailing whitespace
  • Loading branch information
macfarla authored Jul 27, 2021
2 parents d27d02b + aecc93f commit e83782c
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 72 deletions.
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())
.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

0 comments on commit e83782c

Please sign in to comment.