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

ATOR-415 - Migrate json format (#28) #30

Merged
merged 2 commits into from
Sep 5, 2024
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
4 changes: 2 additions & 2 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Build and push
uses: ./.github/actions/build-and-push
with:
docker-username: ${{ secrets.CR_USERNAME }}
docker-password: ${{ secrets.CR_PAT }}
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-tag: ${{ github.sha }}
- name: Deploy
uses: ./.github/actions/deploy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/live.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
- name: Build and push
uses: ./.github/actions/build-and-push
with:
docker-username: ${{ secrets.CR_USERNAME }}
docker-password: ${{ secrets.CR_PAT }}
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-tag: ${{ github.sha }}
- name: Deploy
uses: ./.github/actions/deploy
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
- name: Build and push
uses: ./.github/actions/build-and-push
with:
docker-username: ${{ secrets.CR_USERNAME }}
docker-password: ${{ secrets.CR_PAT }}
docker-username: ${{ github.actor }}
docker-password: ${{ secrets.GITHUB_TOKEN }}
docker-tag: ${{ github.sha }}
- name: Deploy
uses: ./.github/actions/deploy
Expand Down
15 changes: 6 additions & 9 deletions operations/deploy-dev.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ job "onionoo-dev" {

config {
image = "ghcr.io/anyone-protocol/onionoo:DEPLOY_TAG"
force_pull = true
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
Expand All @@ -63,8 +62,8 @@ job "onionoo-dev" {
}

resources {
cpu = 256
memory = 512
cpu = 500
memory = 1000
}

service {
Expand All @@ -90,7 +89,6 @@ job "onionoo-dev" {

config {
image = "ghcr.io/anyone-protocol/onionoo:DEPLOY_TAG"
force_pull = true
ports = ["http-port"]
volumes = [
"local/logs/:/srv/onionoo/data/logs"
Expand All @@ -102,8 +100,8 @@ job "onionoo-dev" {
}

resources {
cpu = 256
memory = 256
cpu = 250
memory = 500
}

service {
Expand Down Expand Up @@ -143,7 +141,6 @@ job "onionoo-dev" {

config {
image = "ghcr.io/anyone-protocol/onionoo-cron:DEPLOY_TAG"
force_pull = true
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
Expand All @@ -159,8 +156,8 @@ job "onionoo-dev" {
}

resources {
cpu = 256
memory = 256
cpu = 128
memory = 128
}
}
}
Expand Down
9 changes: 3 additions & 6 deletions operations/deploy-live.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ job "onionoo-live" {

config {
image = "ghcr.io/anyone-protocol/onionoo:DEPLOY_TAG"
force_pull = true
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
}

resources {
cpu = 1000
memory = 2000
memory = 1500
}

service {
Expand All @@ -87,16 +86,15 @@ job "onionoo-live" {

config {
image = "ghcr.io/anyone-protocol/onionoo:DEPLOY_TAG"
force_pull = true
ports = ["http-port"]
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
}

resources {
cpu = 256
memory = 256
cpu = 250
memory = 750
}

service {
Expand Down Expand Up @@ -136,7 +134,6 @@ job "onionoo-live" {

config {
image = "ghcr.io/anyone-protocol/onionoo-cron:DEPLOY_TAG"
force_pull = true
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
Expand Down
15 changes: 6 additions & 9 deletions operations/deploy-stage.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,14 @@ job "onionoo-stage" {

config {
image = "ghcr.io/anyone-protocol/onionoo:DEPLOY_TAG"
force_pull = true
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
}

resources {
cpu = 256
memory = 512
cpu = 500
memory = 1000
}

service {
Expand All @@ -87,16 +86,15 @@ job "onionoo-stage" {

config {
image = "ghcr.io/anyone-protocol/onionoo:DEPLOY_TAG"
force_pull = true
ports = ["http-port"]
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
}

resources {
cpu = 256
memory = 256
cpu = 250
memory = 500
}

service {
Expand Down Expand Up @@ -136,7 +134,6 @@ job "onionoo-stage" {

config {
image = "ghcr.io/anyone-protocol/onionoo-cron:DEPLOY_TAG"
force_pull = true
volumes = [
"local/logs/:/srv/onionoo/data/logs"
]
Expand All @@ -148,8 +145,8 @@ job "onionoo-stage" {
}

resources {
cpu = 256
memory = 256
cpu = 128
memory = 128
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,7 +561,9 @@ private <T extends Document> T retrieveParsedDocumentFile(
Class<T> documentType, String documentString) {
T result = null;
try {
result = objectMapper.readValue(documentString, documentType);
if (documentString != null && !documentString.isEmpty() && !documentString.equals("{}")) {
result = objectMapper.readValue(documentString, documentType);
}
} catch (Throwable e) {
/* Handle below. */
logger.error(documentString);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
package org.torproject.metrics.onionoo.docs;

import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.util.List;

@JsonNaming
public class HardwareInfoDocument extends Document {

private String id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ public void updateStatuses() {
measurements.addAll(filter(statusOld.getMeasurements(), threshold));
logger.info("OnionperfStatus merged measurements size: {}", measurements.size());
}
OnionperfStatus status = new OnionperfStatus(measurements);
documentStore.store(status);
if (!measurements.isEmpty()) {
OnionperfStatus status = new OnionperfStatus(measurements);
documentStore.store(status);
}

logger.info("Measurements clearing");
measurements.clear();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ public OnionperfDocumentWriter() {
public void writeDocuments(long mostRecentStatusMillis) {
logger.info("Writing onionperf documents time: {}", mostRecentStatusMillis);
OnionperfStatus status = documentStore.retrieve(OnionperfStatus.class, true);
logger.info("OnionperfStatus: {}", status.getMeasurements().size());
documentStore.store(new CircuitDocument(status.getMeasurements()));
documentStore.store(new DownloadDocument(status.getMeasurements()));
documentStore.store(new FailureDocument(status.getMeasurements()));
documentStore.store(new LatencyDocument(status.getMeasurements()));
documentStore.store(new ThroughputDocument(status.getMeasurements()));
logger.info("Performance documents saved");
if (status != null) {
logger.info("OnionperfStatus: {}", status.getMeasurements().size());
documentStore.store(new CircuitDocument(status.getMeasurements()));
documentStore.store(new DownloadDocument(status.getMeasurements()));
documentStore.store(new FailureDocument(status.getMeasurements()));
documentStore.store(new LatencyDocument(status.getMeasurements()));
documentStore.store(new ThroughputDocument(status.getMeasurements()));
logger.info("Performance documents saved");
} else {
logger.info("No onionperf status found");
}
}

@Override
Expand Down
Loading