Skip to content

Commit ca1ce37

Browse files
authored
feat: Add Loki V3 support (#17)
* feat: Update the spec and Loki config for the V3 settings
1 parent 347faf8 commit ca1ce37

File tree

2 files changed

+67
-5
lines changed

2 files changed

+67
-5
lines changed

jobs/loki/spec

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,45 @@ properties:
5656
default: 0
5757

5858
loki.index.storage:
59+
description: "An index storage for Loki (tsdb, gcs, s3)"
60+
default: tsdb
61+
62+
loki.object_store.storage:
63+
description: "A object_store storage for Loki (filesystem, bigtable, dynamodb)"
64+
default: filesystem
65+
66+
loki.index.v2.storage:
5967
description: "An index storage for Loki (boltdb, gcs, s3)"
6068
default: boltdb
6169

62-
loki.object_store.storage:
70+
loki.object_store.v2.storage:
6371
description: "A object_store storage for Loki (filesystem, bigtable, dynamodb)"
6472
default: filesystem
6573

66-
loki.validation.enforce_metric_name:
67-
description: "Enforce every sample has a metric name"
74+
loki.compactor.compaction_interval:
75+
description: "Specify the compactor compaction interval"
76+
default: "10m"
77+
78+
loki.compactor.retention_enabled:
79+
description: "Specify if the compactor retention is enabled"
6880
default: true
6981

82+
loki.compactor.retention_delete_delay:
83+
description: "Specify the compactor retention deletion delay"
84+
default: "24h"
85+
86+
loki.compactor.retention_delete_worker_count:
87+
description: "Specify the compactor retention deletion worker count"
88+
default: 150
89+
90+
loki.compactor.delete_request_store:
91+
description: "Specify the compactor deletion request store"
92+
default: "filesystem"
93+
94+
loki.validation.allow_structured_metadata:
95+
description: "Enforce every sample has a structured metadata"
96+
default: false
97+
7098
loki.validation.reject_old_samples:
7199
description: "Reject old samples"
72100
default: false
@@ -75,6 +103,10 @@ properties:
75103
description: "Reject old samples max age"
76104
default: ""
77105

106+
loki.validation.retention_period:
107+
description: "Max retention period for the config limits needs to be a duration in string format that can be parsed using time.Duration"
108+
default: "672h"
109+
78110
loki.retention.period:
79111
description: "Retention period needs to be a duration in string format that can be parsed using time.Duration"
80112
default: "168h"

jobs/loki/templates/config/config.yml.erb

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@ ingester:
4343
chunk_idle_period: 5m
4444
chunk_retain_period: 30s
4545

46+
compactor:
47+
working_directory: /var/vcap/store/loki/retention
48+
compaction_interval: <%= p('loki.compactor.compaction_interval') %>
49+
retention_enabled: <%= p('loki.compactor.retention_enabled') %>
50+
retention_delete_delay: <%= p('loki.compactor.retention_delete_delay') %>
51+
retention_delete_worker_count: <%= p('loki.compactor.retention_delete_worker_count') %>
52+
delete_request_store: <%= p('loki.compactor.delete_request_store') %>
53+
4654
schema_config:
4755
configs:
4856
- from: 2023-02-24
@@ -52,26 +60,48 @@ schema_config:
5260
<% if p('loki.object_store.storage') == "filesystem" %>
5361
object_store: filesystem
5462
<% end %>
63+
<% if p('loki.index.storage') == "boltdb" %>
5564
schema: v11
5665
index:
5766
prefix: index_
5867
period: <%= p('loki.retention.period') %>
68+
<% end %>
69+
<% if p('loki.index.v2.storage') == "tsdb" %>
70+
- from: 2024-05-01
71+
store: tsdb
72+
<% end %>
73+
<% if p('loki.index.v2.storage') == "tsdb" && p('loki.object_store.v2.storage') == "filesystem" %>
74+
object_store: filesystem
75+
<% end %>
76+
<% if p('loki.index.v2.storage') == "tsdb" %>
77+
schema: v13
78+
index:
79+
prefix: index_
80+
period: 24h
81+
<% end %>
5982

6083
storage_config:
6184
<% if p('loki.index.storage') == "boltdb" %>
6285
boltdb:
6386
directory: /var/vcap/store/loki/index
6487
<% end %>
65-
88+
89+
<% if p('loki.index.storage') == "tsdb" %>
90+
tsdb_shipper:
91+
active_index_directory: /var/vcap/store/loki/tsdb-index
92+
cache_location: /var/vcap/store/loki/tsdb-cache
93+
<% end %>
94+
6695
<% if p('loki.object_store.storage') == "filesystem" %>
6796
filesystem:
6897
directory: /var/vcap/store/loki/chunks
6998
<% end %>
7099

71100
limits_config:
72-
enforce_metric_name: <%= p('loki.validation.enforce_metric_name') %>
101+
allow_structured_metadata: <%= p('loki.validation.allow_structured_metadata') %>
73102
reject_old_samples: <%= p('loki.validation.reject_old_samples') %>
74103
reject_old_samples_max_age: <%= p('loki.validation.reject_old_samples_max_age') %>
104+
retention_period: <%= p('loki.validation.retention_period') %>
75105

76106
query_range:
77107
results_cache:

0 commit comments

Comments
 (0)