mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2024-12-23 15:40:44 -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,15 +99,18 @@ 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
|
||||
public synchronized void report(
|
||||
SortedMap<String, Gauge> gauges,
|
||||
|
Loading…
Reference in New Issue
Block a user