use of com.palantir.dialogue.Clients in project dialogue by palantir.
the class Benchmark method addEndpointChannel.
public BenchmarkTimingEndpointChannel addEndpointChannel(String client, Endpoint endpoint, Channel channel) {
Preconditions.checkArgument(endpoint.serviceName().equals(SimulationUtils.SERVICE_NAME), "Must have a consistent service name for our graphs to work", SafeArg.of("endpoint", endpoint));
Clients utils = DefaultConjureRuntime.builder().build().clients();
EndpointChannel endpointChannel = utils.bind(channel, endpoint);
BenchmarkTimingEndpointChannel toReturn = new BenchmarkTimingEndpointChannel(simulation, client, endpoint, endpointChannel);
endpointChannels.add(ImmutableNamedEndpointChannel.builder().name(String.format("%s %s", client, endpoint.endpointName())).channel(toReturn).build());
return toReturn;
}
use of com.palantir.dialogue.Clients in project dialogue by palantir.
the class Benchmark method endpoints.
public Benchmark endpoints(Endpoint... endpoints) {
Preconditions.checkNotNull(clients, "Must call client or clients first");
Preconditions.checkNotNull(requestStream, "Must call sendUntil or numRequests first");
Preconditions.checkNotNull(simulation, "Must call .simulation() first");
endpointChannels = new ArrayList<>();
Arrays.stream(clients).forEach(client -> Arrays.stream(endpoints).forEach(endpoint -> addEndpointChannel(client.name(), endpoint, client.channel())));
Random pseudoRandom = new Random(21876781263L);
int count = endpointChannels.size();
endpointChannelChooser = () -> pseudoRandom.nextInt(count);
return this;
}
use of com.palantir.dialogue.Clients in project dialogue by palantir.
the class EndToEndBenchmark method before.
@Setup
public void before() {
undertow = Undertow.builder().addHttpListener(0, "localhost", new ResponseCodeHandler(200)).build();
undertow.start();
TaggedMetricRegistry metrics = new DefaultTaggedMetricRegistry();
blockingExecutor = Tracers.wrap("dialogue-blocking-channel", Executors.newCachedThreadPool(MetricRegistries.instrument(metrics, new ThreadFactoryBuilder().setNameFormat("dialogue-blocking-channel-%d").setDaemon(true).build(), "dialogue-blocking-channel")));
DialogueClients.ReloadingFactory clients = DialogueClients.create(Refreshable.only(null)).withUserAgent(TestConfigurations.AGENT).withTaggedMetrics(metrics).withBlockingExecutor(blockingExecutor);
ServiceConfiguration serviceConf = ServiceConfiguration.builder().addUris(getUri(undertow)).security(TestConfigurations.SSL_CONFIG).build();
blocking = clients.getNonReloading(SampleServiceBlocking.class, serviceConf);
ClientConfiguration clientConf = ClientConfiguration.builder().from(ClientConfigurations.of(serviceConf)).taggedMetricRegistry(metrics).userAgent(TestConfigurations.AGENT).build();
closeableApache = ApacheHttpClientChannels.clientBuilder().executor(blockingExecutor).clientConfiguration(clientConf).clientName("clientName").build();
apacheChannel = ApacheHttpClientChannels.createSingleUri(serviceConf.uris().get(0), closeableApache);
Channel zeroNetworkChannel = DialogueChannel.builder().channelName("goFast").clientConfiguration(clientConf).factory(_uri -> InstantChannel.INSTANCE).buildNonLiveReloading();
zeroNetworkDialogue = SampleServiceBlocking.of(zeroNetworkChannel, DefaultConjureRuntime.builder().build());
}
Aggregations