Skip to content

Commit 9cea250

Browse files
committed
Add OTLP metrics endpoint
1 parent 8eb0f7a commit 9cea250

File tree

35 files changed

+3519
-50
lines changed

35 files changed

+3519
-50
lines changed

build-tools-internal/src/main/resources/checkstyle_suppressions.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<suppress files="plugin[/\\]sql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]sql[/\\]parser[/\\]SqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
1414
<suppress files="plugin[/\\]eql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]eql[/\\]parser[/\\]EqlBase(Base(Listener|Visitor)|Lexer|Listener|Parser|Visitor).java" checks="." />
1515
<suppress files="plugin[/\\]esql[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]xpack[/\\]esql[/\\]parser[/\\]EsqlBase(Parser|Lexer).*.java" checks="." />
16+
<suppress files="x-pack[/\\]plugin[/\\]otel-data[/\\]build[/\\]generated[/\\]sources[/\\]" checks="." />
1617

1718
<!-- JNA requires the no-argument constructor on JNAKernel32Library.SizeT to be public-->
1819
<suppress files="server[/\\]src[/\\]main[/\\]java[/\\]org[/\\]elasticsearch[/\\]bootstrap[/\\]JNAKernel32Library.java" checks="RedundantModifier" />

dev-tools/protoc_exe_sha256.sh

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#!/bin/bash
2+
3+
#
4+
# Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
5+
# or more contributor license agreements. Licensed under the "Elastic License
6+
# 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
7+
# Public License v 1"; you may not use this file except in compliance with, at
8+
# your election, the "Elastic License 2.0", the "GNU Affero General Public
9+
# License v3.0 only", or the "Server Side Public License, v 1".
10+
#
11+
12+
# Script to download all .exe files from protobuf protoc repository and generate SHA256 checksums
13+
# URL to download from
14+
VERSION="4.32.0"
15+
URL="https://repo1.maven.org/maven2/com/google/protobuf/protoc/${VERSION}/"
16+
DOWNLOAD_DIR="protoc-${VERSION}-executables"
17+
18+
# Create download directory if it doesn't exist
19+
mkdir -p "${DOWNLOAD_DIR}"
20+
cd "${DOWNLOAD_DIR}" || { echo "Failed to create/enter download directory"; exit 1; }
21+
22+
# Get the HTML content, extract links to .exe files (but not .exe.md5 etc.)
23+
# Using grep with lookahead assertion to ensure we don't match .exe followed by something else
24+
curl -s "${URL}" | grep -o 'href="[^"]*\.exe"' | grep -v -E 'jsonl' | grep -v -E '\.exe\.[^"]+' | sed 's/href="//g' | sed 's/"//g' > exe_files.txt
25+
26+
if [ ! -s exe_files.txt ]; then
27+
echo "No .exe files found at ${URL}"
28+
exit 1
29+
fi
30+
31+
echo "Found $(wc -l < exe_files.txt | tr -d ' ') .exe files. Downloading..."
32+
33+
# Download each file
34+
while IFS= read -r file; do
35+
curl -s -O "${URL}${file}"
36+
done < exe_files.txt
37+
38+
echo "Generating SHA256 checksums..."
39+
40+
# Generate SHA256 checksums for all downloaded .exe files
41+
if command -v shasum &> /dev/null; then
42+
# macOS/some Linux
43+
shasum -a 256 *.exe > SHA256SUMS.txt
44+
elif command -v sha256sum &> /dev/null; then
45+
# Most Linux distributions
46+
sha256sum *.exe > SHA256SUMS.txt
47+
else
48+
echo "Neither shasum nor sha256sum command found. Cannot generate checksums."
49+
exit 1
50+
fi
51+
52+
# Print the checksums
53+
cat SHA256SUMS.txt
54+
55+
cd ..
56+
rm -rf "${DOWNLOAD_DIR}"

