@lancedb/lancedb 0.31.0 → 0.32.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +39 -2
- package/dist/index.js +16 -1
- package/dist/indices.d.ts +6 -1
- package/dist/native.d.ts +62 -0
- package/dist/native.js +56 -52
- package/dist/otel.d.ts +26 -0
- package/dist/otel.js +114 -0
- package/dist/table.d.ts +39 -0
- package/dist/table.js +9 -0
- package/package.json +10 -8
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { Connection } from "./connection";
|
|
2
2
|
import { ConnectNamespaceOptions, ConnectionOptions, Session } from "./native.js";
|
|
3
3
|
import { HeaderProvider } from "./header";
|
|
4
|
+
import type { BaseTokenizer } from "./indices";
|
|
5
|
+
import type { FtsToken } from "./table";
|
|
4
6
|
export { JsHeaderProvider as NativeJsHeaderProvider } from "./native.js";
|
|
7
|
+
export { instrumentLanceDbMetrics } from "./otel";
|
|
5
8
|
export { AddColumnsSql, ConnectionOptions, ConnectNamespaceOptions, IndexStatistics, IndexConfig, ClientConfig, TimeoutConfig, RetryConfig, TlsConfig, OptimizeStats, CompactionStats, RemovalStats, TableStatistics, FragmentStatistics, FragmentSummaryStats, Tags, TagContents, BranchContents, MergeResult, AddResult, AddColumnsResult, AlterColumnsResult, UpdateFieldMetadataResult, DeleteResult, DropColumnsResult, UpdateResult, SplitCalculatedOptions, SplitRandomOptions, SplitHashOptions, SplitSequentialOptions, ShuffleOptions, OAuthConfig as NativeOAuthConfig, } from "./native.js";
|
|
6
9
|
export { makeArrowTable, MakeArrowTableOptions, Data, VectorColumnOptions, } from "./arrow";
|
|
7
10
|
export { Connection, CreateTableOptions, TableNamesOptions, OpenTableOptions, ListNamespacesOptions, CreateNamespaceOptions, DropNamespaceOptions, ListNamespacesResponse, CreateNamespaceResponse, DropNamespaceResponse, DescribeNamespaceResponse, RenameTableOptions, } from "./connection";
|
|
8
11
|
export { Session } from "./native.js";
|
|
9
12
|
export { ExecutableQuery, Query, QueryBase, VectorQuery, TakeQuery, QueryExecutionOptions, ColumnOrdering, FullTextSearchOptions, RecordBatchIterator, FullTextQuery, MatchQuery, PhraseQuery, BoostQuery, MultiMatchQuery, BooleanQuery, FullTextQueryType, Operator, Occur, } from "./query";
|
|
10
|
-
export { Index, IndexOptions, IvfPqOptions, IvfRqOptions, IvfFlatOptions, HnswPqOptions, HnswSqOptions, FtsOptions, } from "./indices";
|
|
11
|
-
export { Table, Branches, AddDataOptions, UpdateOptions, OptimizeOptions, Version, WriteProgress, LsmWriteSpec, ColumnAlteration, FieldMetadataUpdate, } from "./table";
|
|
13
|
+
export { Index, IndexOptions, IvfPqOptions, IvfRqOptions, IvfFlatOptions, HnswPqOptions, HnswSqOptions, FtsOptions, BaseTokenizer, } from "./indices";
|
|
14
|
+
export { Table, Branches, AddDataOptions, UpdateOptions, OptimizeOptions, Version, WriteProgress, FtsToken, TokenizeTableOptions, LsmWriteSpec, ColumnAlteration, FieldMetadataUpdate, } from "./table";
|
|
12
15
|
export { HeaderProvider, StaticHeaderProvider, OAuthHeaderProvider, TokenResponse, } from "./header";
|
|
13
16
|
export { OAuthConfig, OAuthFlowType } from "./oauth";
|
|
14
17
|
export { MergeInsertBuilder, WriteExecutionOptions } from "./merge";
|
|
@@ -18,6 +21,40 @@ export { Scannable, ScannableOptions } from "./scannable";
|
|
|
18
21
|
export * as rerankers from "./rerankers";
|
|
19
22
|
export { SchemaLike, TableLike, FieldLike, RecordBatchLike, DataLike, IntoVector, MultiVector, } from "./arrow";
|
|
20
23
|
export { IntoSql, packBits } from "./util";
|
|
24
|
+
/**
|
|
25
|
+
* Options for tokenizing a full-text search query without a table index.
|
|
26
|
+
*/
|
|
27
|
+
export interface TokenizeOptions {
|
|
28
|
+
/**
|
|
29
|
+
* The tokenizer to use. The default is "simple".
|
|
30
|
+
*/
|
|
31
|
+
baseTokenizer?: BaseTokenizer;
|
|
32
|
+
/** Language for stemming and stop words. */
|
|
33
|
+
language?: string;
|
|
34
|
+
/** Maximum token length; tokens longer than this are ignored. */
|
|
35
|
+
maxTokenLength?: number;
|
|
36
|
+
/** Whether to lowercase tokens. */
|
|
37
|
+
lowercase?: boolean;
|
|
38
|
+
/** Whether to stem tokens. */
|
|
39
|
+
stem?: boolean;
|
|
40
|
+
/** Whether to remove stop words. */
|
|
41
|
+
removeStopWords?: boolean;
|
|
42
|
+
/** Whether to fold ASCII characters. */
|
|
43
|
+
asciiFolding?: boolean;
|
|
44
|
+
/** N-gram minimum length. */
|
|
45
|
+
ngramMinLength?: number;
|
|
46
|
+
/** N-gram maximum length. */
|
|
47
|
+
ngramMaxLength?: number;
|
|
48
|
+
/** Whether to only emit token prefixes for the n-gram tokenizer. */
|
|
49
|
+
prefixOnly?: boolean;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Tokenize a full-text search query using an explicit tokenizer.
|
|
53
|
+
*
|
|
54
|
+
* This does not require a table or FTS index. The tokenizer options match
|
|
55
|
+
* {@link Index.fts}.
|
|
56
|
+
*/
|
|
57
|
+
export declare function tokenize(query: string, options?: Partial<TokenizeOptions>): Promise<FtsToken[]>;
|
|
21
58
|
/**
|
|
22
59
|
* Connect to a LanceDB instance at the given URI.
|
|
23
60
|
*
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthFlowType = exports.OAuthHeaderProvider = exports.StaticHeaderProvider = exports.HeaderProvider = exports.Branches = exports.Table = exports.Index = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.TakeQuery = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Session = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.NativeJsHeaderProvider = void 0;
|
|
5
|
+
exports.packBits = exports.rerankers = exports.Scannable = exports.PermutationBuilder = exports.permutationBuilder = exports.embedding = exports.MergeInsertBuilder = exports.OAuthFlowType = exports.OAuthHeaderProvider = exports.StaticHeaderProvider = exports.HeaderProvider = exports.Branches = exports.Table = exports.Index = exports.Occur = exports.Operator = exports.FullTextQueryType = exports.BooleanQuery = exports.MultiMatchQuery = exports.BoostQuery = exports.PhraseQuery = exports.MatchQuery = exports.RecordBatchIterator = exports.TakeQuery = exports.VectorQuery = exports.QueryBase = exports.Query = exports.Session = exports.Connection = exports.VectorColumnOptions = exports.MakeArrowTableOptions = exports.makeArrowTable = exports.BranchContents = exports.TagContents = exports.Tags = exports.instrumentLanceDbMetrics = exports.NativeJsHeaderProvider = void 0;
|
|
6
|
+
exports.tokenize = tokenize;
|
|
6
7
|
exports.connect = connect;
|
|
7
8
|
exports.connectNamespace = connectNamespace;
|
|
8
9
|
const connection_1 = require("./connection");
|
|
@@ -10,6 +11,11 @@ const native_js_1 = require("./native.js");
|
|
|
10
11
|
// Re-export native header provider for use with connectWithHeaderProvider
|
|
11
12
|
var native_js_2 = require("./native.js");
|
|
12
13
|
Object.defineProperty(exports, "NativeJsHeaderProvider", { enumerable: true, get: function () { return native_js_2.JsHeaderProvider; } });
|
|
14
|
+
// OpenTelemetry metrics bridge. Only the high-level entry point is public; the
|
|
15
|
+
// underlying recorder/catalog/snapshot functions remain internal plumbing that
|
|
16
|
+
// `otel.ts` consumes from the native module.
|
|
17
|
+
var otel_1 = require("./otel");
|
|
18
|
+
Object.defineProperty(exports, "instrumentLanceDbMetrics", { enumerable: true, get: function () { return otel_1.instrumentLanceDbMetrics; } });
|
|
13
19
|
var native_js_3 = require("./native.js");
|
|
14
20
|
Object.defineProperty(exports, "Tags", { enumerable: true, get: function () { return native_js_3.Tags; } });
|
|
15
21
|
Object.defineProperty(exports, "TagContents", { enumerable: true, get: function () { return native_js_3.TagContents; } });
|
|
@@ -58,6 +64,15 @@ Object.defineProperty(exports, "Scannable", { enumerable: true, get: function ()
|
|
|
58
64
|
exports.rerankers = require("./rerankers");
|
|
59
65
|
var util_1 = require("./util");
|
|
60
66
|
Object.defineProperty(exports, "packBits", { enumerable: true, get: function () { return util_1.packBits; } });
|
|
67
|
+
/**
|
|
68
|
+
* Tokenize a full-text search query using an explicit tokenizer.
|
|
69
|
+
*
|
|
70
|
+
* This does not require a table or FTS index. The tokenizer options match
|
|
71
|
+
* {@link Index.fts}.
|
|
72
|
+
*/
|
|
73
|
+
async function tokenize(query, options) {
|
|
74
|
+
return await (0, native_js_1.tokenize)(query, options?.baseTokenizer, options?.language, options?.maxTokenLength, options?.lowercase, options?.stem, options?.removeStopWords, options?.asciiFolding, options?.ngramMinLength, options?.ngramMaxLength, options?.prefixOnly);
|
|
75
|
+
}
|
|
61
76
|
async function connect(uriOrOptions, optionsOrSession, sessionOrHeaderProvider, headerProvider) {
|
|
62
77
|
let uri;
|
|
63
78
|
let finalOptions = {};
|
package/dist/indices.d.ts
CHANGED
|
@@ -453,6 +453,7 @@ export interface IvfFlatOptions {
|
|
|
453
453
|
*/
|
|
454
454
|
sampleRate?: number;
|
|
455
455
|
}
|
|
456
|
+
export type BaseTokenizer = "simple" | "whitespace" | "raw" | "ngram" | "icu" | "icu/split" | `jieba/${string}` | `lindera/${string}`;
|
|
456
457
|
/**
|
|
457
458
|
* Options to create a full text search index
|
|
458
459
|
*/
|
|
@@ -475,8 +476,12 @@ export interface FtsOptions {
|
|
|
475
476
|
* "whitespace" - Whitespace tokenizer. This tokenizer splits the text into tokens using whitespace as a delimiter.
|
|
476
477
|
*
|
|
477
478
|
* "raw" - Raw tokenizer. This tokenizer does not split the text into tokens and indexes the entire text as a single token.
|
|
479
|
+
*
|
|
480
|
+
* "icu" - ICU dictionary-based word segmentation.
|
|
481
|
+
*
|
|
482
|
+
* "icu/split" - ICU segmentation with simple-style delimiter splitting.
|
|
478
483
|
*/
|
|
479
|
-
baseTokenizer?:
|
|
484
|
+
baseTokenizer?: BaseTokenizer;
|
|
480
485
|
/**
|
|
481
486
|
* language for stemming and stop words
|
|
482
487
|
* this is only used when `stem` or `remove_stop_words` is true
|
package/dist/native.d.ts
CHANGED
|
@@ -235,6 +235,7 @@ export declare class Table {
|
|
|
235
235
|
setUnenforcedPrimaryKey(columns: Array<string>): Promise<void>
|
|
236
236
|
setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>
|
|
237
237
|
unsetLsmWriteSpec(): Promise<void>
|
|
238
|
+
getLsmWriteSpec(): Promise<LsmWriteSpec | null>
|
|
238
239
|
closeLsmWriters(): Promise<void>
|
|
239
240
|
version(): Promise<number>
|
|
240
241
|
checkout(version: number): Promise<void>
|
|
@@ -248,6 +249,7 @@ export declare class Table {
|
|
|
248
249
|
currentBranch(): string | null
|
|
249
250
|
optimize(olderThanMs?: number | undefined | null, deleteUnverified?: boolean | undefined | null): Promise<OptimizeStats>
|
|
250
251
|
listIndices(): Promise<Array<IndexConfig>>
|
|
252
|
+
tokenize(query: string, column?: string | undefined | null, indexName?: string | undefined | null): Promise<Array<FtsToken>>
|
|
251
253
|
indexStats(indexName: string): Promise<IndexStatistics | null>
|
|
252
254
|
mergeInsert(on: Array<string>): NativeMergeInsertBuilder
|
|
253
255
|
usesV2ManifestPaths(): Promise<boolean>
|
|
@@ -553,6 +555,14 @@ export interface FragmentSummaryStats {
|
|
|
553
555
|
p99: number
|
|
554
556
|
}
|
|
555
557
|
|
|
558
|
+
/** A token produced by the tokenizer configured on a full-text search index. */
|
|
559
|
+
export interface FtsToken {
|
|
560
|
+
/** The token text after the index tokenizer has applied its filters. */
|
|
561
|
+
text: string
|
|
562
|
+
/** The token position used by full-text query matching. */
|
|
563
|
+
position: number
|
|
564
|
+
}
|
|
565
|
+
|
|
556
566
|
/** A description of an index currently configured on a column */
|
|
557
567
|
export interface IndexConfig {
|
|
558
568
|
/** The name of the index */
|
|
@@ -640,6 +650,9 @@ export interface IndexStatistics {
|
|
|
640
650
|
numIndices?: number
|
|
641
651
|
}
|
|
642
652
|
|
|
653
|
+
/** The catalog of described LanceDB metrics. Empty until the recorder is installed. */
|
|
654
|
+
export declare function lancedbMetricsCatalog(): Array<MetricDescription>
|
|
655
|
+
|
|
643
656
|
export interface ListNamespacesResponse {
|
|
644
657
|
namespaces: Array<string>
|
|
645
658
|
pageToken?: string
|
|
@@ -675,6 +688,37 @@ export interface MergeResult {
|
|
|
675
688
|
numRows: number
|
|
676
689
|
}
|
|
677
690
|
|
|
691
|
+
/** One cumulative histogram bucket: all samples with value `<= le`. */
|
|
692
|
+
export interface MetricBucket {
|
|
693
|
+
/** The inclusive upper bound of the bucket, or `"+Inf"` for the final bucket. */
|
|
694
|
+
le: string
|
|
695
|
+
/** Cumulative number of samples less than or equal to `le`. */
|
|
696
|
+
cumulativeCount: number
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
/** A described metric, used by the JavaScript layer to create instruments up front. */
|
|
700
|
+
export interface MetricDescription {
|
|
701
|
+
name: string
|
|
702
|
+
kind: string
|
|
703
|
+
unit?: string
|
|
704
|
+
description: string
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/**
|
|
708
|
+
* One aggregated metric data point. For counters and gauges only `value` is
|
|
709
|
+
* set; for histograms `buckets` (cumulative `le` counts), `count`, and `sum`
|
|
710
|
+
* are set.
|
|
711
|
+
*/
|
|
712
|
+
export interface MetricPoint {
|
|
713
|
+
name: string
|
|
714
|
+
kind: string
|
|
715
|
+
attributes: Record<string, string>
|
|
716
|
+
value?: number
|
|
717
|
+
buckets?: Array<MetricBucket>
|
|
718
|
+
count?: number
|
|
719
|
+
sum?: number
|
|
720
|
+
}
|
|
721
|
+
|
|
678
722
|
/**
|
|
679
723
|
* OAuth configuration for LanceDB authentication.
|
|
680
724
|
*
|
|
@@ -725,6 +769,15 @@ export interface OptimizeStats {
|
|
|
725
769
|
/** Create a permutation builder for the given table */
|
|
726
770
|
export declare function permutationBuilder(table: Table): PermutationBuilder
|
|
727
771
|
|
|
772
|
+
/**
|
|
773
|
+
* Install the LanceDB metrics recorder as the process-global `metrics` recorder.
|
|
774
|
+
*
|
|
775
|
+
* Returns `true` if the recorder is installed (now or previously). Returns
|
|
776
|
+
* `false` if a *different* recorder is already installed — `metrics` allows
|
|
777
|
+
* only one global recorder per process, so LanceDB cannot coexist with another.
|
|
778
|
+
*/
|
|
779
|
+
export declare function registerLancedbMetricsRecorder(): boolean
|
|
780
|
+
|
|
728
781
|
/** Statistics about a cleanup operation */
|
|
729
782
|
export interface RemovalStats {
|
|
730
783
|
/** The number of bytes removed */
|
|
@@ -793,6 +846,12 @@ export interface ShuffleOptions {
|
|
|
793
846
|
clumpSize?: number
|
|
794
847
|
}
|
|
795
848
|
|
|
849
|
+
/**
|
|
850
|
+
* A point-in-time snapshot of every recorded metric. Empty until the recorder
|
|
851
|
+
* is installed.
|
|
852
|
+
*/
|
|
853
|
+
export declare function snapshotLancedbMetrics(): Array<MetricPoint>
|
|
854
|
+
|
|
796
855
|
export interface SplitCalculatedOptions {
|
|
797
856
|
calculation: string
|
|
798
857
|
splitNames?: Array<string>
|
|
@@ -810,6 +869,7 @@ export interface SplitRandomOptions {
|
|
|
810
869
|
counts?: Array<number>
|
|
811
870
|
fixed?: number
|
|
812
871
|
seed?: number
|
|
872
|
+
clumpSize?: number
|
|
813
873
|
splitNames?: Array<string>
|
|
814
874
|
}
|
|
815
875
|
|
|
@@ -874,6 +934,8 @@ export interface TlsConfig {
|
|
|
874
934
|
assertHostname?: boolean
|
|
875
935
|
}
|
|
876
936
|
|
|
937
|
+
export declare function tokenize(query: string, baseTokenizer?: string | undefined | null, language?: string | undefined | null, maxTokenLength?: number | undefined | null, lowerCase?: boolean | undefined | null, stem?: boolean | undefined | null, removeStopWords?: boolean | undefined | null, asciiFolding?: boolean | undefined | null, ngramMinLength?: number | undefined | null, ngramMaxLength?: number | undefined | null, prefixOnly?: boolean | undefined | null): Array<FtsToken>
|
|
938
|
+
|
|
877
939
|
export interface UpdateFieldMetadataResult {
|
|
878
940
|
version: number
|
|
879
941
|
}
|
package/dist/native.js
CHANGED
|
@@ -76,8 +76,8 @@ function requireNative() {
|
|
|
76
76
|
try {
|
|
77
77
|
const binding = require('@lancedb/lancedb-android-arm64');
|
|
78
78
|
const bindingPackageVersion = require('@lancedb/lancedb-android-arm64/package.json').version;
|
|
79
|
-
if (bindingPackageVersion !== '0.
|
|
80
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
79
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
80
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
81
81
|
}
|
|
82
82
|
return binding;
|
|
83
83
|
}
|
|
@@ -95,8 +95,8 @@ function requireNative() {
|
|
|
95
95
|
try {
|
|
96
96
|
const binding = require('@lancedb/lancedb-android-arm-eabi');
|
|
97
97
|
const bindingPackageVersion = require('@lancedb/lancedb-android-arm-eabi/package.json').version;
|
|
98
|
-
if (bindingPackageVersion !== '0.
|
|
99
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
98
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
99
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
100
100
|
}
|
|
101
101
|
return binding;
|
|
102
102
|
}
|
|
@@ -120,8 +120,8 @@ function requireNative() {
|
|
|
120
120
|
try {
|
|
121
121
|
const binding = require('@lancedb/lancedb-win32-x64-gnu');
|
|
122
122
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-gnu/package.json').version;
|
|
123
|
-
if (bindingPackageVersion !== '0.
|
|
124
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
123
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
124
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
125
125
|
}
|
|
126
126
|
return binding;
|
|
127
127
|
}
|
|
@@ -139,8 +139,8 @@ function requireNative() {
|
|
|
139
139
|
try {
|
|
140
140
|
const binding = require('@lancedb/lancedb-win32-x64-msvc');
|
|
141
141
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-x64-msvc/package.json').version;
|
|
142
|
-
if (bindingPackageVersion !== '0.
|
|
143
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
142
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
143
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
144
144
|
}
|
|
145
145
|
return binding;
|
|
146
146
|
}
|
|
@@ -159,8 +159,8 @@ function requireNative() {
|
|
|
159
159
|
try {
|
|
160
160
|
const binding = require('@lancedb/lancedb-win32-ia32-msvc');
|
|
161
161
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-ia32-msvc/package.json').version;
|
|
162
|
-
if (bindingPackageVersion !== '0.
|
|
163
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
162
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
163
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
164
164
|
}
|
|
165
165
|
return binding;
|
|
166
166
|
}
|
|
@@ -178,8 +178,8 @@ function requireNative() {
|
|
|
178
178
|
try {
|
|
179
179
|
const binding = require('@lancedb/lancedb-win32-arm64-msvc');
|
|
180
180
|
const bindingPackageVersion = require('@lancedb/lancedb-win32-arm64-msvc/package.json').version;
|
|
181
|
-
if (bindingPackageVersion !== '0.
|
|
182
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
181
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
182
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
183
183
|
}
|
|
184
184
|
return binding;
|
|
185
185
|
}
|
|
@@ -201,8 +201,8 @@ function requireNative() {
|
|
|
201
201
|
try {
|
|
202
202
|
const binding = require('@lancedb/lancedb-darwin-universal');
|
|
203
203
|
const bindingPackageVersion = require('@lancedb/lancedb-darwin-universal/package.json').version;
|
|
204
|
-
if (bindingPackageVersion !== '0.
|
|
205
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
204
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
205
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
206
206
|
}
|
|
207
207
|
return binding;
|
|
208
208
|
}
|
|
@@ -219,8 +219,8 @@ function requireNative() {
|
|
|
219
219
|
try {
|
|
220
220
|
const binding = require('@lancedb/lancedb-darwin-x64');
|
|
221
221
|
const bindingPackageVersion = require('@lancedb/lancedb-darwin-x64/package.json').version;
|
|
222
|
-
if (bindingPackageVersion !== '0.
|
|
223
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
222
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
223
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
224
224
|
}
|
|
225
225
|
return binding;
|
|
226
226
|
}
|
|
@@ -238,8 +238,8 @@ function requireNative() {
|
|
|
238
238
|
try {
|
|
239
239
|
const binding = require('@lancedb/lancedb-darwin-arm64');
|
|
240
240
|
const bindingPackageVersion = require('@lancedb/lancedb-darwin-arm64/package.json').version;
|
|
241
|
-
if (bindingPackageVersion !== '0.
|
|
242
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
241
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
242
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
243
243
|
}
|
|
244
244
|
return binding;
|
|
245
245
|
}
|
|
@@ -262,8 +262,8 @@ function requireNative() {
|
|
|
262
262
|
try {
|
|
263
263
|
const binding = require('@lancedb/lancedb-freebsd-x64');
|
|
264
264
|
const bindingPackageVersion = require('@lancedb/lancedb-freebsd-x64/package.json').version;
|
|
265
|
-
if (bindingPackageVersion !== '0.
|
|
266
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
265
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
266
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
267
267
|
}
|
|
268
268
|
return binding;
|
|
269
269
|
}
|
|
@@ -281,8 +281,8 @@ function requireNative() {
|
|
|
281
281
|
try {
|
|
282
282
|
const binding = require('@lancedb/lancedb-freebsd-arm64');
|
|
283
283
|
const bindingPackageVersion = require('@lancedb/lancedb-freebsd-arm64/package.json').version;
|
|
284
|
-
if (bindingPackageVersion !== '0.
|
|
285
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
284
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
285
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
286
286
|
}
|
|
287
287
|
return binding;
|
|
288
288
|
}
|
|
@@ -306,8 +306,8 @@ function requireNative() {
|
|
|
306
306
|
try {
|
|
307
307
|
const binding = require('@lancedb/lancedb-linux-x64-musl');
|
|
308
308
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-musl/package.json').version;
|
|
309
|
-
if (bindingPackageVersion !== '0.
|
|
310
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
309
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
310
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
311
311
|
}
|
|
312
312
|
return binding;
|
|
313
313
|
}
|
|
@@ -325,8 +325,8 @@ function requireNative() {
|
|
|
325
325
|
try {
|
|
326
326
|
const binding = require('@lancedb/lancedb-linux-x64-gnu');
|
|
327
327
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-x64-gnu/package.json').version;
|
|
328
|
-
if (bindingPackageVersion !== '0.
|
|
329
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
328
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
329
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
330
330
|
}
|
|
331
331
|
return binding;
|
|
332
332
|
}
|
|
@@ -346,8 +346,8 @@ function requireNative() {
|
|
|
346
346
|
try {
|
|
347
347
|
const binding = require('@lancedb/lancedb-linux-arm64-musl');
|
|
348
348
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-musl/package.json').version;
|
|
349
|
-
if (bindingPackageVersion !== '0.
|
|
350
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
349
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
350
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
351
351
|
}
|
|
352
352
|
return binding;
|
|
353
353
|
}
|
|
@@ -365,8 +365,8 @@ function requireNative() {
|
|
|
365
365
|
try {
|
|
366
366
|
const binding = require('@lancedb/lancedb-linux-arm64-gnu');
|
|
367
367
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm64-gnu/package.json').version;
|
|
368
|
-
if (bindingPackageVersion !== '0.
|
|
369
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
368
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
369
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
370
370
|
}
|
|
371
371
|
return binding;
|
|
372
372
|
}
|
|
@@ -386,8 +386,8 @@ function requireNative() {
|
|
|
386
386
|
try {
|
|
387
387
|
const binding = require('@lancedb/lancedb-linux-arm-musleabihf');
|
|
388
388
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-musleabihf/package.json').version;
|
|
389
|
-
if (bindingPackageVersion !== '0.
|
|
390
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
389
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
390
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
391
391
|
}
|
|
392
392
|
return binding;
|
|
393
393
|
}
|
|
@@ -405,8 +405,8 @@ function requireNative() {
|
|
|
405
405
|
try {
|
|
406
406
|
const binding = require('@lancedb/lancedb-linux-arm-gnueabihf');
|
|
407
407
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-arm-gnueabihf/package.json').version;
|
|
408
|
-
if (bindingPackageVersion !== '0.
|
|
409
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
408
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
409
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
410
410
|
}
|
|
411
411
|
return binding;
|
|
412
412
|
}
|
|
@@ -426,8 +426,8 @@ function requireNative() {
|
|
|
426
426
|
try {
|
|
427
427
|
const binding = require('@lancedb/lancedb-linux-loong64-musl');
|
|
428
428
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-musl/package.json').version;
|
|
429
|
-
if (bindingPackageVersion !== '0.
|
|
430
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
429
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
431
431
|
}
|
|
432
432
|
return binding;
|
|
433
433
|
}
|
|
@@ -445,8 +445,8 @@ function requireNative() {
|
|
|
445
445
|
try {
|
|
446
446
|
const binding = require('@lancedb/lancedb-linux-loong64-gnu');
|
|
447
447
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-loong64-gnu/package.json').version;
|
|
448
|
-
if (bindingPackageVersion !== '0.
|
|
449
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
448
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
449
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
450
450
|
}
|
|
451
451
|
return binding;
|
|
452
452
|
}
|
|
@@ -466,8 +466,8 @@ function requireNative() {
|
|
|
466
466
|
try {
|
|
467
467
|
const binding = require('@lancedb/lancedb-linux-riscv64-musl');
|
|
468
468
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-musl/package.json').version;
|
|
469
|
-
if (bindingPackageVersion !== '0.
|
|
470
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
469
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
470
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
471
471
|
}
|
|
472
472
|
return binding;
|
|
473
473
|
}
|
|
@@ -485,8 +485,8 @@ function requireNative() {
|
|
|
485
485
|
try {
|
|
486
486
|
const binding = require('@lancedb/lancedb-linux-riscv64-gnu');
|
|
487
487
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-riscv64-gnu/package.json').version;
|
|
488
|
-
if (bindingPackageVersion !== '0.
|
|
489
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
488
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
489
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
490
490
|
}
|
|
491
491
|
return binding;
|
|
492
492
|
}
|
|
@@ -505,8 +505,8 @@ function requireNative() {
|
|
|
505
505
|
try {
|
|
506
506
|
const binding = require('@lancedb/lancedb-linux-ppc64-gnu');
|
|
507
507
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-ppc64-gnu/package.json').version;
|
|
508
|
-
if (bindingPackageVersion !== '0.
|
|
509
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
508
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
509
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
510
510
|
}
|
|
511
511
|
return binding;
|
|
512
512
|
}
|
|
@@ -524,8 +524,8 @@ function requireNative() {
|
|
|
524
524
|
try {
|
|
525
525
|
const binding = require('@lancedb/lancedb-linux-s390x-gnu');
|
|
526
526
|
const bindingPackageVersion = require('@lancedb/lancedb-linux-s390x-gnu/package.json').version;
|
|
527
|
-
if (bindingPackageVersion !== '0.
|
|
528
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
527
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
528
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
529
529
|
}
|
|
530
530
|
return binding;
|
|
531
531
|
}
|
|
@@ -548,8 +548,8 @@ function requireNative() {
|
|
|
548
548
|
try {
|
|
549
549
|
const binding = require('@lancedb/lancedb-openharmony-arm64');
|
|
550
550
|
const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm64/package.json').version;
|
|
551
|
-
if (bindingPackageVersion !== '0.
|
|
552
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
551
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
552
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
553
553
|
}
|
|
554
554
|
return binding;
|
|
555
555
|
}
|
|
@@ -567,8 +567,8 @@ function requireNative() {
|
|
|
567
567
|
try {
|
|
568
568
|
const binding = require('@lancedb/lancedb-openharmony-x64');
|
|
569
569
|
const bindingPackageVersion = require('@lancedb/lancedb-openharmony-x64/package.json').version;
|
|
570
|
-
if (bindingPackageVersion !== '0.
|
|
571
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
570
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
571
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
572
572
|
}
|
|
573
573
|
return binding;
|
|
574
574
|
}
|
|
@@ -586,8 +586,8 @@ function requireNative() {
|
|
|
586
586
|
try {
|
|
587
587
|
const binding = require('@lancedb/lancedb-openharmony-arm');
|
|
588
588
|
const bindingPackageVersion = require('@lancedb/lancedb-openharmony-arm/package.json').version;
|
|
589
|
-
if (bindingPackageVersion !== '0.
|
|
590
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
589
|
+
if (bindingPackageVersion !== '0.32.0-beta.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
590
|
+
throw new Error(`Native binding package version mismatch, expected 0.32.0-beta.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`);
|
|
591
591
|
}
|
|
592
592
|
return binding;
|
|
593
593
|
}
|
|
@@ -680,4 +680,8 @@ module.exports.TagContents = nativeBinding.TagContents;
|
|
|
680
680
|
module.exports.Tags = nativeBinding.Tags;
|
|
681
681
|
module.exports.TakeQuery = nativeBinding.TakeQuery;
|
|
682
682
|
module.exports.VectorQuery = nativeBinding.VectorQuery;
|
|
683
|
+
module.exports.lancedbMetricsCatalog = nativeBinding.lancedbMetricsCatalog;
|
|
683
684
|
module.exports.permutationBuilder = nativeBinding.permutationBuilder;
|
|
685
|
+
module.exports.registerLancedbMetricsRecorder = nativeBinding.registerLancedbMetricsRecorder;
|
|
686
|
+
module.exports.snapshotLancedbMetrics = nativeBinding.snapshotLancedbMetrics;
|
|
687
|
+
module.exports.tokenize = nativeBinding.tokenize;
|
package/dist/otel.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type MeterProvider } from "@opentelemetry/api";
|
|
2
|
+
/**
|
|
3
|
+
* Register LanceDB metrics as OpenTelemetry observable instruments.
|
|
4
|
+
*
|
|
5
|
+
* Installs a process-global metrics recorder and creates one observable
|
|
6
|
+
* instrument per LanceDB metric (currently object store request counts, bytes,
|
|
7
|
+
* latency, errors, and throttles) on the given (or global) `MeterProvider`. The
|
|
8
|
+
* configured `MetricReader` then collects them on its own schedule.
|
|
9
|
+
*
|
|
10
|
+
* Counters and gauges map directly to observable counters/gauges. Because
|
|
11
|
+
* OpenTelemetry has no asynchronous histogram instrument, each histogram is
|
|
12
|
+
* exported Prometheus-style as cumulative `le` bucket counts (`<name>_bucket`,
|
|
13
|
+
* with an `le` attribute) plus `<name>_count` and `<name>_sum`.
|
|
14
|
+
*
|
|
15
|
+
* Requires `@opentelemetry/api` (a dependency) and, to actually export, an
|
|
16
|
+
* OpenTelemetry SDK such as `@opentelemetry/sdk-metrics`.
|
|
17
|
+
*
|
|
18
|
+
* @param meterProvider The provider to register instruments on. Defaults to the
|
|
19
|
+
* global provider from `@opentelemetry/api`.
|
|
20
|
+
* @returns `true` if the recorder is installed and instruments are registered.
|
|
21
|
+
* `false` if a different `metrics` recorder is already installed in this
|
|
22
|
+
* process (only one global recorder is permitted), in which case a warning is
|
|
23
|
+
* emitted and no instruments are created. Calling this more than once is safe;
|
|
24
|
+
* instruments are created only on the first successful call.
|
|
25
|
+
*/
|
|
26
|
+
export declare function instrumentLanceDbMetrics(meterProvider?: MeterProvider): boolean;
|
package/dist/otel.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.instrumentLanceDbMetrics = instrumentLanceDbMetrics;
|
|
6
|
+
const api_1 = require("@opentelemetry/api");
|
|
7
|
+
const native_1 = require("./native");
|
|
8
|
+
let instrumented = false;
|
|
9
|
+
/**
|
|
10
|
+
* Register LanceDB metrics as OpenTelemetry observable instruments.
|
|
11
|
+
*
|
|
12
|
+
* Installs a process-global metrics recorder and creates one observable
|
|
13
|
+
* instrument per LanceDB metric (currently object store request counts, bytes,
|
|
14
|
+
* latency, errors, and throttles) on the given (or global) `MeterProvider`. The
|
|
15
|
+
* configured `MetricReader` then collects them on its own schedule.
|
|
16
|
+
*
|
|
17
|
+
* Counters and gauges map directly to observable counters/gauges. Because
|
|
18
|
+
* OpenTelemetry has no asynchronous histogram instrument, each histogram is
|
|
19
|
+
* exported Prometheus-style as cumulative `le` bucket counts (`<name>_bucket`,
|
|
20
|
+
* with an `le` attribute) plus `<name>_count` and `<name>_sum`.
|
|
21
|
+
*
|
|
22
|
+
* Requires `@opentelemetry/api` (a dependency) and, to actually export, an
|
|
23
|
+
* OpenTelemetry SDK such as `@opentelemetry/sdk-metrics`.
|
|
24
|
+
*
|
|
25
|
+
* @param meterProvider The provider to register instruments on. Defaults to the
|
|
26
|
+
* global provider from `@opentelemetry/api`.
|
|
27
|
+
* @returns `true` if the recorder is installed and instruments are registered.
|
|
28
|
+
* `false` if a different `metrics` recorder is already installed in this
|
|
29
|
+
* process (only one global recorder is permitted), in which case a warning is
|
|
30
|
+
* emitted and no instruments are created. Calling this more than once is safe;
|
|
31
|
+
* instruments are created only on the first successful call.
|
|
32
|
+
*/
|
|
33
|
+
function instrumentLanceDbMetrics(meterProvider) {
|
|
34
|
+
if (!(0, native_1.registerLancedbMetricsRecorder)()) {
|
|
35
|
+
console.warn("Could not install the LanceDB metrics recorder: another `metrics` " +
|
|
36
|
+
"recorder is already installed in this process. LanceDB metrics will " +
|
|
37
|
+
"not be exported via OpenTelemetry.");
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
if (instrumented) {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
const provider = meterProvider ?? api_1.metrics.getMeterProvider();
|
|
44
|
+
const meter = provider.getMeter("lancedb");
|
|
45
|
+
const scalarCallback = (metricName) => (result) => {
|
|
46
|
+
for (const point of (0, native_1.snapshotLancedbMetrics)()) {
|
|
47
|
+
if (point.name === metricName && point.value != null) {
|
|
48
|
+
result.observe(point.value, point.attributes);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
const bucketCallback = (metricName) => (result) => {
|
|
53
|
+
for (const point of (0, native_1.snapshotLancedbMetrics)()) {
|
|
54
|
+
if (point.name !== metricName || point.buckets == null) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
for (const bucket of point.buckets) {
|
|
58
|
+
const attributes = {
|
|
59
|
+
...point.attributes,
|
|
60
|
+
le: bucket.le,
|
|
61
|
+
};
|
|
62
|
+
result.observe(bucket.cumulativeCount, attributes);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const fieldCallback = (metricName, field) => (result) => {
|
|
67
|
+
for (const point of (0, native_1.snapshotLancedbMetrics)()) {
|
|
68
|
+
if (point.name !== metricName) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
const value = point[field];
|
|
72
|
+
if (value != null) {
|
|
73
|
+
result.observe(value, point.attributes);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
for (const desc of (0, native_1.lancedbMetricsCatalog)()) {
|
|
78
|
+
const unit = desc.unit ?? "";
|
|
79
|
+
if (desc.kind === "counter") {
|
|
80
|
+
const counter = meter.createObservableCounter(desc.name, {
|
|
81
|
+
unit,
|
|
82
|
+
description: desc.description,
|
|
83
|
+
});
|
|
84
|
+
counter.addCallback(scalarCallback(desc.name));
|
|
85
|
+
}
|
|
86
|
+
else if (desc.kind === "gauge") {
|
|
87
|
+
const gauge = meter.createObservableGauge(desc.name, {
|
|
88
|
+
unit,
|
|
89
|
+
description: desc.description,
|
|
90
|
+
});
|
|
91
|
+
gauge.addCallback(scalarCallback(desc.name));
|
|
92
|
+
}
|
|
93
|
+
else if (desc.kind === "histogram") {
|
|
94
|
+
// `_bucket` and `_count` observe cumulative sample counts, not the
|
|
95
|
+
// histogram's measured quantity, so they are unitless; only `_sum`
|
|
96
|
+
// carries the histogram's unit.
|
|
97
|
+
const bucket = meter.createObservableCounter(`${desc.name}_bucket`, {
|
|
98
|
+
description: `${desc.description} (cumulative buckets)`,
|
|
99
|
+
});
|
|
100
|
+
bucket.addCallback(bucketCallback(desc.name));
|
|
101
|
+
const count = meter.createObservableCounter(`${desc.name}_count`, {
|
|
102
|
+
description: `${desc.description} (count)`,
|
|
103
|
+
});
|
|
104
|
+
count.addCallback(fieldCallback(desc.name, "count"));
|
|
105
|
+
const sum = meter.createObservableCounter(`${desc.name}_sum`, {
|
|
106
|
+
unit,
|
|
107
|
+
description: `${desc.description} (sum)`,
|
|
108
|
+
});
|
|
109
|
+
sum.addCallback(fieldCallback(desc.name, "sum"));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
instrumented = true;
|
|
113
|
+
return true;
|
|
114
|
+
}
|
package/dist/table.d.ts
CHANGED
|
@@ -108,6 +108,22 @@ export interface Version {
|
|
|
108
108
|
timestamp: Date;
|
|
109
109
|
metadata: Record<string, string>;
|
|
110
110
|
}
|
|
111
|
+
/** Token produced by the tokenizer configured on a full-text search index. */
|
|
112
|
+
export interface FtsToken {
|
|
113
|
+
/** Token text after tokenizer filters have been applied. */
|
|
114
|
+
text: string;
|
|
115
|
+
/** Token position used by full-text query matching. */
|
|
116
|
+
position: number;
|
|
117
|
+
}
|
|
118
|
+
export type TokenizeTableOptions = {
|
|
119
|
+
/** FTS-indexed column whose tokenizer should be used. */
|
|
120
|
+
column: string;
|
|
121
|
+
indexName?: never;
|
|
122
|
+
} | {
|
|
123
|
+
/** Name of the FTS index whose tokenizer should be used. */
|
|
124
|
+
indexName: string;
|
|
125
|
+
column?: never;
|
|
126
|
+
};
|
|
111
127
|
/**
|
|
112
128
|
* Specification selecting Lance's MemWAL LSM-style write path for
|
|
113
129
|
* `mergeInsert`.
|
|
@@ -492,6 +508,17 @@ export declare abstract class Table {
|
|
|
492
508
|
* @returns {Promise<void>}
|
|
493
509
|
*/
|
|
494
510
|
abstract unsetLsmWriteSpec(): Promise<void>;
|
|
511
|
+
/**
|
|
512
|
+
* Read the {@link LsmWriteSpec} currently installed on this table.
|
|
513
|
+
*
|
|
514
|
+
* Resolves to `undefined` when the MemWAL LSM write path is not enabled (no
|
|
515
|
+
* spec has been set, or it was removed with {@link Table#unsetLsmWriteSpec}).
|
|
516
|
+
* The returned spec — including its `maintainedIndexes` and
|
|
517
|
+
* `writerConfigDefaults` — mirrors what was passed to
|
|
518
|
+
* {@link Table#setLsmWriteSpec}.
|
|
519
|
+
* @returns {Promise<LsmWriteSpec | undefined>}
|
|
520
|
+
*/
|
|
521
|
+
abstract getLsmWriteSpec(): Promise<LsmWriteSpec | undefined>;
|
|
495
522
|
/**
|
|
496
523
|
* Drain and close any cached MemWAL shard writers held for this table.
|
|
497
524
|
*
|
|
@@ -605,6 +632,16 @@ export declare abstract class Table {
|
|
|
605
632
|
abstract optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
|
|
606
633
|
/** List all indices that have been created with {@link Table.createIndex} */
|
|
607
634
|
abstract listIndices(): Promise<IndexConfig[]>;
|
|
635
|
+
/**
|
|
636
|
+
* Tokenize a full-text search query using the tokenizer configured on an FTS index.
|
|
637
|
+
*
|
|
638
|
+
* Specify exactly one of `column` or `indexName`.
|
|
639
|
+
*
|
|
640
|
+
* Model-backed tokenizers such as `jieba/*` and `lindera/*` are rebuilt in
|
|
641
|
+
* the client process from index metadata. For remote tables, this means the
|
|
642
|
+
* same tokenizer model files must also exist locally.
|
|
643
|
+
*/
|
|
644
|
+
abstract tokenize(query: string, options: TokenizeTableOptions): Promise<FtsToken[]>;
|
|
608
645
|
/** Return the table as an arrow table */
|
|
609
646
|
abstract toArrow(): Promise<ArrowTable>;
|
|
610
647
|
abstract mergeInsert(on: string | string[]): MergeInsertBuilder;
|
|
@@ -681,6 +718,7 @@ export declare class LocalTable extends Table {
|
|
|
681
718
|
setUnenforcedPrimaryKey(columns: string | string[]): Promise<void>;
|
|
682
719
|
setLsmWriteSpec(spec: LsmWriteSpec): Promise<void>;
|
|
683
720
|
unsetLsmWriteSpec(): Promise<void>;
|
|
721
|
+
getLsmWriteSpec(): Promise<LsmWriteSpec | undefined>;
|
|
684
722
|
closeLsmWriters(): Promise<void>;
|
|
685
723
|
version(): Promise<number>;
|
|
686
724
|
checkout(version: number | string): Promise<void>;
|
|
@@ -692,6 +730,7 @@ export declare class LocalTable extends Table {
|
|
|
692
730
|
currentBranch(): string | null;
|
|
693
731
|
optimize(options?: Partial<OptimizeOptions>): Promise<OptimizeStats>;
|
|
694
732
|
listIndices(): Promise<IndexConfig[]>;
|
|
733
|
+
tokenize(query: string, options: TokenizeTableOptions): Promise<FtsToken[]>;
|
|
695
734
|
toArrow(): Promise<ArrowTable>;
|
|
696
735
|
indexStats(name: string): Promise<IndexStatistics | undefined>;
|
|
697
736
|
stats(): Promise<TableStatistics>;
|
package/dist/table.js
CHANGED
|
@@ -285,6 +285,12 @@ class LocalTable extends Table {
|
|
|
285
285
|
async unsetLsmWriteSpec() {
|
|
286
286
|
return await this.inner.unsetLsmWriteSpec();
|
|
287
287
|
}
|
|
288
|
+
async getLsmWriteSpec() {
|
|
289
|
+
// The native binding types `specType` as a plain `string`; narrow it back
|
|
290
|
+
// to the public union. The Rust `From` impl only ever emits one of the
|
|
291
|
+
// three valid values, so the cast is safe.
|
|
292
|
+
return ((await this.inner.getLsmWriteSpec()) ?? undefined);
|
|
293
|
+
}
|
|
288
294
|
async closeLsmWriters() {
|
|
289
295
|
return await this.inner.closeLsmWriters();
|
|
290
296
|
}
|
|
@@ -331,6 +337,9 @@ class LocalTable extends Table {
|
|
|
331
337
|
async listIndices() {
|
|
332
338
|
return await this.inner.listIndices();
|
|
333
339
|
}
|
|
340
|
+
async tokenize(query, options) {
|
|
341
|
+
return await this.inner.tokenize(query, options?.column, options?.indexName);
|
|
342
|
+
}
|
|
334
343
|
async toArrow() {
|
|
335
344
|
return await this.query().toArrow();
|
|
336
345
|
}
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"ann"
|
|
12
12
|
],
|
|
13
13
|
"private": false,
|
|
14
|
-
"version": "0.
|
|
14
|
+
"version": "0.32.0-beta.2",
|
|
15
15
|
"main": "dist/index.js",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": "./dist/index.js",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"@biomejs/biome": "^1.7.3",
|
|
45
45
|
"@jest/globals": "^29.7.0",
|
|
46
46
|
"@napi-rs/cli": "3.7.0",
|
|
47
|
+
"@opentelemetry/sdk-metrics": "^1.30.0",
|
|
47
48
|
"@types/axios": "^0.14.0",
|
|
48
49
|
"@types/jest": "^29.1.2",
|
|
49
50
|
"@types/node": "22.7.4",
|
|
@@ -99,18 +100,19 @@
|
|
|
99
100
|
"version": "napi version"
|
|
100
101
|
},
|
|
101
102
|
"dependencies": {
|
|
103
|
+
"@opentelemetry/api": "^1.9.0",
|
|
102
104
|
"reflect-metadata": "^0.2.2"
|
|
103
105
|
},
|
|
104
106
|
"optionalDependencies": {
|
|
105
107
|
"@huggingface/transformers": "3.0.2",
|
|
106
108
|
"openai": "4.29.2",
|
|
107
|
-
"@lancedb/lancedb-darwin-arm64": "0.
|
|
108
|
-
"@lancedb/lancedb-linux-x64-gnu": "0.
|
|
109
|
-
"@lancedb/lancedb-linux-arm64-gnu": "0.
|
|
110
|
-
"@lancedb/lancedb-linux-x64-musl": "0.
|
|
111
|
-
"@lancedb/lancedb-linux-arm64-musl": "0.
|
|
112
|
-
"@lancedb/lancedb-win32-x64-msvc": "0.
|
|
113
|
-
"@lancedb/lancedb-win32-arm64-msvc": "0.
|
|
109
|
+
"@lancedb/lancedb-darwin-arm64": "0.32.0-beta.2",
|
|
110
|
+
"@lancedb/lancedb-linux-x64-gnu": "0.32.0-beta.2",
|
|
111
|
+
"@lancedb/lancedb-linux-arm64-gnu": "0.32.0-beta.2",
|
|
112
|
+
"@lancedb/lancedb-linux-x64-musl": "0.32.0-beta.2",
|
|
113
|
+
"@lancedb/lancedb-linux-arm64-musl": "0.32.0-beta.2",
|
|
114
|
+
"@lancedb/lancedb-win32-x64-msvc": "0.32.0-beta.2",
|
|
115
|
+
"@lancedb/lancedb-win32-arm64-msvc": "0.32.0-beta.2"
|
|
114
116
|
},
|
|
115
117
|
"peerDependencies": {
|
|
116
118
|
"apache-arrow": ">=15.0.0 <=18.1.0"
|