Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Compose(logs): Enable caches #55

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docker-compose/common/compose-include/memcached.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:

memcached-exporter:
labels:
- logs.agent.grafana.com/scrape=false
- metrics.agent.grafana.com/scrape=true
# - metrics.agent.grafana.com/job=memcached
- metrics.agent.grafana.com/port=9150
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ argument "keep_labels" {
// get the all available containers.
discovery.docker "dd_logs" {
host = "unix:///var/run/docker.sock"
refresh_interval = "15s"
refresh_interval = "30s"

filter {
name = "status"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ argument "tenant" {
// get the all available containers.
discovery.docker "dd_metrics" {
host = "unix:///var/run/docker.sock"
refresh_interval = "15s"
refresh_interval = "30s"

filter {
name = "status"
Expand Down
66 changes: 49 additions & 17 deletions docker-compose/common/config/loki/microservices-mode-logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,44 +26,76 @@ common:
insecure_skip_verify: true

compactor:
working_directory: /tmp/compactor
shared_store: s3

memberlist:
join_members:
- loki-memberlist:7946

frontend:
scheduler_address: query-scheduler:9095
tail_proxy_url: http://querier:3100
frontend_worker:
scheduler_address: query-scheduler:9095
query_range:
align_queries_with_step: true

cache_results: true
results_cache:
cache:
memcached_client:
consistent_hash: true
addresses: "dns+memcached:11211"

cache_index_stats_results: true
index_stats_results_cache:
cache:
memcached_client:
consistent_hash: true
addresses: "dns+memcached:11211"

limits_config:
max_cache_freshness_per_query: 10m
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 30m
split_queries_by_interval: 15m

ruler:
storage:
type: s3
s3:
bucketnames: loki-ruler

runtime_config:
file: /etc/loki/runtime.yaml

schema_config:
configs:
- from: "2023-08-01"
index:
period: 24h
prefix: loki_index_
period: 24h
object_store: s3
store: tsdb
schema: v12

chunk_store_config:
chunk_cache_config:
embedded_cache:
enabled: true
memcached_client:
addresses: "dns+memcached:11211"

query_range:
align_queries_with_step: true
cache_results: true
max_retries: 5
results_cache:
cache:
embedded_cache:
enabled: true
ttl: 1h
ingester:
lifecycler:
join_after: 10s
observe_period: 5s
ring:
replication_factor: 2
chunk_idle_period: 1m
max_chunk_age: 1m
chunk_retain_period: 30s
chunk_encoding: snappy
flush_op_timeout: 10s


frontend:
scheduler_address: query-scheduler:9095
tail_proxy_url: http://querier:3100
frontend_worker:
scheduler_address: query-scheduler:9095
42 changes: 37 additions & 5 deletions docker-compose/common/config/loki/monolithic-mode-logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,39 @@ memberlist:

query_range:
align_queries_with_step: true

cache_results: true
results_cache:
cache:
embedded_cache:
enabled: true
memcached_client:
consistent_hash: true
addresses: "dns+memcached:11211"

cache_index_stats_results: true
index_stats_results_cache:
cache:
memcached_client:
consistent_hash: true
addresses: "dns+memcached:11211"
# cache_volume_results: true
# cache_series_results: true
# instant_metric_query_split_align: true
# cache_instant_metric_results: true
# instant_metric_results_cache:
# cache:
# memcached_client:
# consistent_hash: true
# addresses: "dns+memcached:11211"
# series_results_cache:
# cache:
# memcached_client:
# consistent_hash: true
# addresses: dns+memcached:11211"
# volume_results_cache:
# cache:
# memcached_client:
# consistent_hash: true
# addresses: "dns+memcached:11211"

limits_config:
max_cache_freshness_per_query: 10m
Expand All @@ -53,17 +81,21 @@ ruler:
bucketnames: loki-ruler
type: s3

runtime_config:
file: /etc/loki/runtime.yaml

schema_config:
configs:
- from: "2023-08-01"
index:
period: 24h
prefix: loki_index_
period: 24h
object_store: s3
store: tsdb
schema: v12

chunk_store_config:
chunk_cache_config:
embedded_cache:
enabled: true
memcached_client:
addresses: "dns+memcached:11211"

52 changes: 30 additions & 22 deletions docker-compose/common/config/loki/read-write-mode-logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,37 @@ memberlist:

query_range:
align_queries_with_step: true

cache_results: true
results_cache:
cache:
embedded_cache:
enabled: true
memcached_client:
consistent_hash: true
addresses: "dns+memcached:11211"

cache_index_stats_results: true
index_stats_results_cache:
cache:
memcached_client:
consistent_hash: true
addresses: "dns+memcached:11211"

limits_config:
max_cache_freshness_per_query: 10m
enforce_metric_name: false
reject_old_samples: true
reject_old_samples_max_age: 30m
split_queries_by_interval: 15m

ingester:
lifecycler:
join_after: 10s
observe_period: 5s
ring:
replication_factor: 2
chunk_idle_period: 1m
max_chunk_age: 1m
chunk_retain_period: 30s
chunk_encoding: snappy
flush_op_timeout: 10s

ruler:
storage:
type: s3
s3:
bucketnames: loki-ruler
type: s3


runtime_config:
file: /etc/loki/runtime.yaml

schema_config:
configs:
Expand All @@ -77,11 +79,17 @@ schema_config:

chunk_store_config:
chunk_cache_config:
embedded_cache:
enabled: true

frontend:
compress_responses: true
memcached_client:
addresses: "dns+memcached:11211"

query_scheduler:
max_outstanding_requests_per_tenant: 1024
ingester:
lifecycler:
join_after: 10s
observe_period: 5s
ring:
replication_factor: 2
chunk_idle_period: 1m
max_chunk_age: 1m
chunk_retain_period: 30s
chunk_encoding: snappy
flush_op_timeout: 10s
10 changes: 10 additions & 0 deletions docker-compose/common/config/loki/runtime.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file can be used to set overrides or other runtime config.
overrides:
"fake": # limits for anonymous that the whole cluster enforces
ingestion_rate_mb: 1500000
max_streams_per_user: 100000
max_chunks_per_query: 100000
"anonymous": # limits for anonymous that the whole cluster enforces
ingestion_rate_mb: 1500000
max_streams_per_user: 100000
max_chunks_per_query: 100000
33 changes: 17 additions & 16 deletions docker-compose/microservices-mode/logs/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ version: '3.9'
include:
- path: ../../common/compose-include/minio.yaml
- path: ../../common/compose-include/agent-collect-logs.yaml
- path: ../../common/compose-include/memcached.yaml

x-labels: &loki-labels
- logs.agent.grafana.com/log-format=json
Expand Down Expand Up @@ -48,9 +49,9 @@ services:
condition: service_started
image: &lokiImage ${LOKI_IMAGE:-docker.io/grafana/loki:latest}
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=distributor
- -config.expand-env=true
healthcheck:
Expand All @@ -72,9 +73,9 @@ services:
condition: service_healthy
image: *lokiImage
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=ingester
- -config.expand-env=true
deploy:
Expand All @@ -91,19 +92,19 @@ services:
condition: service_started
image: *lokiImage
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=query-frontend
- -config.expand-env=true

query-scheduler:
labels: *loki-labels
image: *lokiImage
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=query-scheduler
- -config.expand-env=true
deploy:
Expand All @@ -120,9 +121,9 @@ services:
condition: service_started
image: *lokiImage
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=querier
- -config.expand-env=true

Expand All @@ -133,11 +134,11 @@ services:
condition: service_healthy
image: *lokiImage
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -target=ruler
- -config.expand-env=true
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=ruler
- -config.expand-env=true
networks:
default:
aliases:
Expand All @@ -147,9 +148,9 @@ services:
labels: *loki-labels
image: *lokiImage
volumes:
- ../../common/config/loki/microservices-mode-logs.yaml:/etc/loki.yaml # Note: Loki use microservices-mode-logs.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/loki.yaml
- -config.file=/etc/loki/microservices-mode-logs.yaml
- -target=compactor
- -config.expand-env=true
networks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ services:
condition: service_healthy
image: ${LOKI_IMAGE:-docker.io/grafana/loki:latest}
volumes:
- ../../common/config/loki/monolithic-mode-logs.yaml:/etc/config.yaml
- ../../common/config/loki:/etc/loki
command:
- -config.file=/etc/config.yaml
- -config.file=/etc/loki/monolithic-mode-logs.yaml
- -target=all
- -config.expand-env=true
environment:
Expand Down
Loading