Skip to content

Commit ef814d4

Browse files
committed
Add Iceberg support in test cluster
1 parent 9102dff commit ef814d4

File tree

4 files changed

+64
-28
lines changed

4 files changed

+64
-28
lines changed

docker-compose/bootstrap.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,18 @@ enable_consumer_group_metrics:
4848
- "group"
4949
- "partition"
5050
- "consumer_lag"
51-
# Lower the interval for the quickstart
51+
# Lower the interval for the autogeneration of consumer group metrics.
5252
# https://docs.redpanda.com/current/reference/properties/cluster-properties/#consumer_group_lag_collection_interval_sec
5353
consumer_group_lag_collection_interval_sec: 60
5454
# Enable Redpanda to collect host metrics.
5555
# https://docs.redpanda.com/current/reference/properties/cluster-properties/#enable_host_metrics
56-
enable_host_metrics: true
56+
enable_host_metrics: true
57+
# Enable for Iceberg metrics
58+
iceberg_enabled: true
59+
# Set up Iceberg REST catalog configuration
60+
iceberg_catalog_type: rest
61+
iceberg_rest_catalog_endpoint: http://catalog:8181
62+
# Credentials are required, but the catalog ignores them
63+
iceberg_rest_catalog_client_id: catalog
64+
iceberg_rest_catalog_client_secret: catalog123
65+
iceberg_catalog_commit_interval_ms: 5000

docker-compose/docker-compose.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: redpanda-quickstart-multi-broker
1+
name: redpanda-cluster
22
networks:
33
redpanda_network:
44
driver: bridge
@@ -265,6 +265,7 @@ services:
265265
- -X user=superuser
266266
- -X pass=secretpassword
267267
- -X brokers=redpanda-0:9092
268+
- --topic-config=redpanda.iceberg.mode=key_value
268269
image: docker.redpanda.com/redpandadata/${REDPANDA_DOCKER_REPO:-redpanda}:${REDPANDA_VERSION:-latest}
269270
networks:
270271
- redpanda_network
@@ -394,3 +395,19 @@ services:
394395
/usr/bin/mc policy set public minio/redpanda;
395396
tail -f /dev/null
396397
"
398+
catalog:
399+
image: tabulario/iceberg-rest
400+
container_name: iceberg-rest
401+
networks:
402+
- redpanda_network
403+
depends_on:
404+
- minio
405+
ports:
406+
- 8181:8181
407+
environment:
408+
- AWS_ACCESS_KEY_ID=minio
409+
- AWS_SECRET_ACCESS_KEY=redpandaTieredStorage7
410+
- AWS_REGION=local
411+
- CATALOG_WAREHOUSE=s3://redpanda/
412+
- CATALOG_IO__IMPL=org.apache.iceberg.aws.s3.S3FileIO
413+
- CATALOG_S3_ENDPOINT=http://minio:9000

tools/metrics/metrics.py

Lines changed: 34 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -35,67 +35,78 @@ def fetch_metrics(url):
3535

3636
def parse_metrics(metrics_text):
3737
"""
38-
Parse Prometheus exposition text into a structured dict of:
38+
Parse Prometheus exposition text into a dict:
3939
metric_name → { description, type, labels: [<label_keys>] }
40-
Robust against any ordering of # HELP/# TYPE and handles samples
41-
both with and without labels.
40+
41+
- Strips empty `{}` on unlabelled samples
42+
- Propagates HELP/TYPE from base metrics onto _bucket, _count, _sum
43+
- Works regardless of # HELP / # TYPE order
4244
"""
43-
import re
44-
import logging
45+
import re, logging
4546

