Skip to content

Commit 8cf7b08

Browse files
authored
feat(async search): add export async search docs method (#473)
1 parent 38bb573 commit 8cf7b08

11 files changed

Lines changed: 1260 additions & 187 deletions

File tree

api/seqproxyapi/v1/seq_proxy_api.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,14 @@ service SeqProxyApi {
112112
body: "*"
113113
};
114114
}
115+
116+
// Stream documents for given async search ID.
117+
rpc ExportAsyncSearch(ExportAsyncSearchRequest) returns (stream ExportResponse) {
118+
option (google.api.http) = {
119+
post: "/async-searches/export"
120+
body: "*"
121+
};
122+
}
115123
}
116124

117125
// Custom error code, returned by seq-db proxy.
@@ -419,6 +427,12 @@ message ExportRequest {
419427
int64 offset = 3; // Search offset.
420428
}
421429

430+
message ExportAsyncSearchRequest {
431+
string search_id = 1;
432+
int64 size = 2;
433+
int64 offset = 3;
434+
}
435+
422436
message ExportResponse {
423437
Document doc = 1; // Response document.
424438
}

asyncsearcher/metrics.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ package asyncsearcher
33
import (
44
"github.com/prometheus/client_golang/prometheus"
55
"github.com/prometheus/client_golang/prometheus/promauto"
6+
7+
"github.com/ozontech/seq-db/metric"
68
)
79

810
var (
@@ -48,4 +50,25 @@ var (
4850
Name: "panics_total",
4951
Help: "Number of panics in async search",
5052
})
53+
54+
ExportDuration = promauto.NewHistogramVec(prometheus.HistogramOpts{
55+
Namespace: "seq_db_ingestor",
56+
Subsystem: "async_search",
57+
Name: "export_duration_seconds",
58+
Help: "Time taken to export data by protocol in seconds",
59+
Buckets: metric.SecondsBucketsDoublePrecision,
60+
}, []string{"protocol"})
61+
ExportSize = promauto.NewHistogramVec(prometheus.HistogramOpts{
62+
Namespace: "seq_db_ingestor",
63+
Subsystem: "async_search",
64+
Name: "export_size_bytes",
65+
Help: "Size of exported data by protocol in bytes",
66+
Buckets: prometheus.ExponentialBuckets(10, 3, 20),
67+
}, []string{"protocol"})
68+
CurrentExportersCount = promauto.NewGaugeVec(prometheus.GaugeOpts{
69+
Namespace: "seq_db_ingestor",
70+
Subsystem: "async_search",
71+
Name: "export_current_exporters_in_progress",
72+
Help: "Current number of active exporters in progress by protocol",
73+
}, []string{"protocol"})
5174
)

pkg/seqproxyapi/v1/seq_proxy_api.pb.go

Lines changed: 264 additions & 186 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/seqproxyapi/v1/seq_proxy_api.pb.gw.go

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)