|
21 | 21 | package com.arangodb.async.internal; |
22 | 22 |
|
23 | 23 | import com.arangodb.ArangoDBException; |
| 24 | +import com.arangodb.ArangoMetrics; |
24 | 25 | import com.arangodb.DbName; |
25 | 26 | import com.arangodb.async.ArangoDBAsync; |
26 | 27 | import com.arangodb.async.ArangoDatabaseAsync; |
@@ -68,18 +69,22 @@ public ArangoDBAsyncImpl( |
68 | 69 | final HostResolver syncHostResolver, |
69 | 70 | final HostHandler asyncHostHandler, |
70 | 71 | final HostHandler syncHostHandler, |
71 | | - final ArangoContext context |
| 72 | + final ArangoContext context, |
| 73 | + final int responseQueueTimeSamples, |
| 74 | + final int timeoutMs |
72 | 75 | ) { |
73 | 76 |
|
74 | | - super(new ArangoExecutorAsync(asyncCommBuilder.build(util.get(Serializer.INTERNAL)), util, new DocumentCache()), util, context); |
| 77 | + super(new ArangoExecutorAsync(asyncCommBuilder.build(util.get(Serializer.INTERNAL)), util, new DocumentCache(), |
| 78 | + new QueueTimeMetricsImpl(responseQueueTimeSamples), timeoutMs), util, context); |
75 | 79 |
|
76 | 80 | final VstCommunication<Response, VstConnectionSync> cacheCom = syncCommBuilder.build(util.get(Serializer.INTERNAL)); |
77 | 81 |
|
78 | 82 | cp = new VstProtocol(cacheCom); |
79 | 83 | this.asyncHostHandler = asyncHostHandler; |
80 | 84 | this.syncHostHandler = syncHostHandler; |
81 | 85 |
|
82 | | - ArangoExecutorSync arangoExecutorSync = new ArangoExecutorSync(cp, util, new DocumentCache()); |
| 86 | + ArangoExecutorSync arangoExecutorSync = new ArangoExecutorSync(cp, util, new DocumentCache(), |
| 87 | + new QueueTimeMetricsImpl(responseQueueTimeSamples), timeoutMs); |
83 | 88 | asyncHostResolver.init(arangoExecutorSync, util.get(Serializer.INTERNAL)); |
84 | 89 | syncHostResolver.init(arangoExecutorSync, util.get(Serializer.INTERNAL)); |
85 | 90 |
|
@@ -121,6 +126,11 @@ public ArangoDatabaseAsync db(final DbName name) { |
121 | 126 | return new ArangoDatabaseAsyncImpl(this, name); |
122 | 127 | } |
123 | 128 |
|
| 129 | + @Override |
| 130 | + public ArangoMetrics metrics() { |
| 131 | + return new ArangoMetricsImpl(executor.getQueueTimeMetrics()); |
| 132 | + } |
| 133 | + |
124 | 134 | @Override |
125 | 135 | public CompletableFuture<Boolean> createDatabase(final DbName name) { |
126 | 136 | return createDatabase(new DBCreateOptions().name(name)); |
|
0 commit comments