How to enable data retention for 30 days in grafana tempo?

Hello ,

With grafana tempo i am able to generate traces , Our next big block is how we can maintain the retention peroid with the default config the traces are wiping out within some hours How can i keep them for atleast 30 days ?

We have investigated grafana documents but that doesn’t helping us

We need help here with configurations

Below is my current tempo config file

server:
  http_listen_port: 3200

distributor:
  receivers:                           # this configuration will listen on all ports and protocols that tempo is capable of.
    jaeger:                            # the receives all come from the OpenTelemetry collector.  more configuration information can
      protocols:                       # be found there: https://github.com/open-telemetry/opentelemetry-collector/tree/main/receiver
        thrift_http:                   #
        grpc:                          # for a production deployment you should only enable the receivers you need!
        thrift_binary:
        thrift_compact:
    zipkin:
    otlp:
      protocols:
        http:
        grpc:
    opencensus:

ingester:
  max_block_duration: 5m               # cut the headblock when this much time passes. this is being set for demo purposes and should probably be left alone normally

compactor:
  compaction:             # overall Tempo trace retention. set for demo purposes

metrics_generator:
  registry:
    external_labels:
      source: tempo
      cluster: docker-compose
  storage:
    path: /tmp/tempo/generator/wal
    remote_write:
      - url: http://prometheus:9090/api/v1/write
        send_exemplars: true

storage:
  trace:
    backend: s3                        # backend configuration to use
    wal:
      path: /tmp/tempo/wal             # where to store the the wal locally
    s3:
      bucket: tempo-grafana                    # how to store data in s3
      endpoint: s3-ap-south-1.amazonaws.com
      insecure: true
      

overrides:
  metrics_generator_processors: [service-graphs, span-metrics] # enables metrics generator

you need to configure block_retention under compactor: block:

here it how it looks like

    compactor:
        compaction:
            block_retention: 720h  # 720 hours is 30 days

here is are config docs, and see this example config for more details

also see complete config to tune compactors

1 Like

Hi @surajsidh ,

Thanks for you reply

Is this mean the data will push into S3 after 30 days ? Till 30 days the data will stored in machine.

block_retention is amount of time till data will be retained in backend (S3, GCS, Azure Blob Storage, minio, etc).

after this time compactor will delete blocks from backend storage.