gradle/verification-metadata.xml

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,6 +707,11 @@
707707
<sha256 value="9a4e0b9f4ec4d71a8a1d3641fd481118100fda2eeab712dbdfd4b2a06e9de4ce" origin="Generated by Gradle"/>
708708
</artifact>
709709
</component>
710+
<component group="com.google.gradle" name="osdetector-gradle-plugin" version="1.7.3">
711+
<artifact name="osdetector-gradle-plugin-1.7.3.jar">
712+
<sha256 value="6b4692f913a21b1fb603169ee78ba8f3e4ab2af9d762af9ca88b79126c1c0ad1" origin="Generated by Gradle"/>
713+
</artifact>
714+
</component>
710715
<component group="com.google.guava" name="failureaccess" version="1.0">
711716
<artifact name="failureaccess-1.0.jar">
712717
<sha256 value="d084bef9cd07a8537a1753e4850a69b7e8bab1d1e22e9f3a1e4826309a7a2336" origin="Generated by Gradle"/>
@@ -867,6 +872,11 @@
867872
<sha256 value="193edf97aefa28b93c5892bdc598bac34fa4c396588030084f290b1440e8b98a" origin="Generated by Gradle"/>
868873
</artifact>
869874
</component>
875+
<component group="com.google.protobuf" name="protobuf-gradle-plugin" version="0.9.5">
876+
<artifact name="protobuf-gradle-plugin-0.9.5.jar">
877+
<sha256 value="d007dda81afeaead5dab05c27fe023ccbac97790e4d11787f4be68e6716557f8" origin="Generated by Gradle"/>
878+
</artifact>
879+
</component>
870880
<component group="com.google.protobuf" name="protobuf-java" version="2.5.0">
871881
<artifact name="protobuf-java-2.5.0.jar">
872882
<sha256 value="e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74" origin="Generated by Gradle"/>
@@ -877,11 +887,53 @@
877887
<sha256 value="8540247fad9e06baefa8fb45eb313802d019f485f14300e0f9d6b556ed88e753" origin="Generated by Gradle"/>
878888
</artifact>
879889
</component>
890+
<component group="com.google.protobuf" name="protobuf-java" version="4.31.1">
891+
<artifact name="protobuf-java-4.31.1.jar">
892+
<sha256 value="d60dfe7c68a0d38a248cca96924f289dc7e1966a887ee7cae397701af08575ae" origin="Generated by Gradle"/>
893+
</artifact>
894+
</component>
895+
<component group="com.google.protobuf" name="protobuf-java" version="4.32.0">
896+
<artifact name="protobuf-java-4.32.0.jar">
897+
<sha256 value="e902c91b454812b7d056b8d303a572733bf0587576ff157c1049116c9626241d" origin="Generated by Gradle"/>
898+
</artifact>
899+
</component>
880900
<component group="com.google.protobuf" name="protobuf-java-util" version="3.25.5">
881901
<artifact name="protobuf-java-util-3.25.5.jar">
882902
<sha256 value="dacc58b2c3d2fa8d4bddc1acb881e78d6cf7c137dd78bc1d67f6aca732436a8d" origin="Generated by Gradle"/>
883903
</artifact>
884904
</component>
905+
<component group="com.google.protobuf" name="protoc" version="4.32.0">
906+
<artifact name="protoc-4.32.0-linux-aarch_64.exe">
907+
<sha256 value="bc95ab180ef088eed3f97c30b213ac6439ccac01989d18f9e908eb5233432136" origin="dev-tools/protoc_exe_sha256.sh"/>
908+
</artifact>
909+
<artifact name="protoc-4.32.0-linux-ppcle_64.exe">
910+
<sha256 value="37d1c923270dcea474423994cae32e127d9aeb0cf97d40ccf652bd671358dc74" origin="dev-tools/protoc_exe_sha256.sh"/>
911+
</artifact>
912+
<artifact name="protoc-4.32.0-linux-s390_64.exe">
913+
<sha256 value="0b97e27d36456e8a29855f10e6dfacd27043131d44bed460b921641c7201ec0a" origin="dev-tools/protoc_exe_sha256.sh"/>
914+
</artifact>
915+
<artifact name="protoc-4.32.0-linux-x86_32.exe">
916+
<sha256 value="75abfd89ae91a12cfbd40fe9aca20a698cc6134fbc7bef999f5c8f3b8c604b13" origin="dev-tools/protoc_exe_sha256.sh"/>
917+
</artifact>
918+
<artifact name="protoc-4.32.0-linux-x86_64.exe">
919+
<sha256 value="373c7da2c1cae98ac1a494a8a53e28100af70450ab55c064daa92ba48af5fe23" origin="dev-tools/protoc_exe_sha256.sh"/>
920+
</artifact>
921+
<artifact name="protoc-4.32.0-osx-aarch_64.exe">
922+
<sha256 value="96c06aac6eb7e247a78f2ffe8b3aaf4419a6765e3d96d724cc3db0e296e7aa94" origin="dev-tools/protoc_exe_sha256.sh"/>
923+
</artifact>
924+
<artifact name="protoc-4.32.0-osx-universal_binary.exe">
925+
<sha256 value="35f98ecc7c0efeb7d63427a6f3b9f7f2adc9f59d79275c3f0ae87030876c187c" origin="dev-tools/protoc_exe_sha256.sh"/>
926+
</artifact>
927+
<artifact name="protoc-4.32.0-osx-x86_64.exe">
928+
<sha256 value="91b2b3b5ad84cfed2869c69830c926130d312e357b4f128796504b5448a6534c" origin="dev-tools/protoc_exe_sha256.sh"/>
929+
</artifact>
930+
<artifact name="protoc-4.32.0-windows-x86_32.exe">
931+
<sha256 value="dc71390eb8a113f37a24275bc57cc59ddaceeac39b98af2181c94755f2f411f9" origin="dev-tools/protoc_exe_sha256.sh"/>
932+
</artifact>
933+
<artifact name="protoc-4.32.0-windows-x86_64.exe">
934+
<sha256 value="a1e25d1b71e805233daefabba72a21566580354a192539cdab43bbf191dbf951" origin="dev-tools/protoc_exe_sha256.sh"/>
935+
</artifact>
936+
</component>
885937
<component group="com.google.re2j" name="re2j" version="1.1">
886938
<artifact name="re2j-1.1.jar">
887939
<sha256 value="24ada84d1b5de584e3e84b06f0c7dd562cee6eafe8dea8083bd8eb123823bbe7" origin="Generated by Gradle"/>
@@ -1714,6 +1766,16 @@
17141766
<sha256 value="2eaaac5f268b135f0e11dd30637d71df5751a0bb7ed6268659be57104d63122b" origin="Generated by Gradle"/>
17151767
</artifact>
17161768
</component>
1769+
<component group="io.opentelemetry" name="opentelemetry-api" version="1.53.0">
1770+
<artifact name="opentelemetry-api-1.53.0.jar">
1771+
<sha256 value="1991903b9fc76b27f1e6a70a5a97131668fb5f3ac9026178c450d510cbb1bef2" origin="Generated by Gradle"/>
1772+
</artifact>
1773+
</component>
1774+
<component group="io.opentelemetry" name="opentelemetry-common" version="1.53.0">
1775+
<artifact name="opentelemetry-common-1.53.0.jar">
1776+
<sha256 value="73a5181dd07e72c4312fadafc8328ad1046a32c050030e3a7b8c16113daad359" origin="Generated by Gradle"/>
1777+
</artifact>
1778+
</component>
17171779
<component group="io.opentelemetry" name="opentelemetry-context" version="1.31.0">
17181780
<artifact name="opentelemetry-context-1.31.0.jar">
17191781
<sha256 value="664896a5c34bcda20c95c8f45198a95e8f97a1cd5e5c2923978f42dddada787d" origin="Generated by Gradle"/>
@@ -1729,11 +1791,61 @@
17291791
<sha256 value="76f9dfe1a6f74d5081e07bde1f7cb9a06879d317ec0ae0f61dd8fb2be9afad4f" origin="Generated by Gradle"/>
17301792
</artifact>
17311793
</component>
1794+
<component group="io.opentelemetry" name="opentelemetry-context" version="1.53.0">
1795+
<artifact name="opentelemetry-context-1.53.0.jar">
1796+
<sha256 value="88a780c5bb7b51e7c07071d61403e34f13277d092bf441a5cb49cf2ce9c756e9" origin="Generated by Gradle"/>
1797+
</artifact>
1798+
</component>
1799+
<component group="io.opentelemetry" name="opentelemetry-exporter-common" version="1.53.0">
1800+
<artifact name="opentelemetry-exporter-common-1.53.0.jar">
1801+
<sha256 value="d7f093f987547c9c2c2caa28baf1254507c59b4dbf97b49fee5c9cd1ceb6f8d5" origin="Generated by Gradle"/>
1802+
</artifact>
1803+
</component>
1804+
<component group="io.opentelemetry" name="opentelemetry-exporter-otlp" version="1.53.0">
1805+
<artifact name="opentelemetry-exporter-otlp-1.53.0.jar">
1806+
<sha256 value="0ce88bf35577894ee185f718f1b981938bbfc8981f3b7fcecbfd7b7c375bc236" origin="Generated by Gradle"/>
1807+
</artifact>
1808+
</component>
1809+
<component group="io.opentelemetry" name="opentelemetry-exporter-otlp-common" version="1.53.0">
1810+
<artifact name="opentelemetry-exporter-otlp-common-1.53.0.jar">
1811+
<sha256 value="32bcf0e855110b09cffbb5aac59c69d2caaa35de646e07c0a5f7f50ab42d4c1f" origin="Generated by Gradle"/>
1812+
</artifact>
1813+
</component>
1814+
<component group="io.opentelemetry" name="opentelemetry-exporter-sender-jdk" version="1.53.0">
1815+
<artifact name="opentelemetry-exporter-sender-jdk-1.53.0.jar">
1816+
<sha256 value="d147fd99aa23be8b0ea8acbc06ffae2f091af2edfffeb44163ab79765f7e3b42" origin="Generated by Gradle"/>
1817+
</artifact>
1818+
</component>
17321819
<component group="io.opentelemetry" name="opentelemetry-sdk" version="1.47.0">
17331820
<artifact name="opentelemetry-sdk-1.47.0.jar">
17341821
<sha256 value="4a09eb2ee484769973e14218a34e6da54f35955aa02b26dc5238b0c2ed6a801d" origin="Generated by Gradle"/>
17351822
</artifact>
17361823
</component>
1824+
<component group="io.opentelemetry" name="opentelemetry-sdk" version="1.53.0">
1825+
<artifact name="opentelemetry-sdk-1.53.0.jar">
1826+
<sha256 value="d58721063bca5d612bf1f6dccb883664210999c5aa470c149d1509672f13229c" origin="Generated by Gradle"/>
1827+
</artifact>
1828+
</component>
1829+
<component group="io.opentelemetry" name="opentelemetry-sdk-common" version="1.53.0">
1830+
<artifact name="opentelemetry-sdk-common-1.53.0.jar">
1831+
<sha256 value="a5d68aca0920aa0dc17b9ecc5510abe4c344e66eae9a4420c992298e4712d3bc" origin="Generated by Gradle"/>
1832+
</artifact>
1833+
</component>
1834+
<component group="io.opentelemetry" name="opentelemetry-sdk-extension-autoconfigure" version="1.53.0">
1835+
<artifact name="opentelemetry-sdk-extension-autoconfigure-1.53.0.jar">
1836+
<sha256 value="72becaccfb3d79d91c6486bf4e68f2474a1aa7742934fb675ea077e35a8dc3e1" origin="Generated by Gradle"/>
1837+
</artifact>
1838+
</component>
1839+
<component group="io.opentelemetry" name="opentelemetry-sdk-extension-autoconfigure-spi" version="1.53.0">
1840+
<artifact name="opentelemetry-sdk-extension-autoconfigure-spi-1.53.0.jar">
1841+
<sha256 value="e814e63dc2f8cbdf84574b6289eb543b89b06486d03cad1e697b06d802ce27bb" origin="Generated by Gradle"/>
1842+
</artifact>
1843+
</component>
1844+
<component group="io.opentelemetry" name="opentelemetry-sdk-metrics" version="1.53.0">
1845+
<artifact name="opentelemetry-sdk-metrics-1.53.0.jar">
1846+
<sha256 value="3d7dbae6c03be035e7c4dbdd50442741b260be5463fa9aadca1b00af0efddee5" origin="Generated by Gradle"/>
1847+
</artifact>
1848+
</component>
17371849
<component group="io.opentelemetry" name="opentelemetry-semconv" version="1.21.0-alpha">
17381850
<artifact name="opentelemetry-semconv-1.21.0-alpha.jar">
17391851
<sha256 value="4a8f41b93eec51e85fa6b48e43de6785b742316fdd9c9baf595adbce6d5de6af" origin="Generated by Gradle"/>
@@ -1879,6 +1991,11 @@
18791991
<sha256 value="8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3" origin="Generated by Gradle"/>
18801992
</artifact>
18811993
</component>
1994+
<component group="kr.motd.maven" name="os-maven-plugin" version="1.7.1">
1995+
<artifact name="os-maven-plugin-1.7.1.jar">
1996+
<sha256 value="f47aeef86821e52b2b18758978bd045f03d722292e32e747082122c6228952e0" origin="Generated by Gradle"/>
1997+
</artifact>
1998+
</component>
18821999
<component group="krallin" name="tini" version="0.19.0">
18832000
<artifact name="tini-0.19.0-amd64.jar">
18842001
<sha256 value="93dcc18adc78c65a028a84799ecf8ad40c936fdfc5f2a57b1acda5a8117fa82c" origin="Generated by Gradle"/>

