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

Authorization error fix #67

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
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class MetricConfig {
private static final Property<String> METRIC_FILE_WRITER_INTERVAL_SECONDS = Property.named("METRIC_FILE_WRITER_INTERVAL_SECONDS", "15", "");
private static final Property<String> METRIC_STREAM_WRITER_INTERVAL_SECONDS = Property.named("METRIC_STREAM_WRITER_INTERVAL_SECONDS", "30", "");
private static final Property<String> METRIC_STREAM_NAME = Property.named("METRIC_STREAM_NAME", "pscmetricsstream", "");
private static final Property<String> METRIC_SCOPE_NAME = Property.named("METRIC_SCOPE_NAME", "pscmetricsscope", "");
private static final Property<String> METRIC_CONTROLLER_URI = Property.named("PRAVEGA_CONTROLLER_URI", "tcp://localhost:9090", "");
private static final Property<String> METRIC_FILE_PATH = Property.named("METRIC_FILE_PATH", System.getProperty("java.io.tmpdir") + File.separator + "psc_metric.json", "");

Expand Down Expand Up @@ -121,7 +120,7 @@ public static MetricConfig getMetricConfigFrom(DeviceDriverConfig ddrConfig) {
metricConfig.setStreamWriterIntervalSeconds(Integer.parseInt(ddrConfig.getProperties().getOrDefault(METRIC_STREAM_WRITER_INTERVAL_SECONDS.getName(), METRIC_STREAM_WRITER_INTERVAL_SECONDS.getDefaultValue())));
metricConfig.setMetricStream(ddrConfig.getProperties().getOrDefault(METRIC_STREAM_NAME.getName() + pscId, METRIC_STREAM_NAME.getDefaultValue() + pscId));
metricConfig.setControllerURI(URI.create(ddrConfig.getProperties().getOrDefault(METRIC_CONTROLLER_URI.getName(), METRIC_CONTROLLER_URI.getDefaultValue())));
metricConfig.setMetricsScope(METRIC_SCOPE_NAME.getDefaultValue());
metricConfig.setMetricsScope(ddrConfig.getProperties().get("SCOPE"));
metricConfig.setMetricFilePath(METRIC_FILE_PATH.getDefaultValue());
return metricConfig;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,18 @@ public PravegaClient(String scope, String streamName) {

private EventStreamWriter<String> initializeWriter() {
log.info("Initializing writer with {} {} {}", this.scope, this.streamName, this.controllerURI.toString());
try (StreamManager streamManager = StreamManager.create(controllerURI)) {
final boolean scopeIsNew = streamManager.createScope(scope);
ClientConfig clientConfig = ClientConfig.builder().controllerURI(this.controllerURI).build();
try (StreamManager streamManager = StreamManager.create(clientConfig)) {
StreamConfiguration streamConfig = StreamConfiguration.builder()
.scalingPolicy(ScalingPolicy.fixed(1))
.build();
final boolean streamIsNew = streamManager.createStream(scope, streamName, streamConfig);
}
EventStreamWriter<String> writer;
try (EventStreamClientFactory clientFactory = EventStreamClientFactory.withScope(scope,
ClientConfig.builder().controllerURI(controllerURI).build())) {
writer = clientFactory.createEventWriter(streamName,
new UTF8StringSerializer(),
EventWriterConfig.builder().build());
}
EventStreamClientFactory clientFactory = EventStreamClientFactory.withScope(scope,
clientConfig);
EventStreamWriter<String> writer = clientFactory.createEventWriter(streamName,
new UTF8StringSerializer(),
EventWriterConfig.builder().build());
return writer;
}

Expand Down
Loading