Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
7a51f61
fresh start
lizk886 Sep 11, 2025
c951aa2
put empty lines back in
lizk886 Sep 11, 2025
a6e1ac0
put empty lines back in
lizk886 Sep 11, 2025
b98ca87
put empty lines back in
lizk886 Sep 11, 2025
419a651
put empty lines back in
lizk886 Sep 11, 2025
95fba9b
put empty lines back in
lizk886 Sep 11, 2025
fe9fa66
put empty lines back in
lizk886 Sep 11, 2025
2389d7b
cloudsyncverticale
lizk886 Sep 11, 2025
1659c4f
format'
lizk886 Sep 11, 2025
d808f6d
format'
lizk886 Sep 11, 2025
1ef3f1c
format'
lizk886 Sep 11, 2025
a8ecc17
format'
lizk886 Sep 11, 2025
6afccdc
format'
lizk886 Sep 11, 2025
c0e3abb
format'
lizk886 Sep 11, 2025
bb674aa
use the latest version operator is using
lizk886 Sep 18, 2025
c870e74
[CI Pipeline] Released Snapshot version: 11.1.14-alpha-304-SNAPSHOT
Sep 18, 2025
84697d4
count total optout files downloaded
lizk886 Sep 18, 2025
c5c7464
update shared version back to main
lizk886 Sep 19, 2025
92a6a75
Merge branch 'wzh-UID2-6049-add-startup-timer-s3-new' of github.com:I…
lizk886 Sep 19, 2025
0f6d1e7
[CI Pipeline] Released Snapshot version: 11.1.17-alpha-306-SNAPSHOT
Sep 19, 2025
4907dfb
Merge branch 'wzh-UID2-6049-add-startup-timer-s3-new' of github.com:I…
lizk886 Sep 19, 2025
101feca
format
lizk886 Sep 19, 2025
72c41c0
update timer for optout s3 download, need to double check logger level
lizk886 Sep 20, 2025
b99a80b
remove sync time record
lizk886 Sep 20, 2025
1b0f71c
remove sync time record
lizk886 Sep 20, 2025
04744a8
record time in clouddownload blocking to get exact time from cloudsto…
lizk886 Sep 20, 2025
58a322f
rewrite optout download individual file timer
lizk886 Sep 22, 2025
e4c24c2
rewrite optout download individual file timer
lizk886 Sep 22, 2025
2d24aa8
rewrite optout download individual file timer
lizk886 Sep 22, 2025
d4bc65c
remove redundant lines
lizk886 Sep 22, 2025
f354aa1
rewrite store provider, 1 record store durations metric 2 have salt d…
lizk886 Sep 22, 2025
6ddcdf0
formatting
lizk886 Sep 22, 2025
b06686b
formatting
lizk886 Sep 22, 2025
c099720
formatting
lizk886 Sep 22, 2025
11f1350
formatting
lizk886 Sep 22, 2025
51797f1
formatting
lizk886 Sep 22, 2025
a38a441
formatting
lizk886 Sep 22, 2025
86474eb
formatting
lizk886 Sep 22, 2025
8ed436c
formatting
lizk886 Sep 22, 2025
2c4bca6
formatting
lizk886 Sep 22, 2025
56341cd
[CI Pipeline] Released Snapshot version: 11.1.18-alpha-307-SNAPSHOT
Sep 22, 2025
650416c
update metric name to be more accurate
lizk886 Sep 22, 2025
a032b3f
Merge branch 'wzh-UID2-6049-add-startup-timer-s3-new' of github.com:I…
lizk886 Sep 22, 2025
ea89907
[CI Pipeline] Released Snapshot version: 11.1.19-alpha-309-SNAPSHOT
Sep 22, 2025
fe80966
don't need salt file path, information is enough
lizk886 Sep 22, 2025
6c1061f
Merge branch 'wzh-UID2-6049-add-startup-timer-s3-new' of github.com:I…
lizk886 Sep 22, 2025
545a067
Update version from 11.1.19-alpha-309-SNAPSHOT to 11.1.16
lizk886 Sep 22, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,11 @@ private SaltSnapshot loadSnapshot(JsonObject spec, String firstLevelSalt, SaltFi

final String path = spec.getString("location");
Integer size = spec.getInteger("size");

final long downloadStart = System.currentTimeMillis();
SaltEntry[] entries = readInputStream(this.contentStreamProvider.download(path), saltFileParser, size);
final long downloadEnd = System.currentTimeMillis();
LOGGER.info("Salt file downloaded in {} ms", downloadEnd - downloadStart);

LOGGER.info("Loaded {} salts", size);
return new SaltSnapshot(effective, expires, entries, firstLevelSalt);
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/com/uid2/shared/vertx/CloudSyncVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.uid2.shared.health.HealthManager;
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.Timer;
import io.micrometer.core.instrument.Metrics;
import io.vertx.core.*;
import io.vertx.core.eventbus.Message;
Expand Down Expand Up @@ -44,6 +45,8 @@ public class CloudSyncVerticle extends AbstractVerticle {
private final Counter counterDownloadFailures;
private final Counter counterUploadFailures;
private final Gauge gaugeConsecutiveRefreshFailures;
private final Timer downloadSuccessTimer;
private final Timer downloadFailureTimer;

private final String name;
private final ICloudStorage cloudStorage;
Expand Down Expand Up @@ -148,6 +151,10 @@ public CloudSyncVerticle(String name, ICloudStorage cloudStorage, ICloudStorage
.tag("store", name)
.description("gauge for number of consecutive " + name + " store refresh failures")
.register(Metrics.globalRegistry);

this.downloadSuccessTimer = Metrics.timer("uid2_cloud_download_duration", "store_name", name, "status", "success");

this.downloadFailureTimer = Metrics.timer("uid2_cloud_download_duration", "store_name", name, "status", "failure");
}

@Override
Expand Down Expand Up @@ -379,13 +386,24 @@ private Future<Void> cloudDownloadFile(String s3Path) {
}

private void cloudDownloadBlocking(Promise<Void> promise, String s3Path) {
final long cloudDownloadStart = System.nanoTime();
try {
String localPath = this.cloudSync.toLocalPath(s3Path);
try (InputStream cloudInput = this.cloudStorage.download(s3Path)) {
final long cloudDownloadEnd = System.nanoTime();
final long cloudDownloadTimeMs = (cloudDownloadEnd - cloudDownloadStart) / 1_000_000;

this.localStorage.upload(cloudInput, localPath);

downloadSuccessTimer.record(java.time.Duration.ofMillis(cloudDownloadTimeMs));
LOGGER.info("S3 download completed: {} in {} ms", cloudStorage.mask(s3Path), cloudDownloadTimeMs);
}
promise.complete();
} catch (Exception ex) {
final long cloudDownloadEnd = System.nanoTime();
final long cloudDownloadTimeMs = (cloudDownloadEnd - cloudDownloadStart) / 1_000_000;

downloadFailureTimer.record(java.time.Duration.ofMillis(cloudDownloadTimeMs));
// Be careful as the s3Path may contain the pre-signed S3 token, so do not log the whole path
LOGGER.error("download error: " + ex.getClass().getSimpleName());
promise.fail(new Throwable(ex));
Expand Down
10 changes: 9 additions & 1 deletion src/main/java/com/uid2/shared/vertx/RotatingStoreVerticle.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import io.micrometer.core.instrument.Counter;
import io.micrometer.core.instrument.Gauge;
import io.micrometer.core.instrument.Metrics;
import io.micrometer.core.instrument.Timer;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;
import io.vertx.core.json.JsonObject;
Expand All @@ -19,6 +20,7 @@ public class RotatingStoreVerticle extends AbstractVerticle {
private static final Logger LOGGER = LoggerFactory.getLogger(RotatingStoreVerticle.class);
private final String storeName;
private final HealthComponent healthComponent;
private final Timer storeRefreshTimer;
private final Counter counterStoreRefreshTimeMs;
private final Counter counterStoreRefreshed;
private final Gauge gaugeStoreVersion;
Expand Down Expand Up @@ -69,6 +71,7 @@ public RotatingStoreVerticle(String storeName, long refreshIntervalMs, IMetadata
.register(Metrics.globalRegistry);
this.versionedStore = versionedStore;
this.refreshIntervalMs = refreshIntervalMs;
this.storeRefreshTimer = Metrics.timer("uid2_store_refresh_duration", "store_name", storeName);
}

@Override
Expand All @@ -79,6 +82,7 @@ public void start(Promise<Void> startPromise) throws Exception {

private void startRefresh(Promise<Void> promise) {
LOGGER.info("Starting " + this.storeName + " loading");
final long startupRefreshStart = System.nanoTime();
vertx.executeBlocking(p -> {
try {
this.refresh();
Expand All @@ -87,9 +91,13 @@ private void startRefresh(Promise<Void> promise) {
p.fail(e);
}
}, ar -> {
final long startupRefreshEnd = System.nanoTime();
final long startupRefreshTimeMs = (startupRefreshEnd - startupRefreshStart) / 1000000;

if (ar.succeeded()) {
this.healthComponent.setHealthStatus(true);
promise.complete();
storeRefreshTimer.record(java.time.Duration.ofMillis(startupRefreshTimeMs));
LOGGER.info("Successful " + this.storeName + " loading. Starting Background Refresh");
this.startBackgroundRefresh();
} else {
Expand Down Expand Up @@ -140,4 +148,4 @@ public synchronized void refresh() throws Exception {
LOGGER.info("Successfully loaded " + this.storeName + " version " + version);
}
}
}
}
Loading