modules/ingest-common/src/main/java/org/elasticsearch/ingest/common/RerouteProcessor.java

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
package org.elasticsearch.ingest.common;
1111

12+
import org.elasticsearch.cluster.metadata.DataStream;
1213
import org.elasticsearch.cluster.metadata.ProjectId;
1314
import org.elasticsearch.core.Nullable;
1415
import org.elasticsearch.ingest.AbstractProcessor;
@@ -17,11 +18,9 @@
1718
import org.elasticsearch.ingest.Processor;
1819

1920
import java.util.List;
20-
import java.util.Locale;
2121
import java.util.Map;
2222
import java.util.Objects;
2323
import java.util.function.Function;
24-
import java.util.regex.Pattern;
2524

2625
import static org.elasticsearch.core.Strings.format;
2726
import static org.elasticsearch.ingest.ConfigurationUtils.newConfigurationException;
@@ -221,11 +220,6 @@ public RerouteProcessor create(
221220
*/
222221
static final class DataStreamValueSource {
223222

224-
private static final int MAX_LENGTH = 100;
225-
private static final String REPLACEMENT = "_";
226-
private static final Pattern DISALLOWED_IN_TYPE = Pattern.compile("[\\\\/*?\"<>| ,#:-]");
227-
private static final Pattern DISALLOWED_IN_DATASET = Pattern.compile("[\\\\/*?\"<>| ,#:-]");
228-
private static final Pattern DISALLOWED_IN_NAMESPACE = Pattern.compile("[\\\\/*?\"<>| ,#:]");
229223
static final DataStreamValueSource TYPE_VALUE_SOURCE = type("{{" + DATA_STREAM_TYPE + "}}");
230224
static final DataStreamValueSource DATASET_VALUE_SOURCE = dataset("{{" + DATA_STREAM_DATASET + "}}");
231225
static final DataStreamValueSource NAMESPACE_VALUE_SOURCE = namespace("{{" + DATA_STREAM_NAMESPACE + "}}");
@@ -235,24 +229,15 @@ static final class DataStreamValueSource {
235229
private final Function<String, String> sanitizer;
236230

237231
public static DataStreamValueSource type(String type) {
238-
return new DataStreamValueSource(type, ds -> sanitizeDataStreamField(ds, DISALLOWED_IN_TYPE));
232+
return new DataStreamValueSource(type, DataStream::sanitizeType);
239233
}
240234

241235
public static DataStreamValueSource dataset(String dataset) {
242-
return new DataStreamValueSource(dataset, ds -> sanitizeDataStreamField(ds, DISALLOWED_IN_DATASET));
236+
return new DataStreamValueSource(dataset, DataStream::sanitizeDataset);
243237
}
244238

245239
public static DataStreamValueSource namespace(String namespace) {
246-
return new DataStreamValueSource(namespace, nsp -> sanitizeDataStreamField(nsp, DISALLOWED_IN_NAMESPACE));
247-
}
248-
249-
private static String sanitizeDataStreamField(String s, Pattern disallowedInDataset) {
250-
if (s == null) {
251-
return null;
252-
}
253-
s = s.toLowerCase(Locale.ROOT);
254-
s = s.substring(0, Math.min(s.length(), MAX_LENGTH));
255-
return disallowedInDataset.matcher(s).replaceAll(REPLACEMENT);
240+
return new DataStreamValueSource(namespace, DataStream::sanitizeNamespace);
256241
}
257242

258243
private DataStreamValueSource(String value, Function<String, String> sanitizer) {

server/src/main/java/org/elasticsearch/cluster/metadata/DataStream.java

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import java.util.function.Function;
7575
import java.util.function.LongSupplier;
7676
import java.util.function.Predicate;
77+
import java.util.regex.Pattern;
7778
import java.util.stream.Collectors;
7879

7980
import static org.elasticsearch.cluster.metadata.ComposableIndexTemplate.EMPTY_MAPPINGS;
@@ -98,6 +99,33 @@ public final class DataStream implements SimpleDiffable<DataStream>, ToXContentO
9899
public static final DateFormatter DATE_FORMATTER = DateFormatter.forPattern("uuuu.MM.dd");
99100
public static final String TIMESTAMP_FIELD_NAME = "@timestamp";
100101

102+
private static final int MAX_LENGTH = 100;
103+
private static final String REPLACEMENT = "_";
104+
private static final Pattern DISALLOWED_IN_TYPE = Pattern.compile("[\\\\/*?\"<>| ,#:-]");
105+
private static final Pattern DISALLOWED_IN_DATASET = Pattern.compile("[\\\\/*?\"<>| ,#:-]");
106+
private static final Pattern DISALLOWED_IN_NAMESPACE = Pattern.compile("[\\\\/*?\"<>| ,#:]");
107+
108+
public static String sanitizeType(String type) {
109+
return sanitizeDataStreamField(type, DISALLOWED_IN_TYPE);
110+
}
111+
112+
public static String sanitizeDataset(String dataset) {
113+
return sanitizeDataStreamField(dataset, DISALLOWED_IN_DATASET);
114+
}
115+
116+
public static String sanitizeNamespace(String namespace) {
117+
return sanitizeDataStreamField(namespace, DISALLOWED_IN_NAMESPACE);
118+
}
119+
120+
private static String sanitizeDataStreamField(String s, Pattern disallowedInDataset) {
121+
if (s == null) {
122+
return null;
123+
}
124+
s = s.toLowerCase(Locale.ROOT);
125+
s = s.substring(0, Math.min(s.length(), MAX_LENGTH));
126+
return disallowedInDataset.matcher(s).replaceAll(REPLACEMENT);
127+
}
128+
101129
// Timeseries indices' leaf readers should be sorted by desc order of their timestamp field, as it allows search time optimizations
102130
public static final Comparator<LeafReader> TIMESERIES_LEAF_READERS_SORTER = Comparator.comparingLong((LeafReader r) -> {
103131
try {

server/src/main/java/org/elasticsearch/cluster/routing/TsidBuilder.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,15 @@ public class TsidBuilder {
4141
private static final Hasher32 HASHER_32 = Hashing.murmur3_32();
4242
private final HashStream128 hashStream = HASHER_128.hashStream();
4343

44-
private final List<Dimension> dimensions = new ArrayList<>();
44+
private final List<Dimension> dimensions;
45+
46+
public TsidBuilder() {
47+
dimensions = new ArrayList<>();
48+
}
49+
50+
public TsidBuilder(int expectedSize) {
51+
dimensions = new ArrayList<>(expectedSize);
52+
}
4553

4654
/**
4755
* Adds an integer dimension to the TSID.
@@ -262,6 +270,10 @@ private static int writeHash128(HashValue128 hash128, byte[] buffer, int index)
262270
return index;
263271
}
264272

273+
public int size() {
274+
return dimensions.size();
275+
}
276+
265277
/**
266278
* A functional interface that describes how objects of a complex type are added to a TSID.
267279
*

0 commit comments

Comments
 (0)