mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-23 23:50:28 -06:00
Merge pull request #1576 from yabinmeng/rm-docker-metrics
Fix the Prometheus Push metrics reporter authentication configuration issue
This commit is contained in:
commit
a50ccc3cac
@ -31,6 +31,7 @@ import java.net.http.HttpRequest;
|
||||
import java.net.http.HttpRequest.BodyPublishers;
|
||||
import java.net.http.HttpResponse;
|
||||
import java.net.http.HttpResponse.BodyHandler;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.time.Clock;
|
||||
import java.time.Duration;
|
||||
@ -98,13 +99,16 @@ public class PromPushReporter extends ScheduledReporter implements NBConfigurabl
|
||||
bearerToken = null;
|
||||
if (optionalApikeyfile.isPresent()) {
|
||||
keyfilePath = optionalApikeyfile.map(Path::of).orElseThrow();
|
||||
logger.info("Reading Bearer Token from %s", keyfilePath);
|
||||
PromPushKeyFileReader keyfile = new PromPushKeyFileReader(keyfilePath);
|
||||
bearerToken = "Bearer " + keyfile.get();
|
||||
if (Files.isRegularFile(keyfilePath)) {
|
||||
logger.info("Reading Bearer Token from %s", keyfilePath);
|
||||
PromPushKeyFileReader keyfile = new PromPushKeyFileReader(keyfilePath);
|
||||
bearerToken = keyfile.get();
|
||||
}
|
||||
} else if (optionalApikey.isPresent()) {
|
||||
bearerToken = "Bearer " + optionalApikey.get();
|
||||
bearerToken = optionalApikey.get();
|
||||
}
|
||||
needsAuth = (null != bearerToken);
|
||||
bearerToken = "Bearer " + bearerToken;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user