46-
# Gather HELP/type metadata
47-
meta = {} # name → { 'description':…, 'type':… }
4847
lines = metrics_text.splitlines()
48+
49+
# Gather HELP/TYPE metadata in any order
50+
meta = {} # name → { 'description': str, 'type': str }
4951
for line in lines:
5052
if line.startswith("# HELP"):
5153
m = re.match(r"# HELP\s+(\S+)\s+(.+)", line)
5254
if m:
53-
name, desc = m.group(1), m.group(2)
55+
name, desc = m.groups()
5456
meta.setdefault(name, {})['description'] = desc
5557
elif line.startswith("# TYPE"):
5658
m = re.match(r"# TYPE\s+(\S+)\s+(\S+)", line)
5759
if m:
58-
name, t = m.group(1), m.group(2)
59-
meta.setdefault(name, {})['type'] = t
60+
name, mtype = m.groups()
61+
meta.setdefault(name, {})['type'] = mtype
6062

61-
# Collect label keys from every sample line
63+
# Collect label keys from _every_ sample line
6264
label_map = {} # name → set(label_keys)
6365
for line in lines:
6466
if line.startswith("#"):
6567
continue
6668

67-
# try labelled sample: metric{a="1",b="2"} 42
69+
# labelled: foo{a="1",b="2"} 42
6870
m_lbl = re.match(r"^(\S+)\{(.+?)\}\s+(.+)", line)
6971
if m_lbl:
70-
name, labels_str = m_lbl.group(1), m_lbl.group(2)
71-
keys = [kv.split("=", 1)[0] for kv in labels_str.split(",")]
72+
name, labels_str, _ = m_lbl.groups()
73+
keys = [kv.split("=",1)[0] for kv in labels_str.split(",")]
7274
else:
73-
# fallback to unlabelled: metric 42
74-
m_unlbl = re.match(r"^(\S+)\s+(.+)", line)
75-
if m_unlbl:
76-
name, keys = m_unlbl.group(1), []
77-
else:
75+
# unlabelled, maybe with stray {}: foo{} 42 or just foo 42
76+
m_unlbl = re.match(r"^(\S+?)(?:\{\})?\s+(.+)", line)
77+
if not m_unlbl:
7878
continue
79+
name, _ = m_unlbl.groups()
80+
keys = []
7981

8082
label_map.setdefault(name, set()).update(keys)
8183

82-
# Merge into final structure, warn on missing pieces
84+
# Propagate HELP/TYPE from base histograms/summaries
85+
for series in list(label_map):
86+
for suffix in ("_bucket", "_count", "_sum"):
87+
if series.endswith(suffix):
88+
base = series[:-len(suffix)]
89+
if base in meta:
90+
meta.setdefault(series, {}).update(meta[base])
91+
break
92+
93+
# Merge into final metrics dict, with warnings
8394
metrics = {}
8495
all_names = set(meta) | set(label_map)
8596
for name in sorted(all_names):
8697
desc = meta.get(name, {}).get("description")
87-
t = meta.get(name, {}).get("type")
98+
mtype = meta.get(name, {}).get("type")
8899
labels = sorted(label_map.get(name, []))
89100

90101
if desc is None:
91102
logging.warning(f"Metric '{name}' has samples but no # HELP.")
92103
desc = ""
93-
if t is None:
104+
if mtype is None:
94105
logging.warning(f"Metric '{name}' has no # TYPE entry.")
95106

96107
metrics[name] = {
97108
"description": desc,
98-
"type": t,
109+
"type": mtype,
99110
"labels": labels
100111
}
101112

tools/property-extractor/property_extractor.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,11 @@ def get_files_with_properties(file_pairs, treesitter_parser, cpp_language):
8585

8686

8787
def transform_files_with_properties(files_with_properties):
88-
type_transformer = TypeTransformer()
8988
transformers = [
89+
TypeTransformer(),
9090
EnterpriseTransformer(), ## this must be the first, as it modifies current data
9191
MetaParamTransformer(),
9292
BasicInfoTransformer(),
93-
type_transformer,
9493
IsNullableTransformer(),
9594
IsArrayTransformer(type_transformer),
9695
NeedsRestartTransformer(),

0 commit comments

Comments
 (0)