risedev/config_gen/
tempo_gen.rs

1// Copyright 2025 RisingWave Labs
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use crate::TempoConfig;
16pub struct TempoGen;
17
18impl TempoGen {
19    pub fn gen_tempo_yml(&self, config: &TempoConfig) -> String {
20        let http_listen_address = &config.listen_address;
21        let http_listen_port = config.port;
22
23        let otlp_host = &config.listen_address;
24        let otlp_port = config.otlp_port;
25
26        let max_bytes_per_trace = config.max_bytes_per_trace;
27
28        format!(
29            r#"# --- THIS FILE IS AUTO GENERATED BY RISEDEV ---
30server:
31  http_listen_address: "{http_listen_address}"
32  http_listen_port: {http_listen_port}
33  grpc_server_max_recv_msg_size: 104857600 # 100 Mb
34  grpc_server_max_send_msg_size: 104857600 # 100 Mb
35
36distributor:
37  receivers:
38      otlp:
39        protocols:
40          grpc:
41            endpoint: "{otlp_host}:{otlp_port}"
42
43# Overrides configuration block
44overrides:
45
46  # Global ingestion limits configurations
47  defaults:
48
49    # Global enforced overrides
50    global:
51      # Maximum size of a single trace in bytes.  A value of 0 disables the size
52      # check.
53      # This limit is used in 3 places:
54      #  - During search, traces will be skipped when they exceed this threshold.
55      #  - During ingestion, traces that exceed this threshold will be refused.
56      #  - During compaction, traces that exceed this threshold will be partially dropped.
57      # During ingestion, exceeding the threshold results in errors like
58      #    TRACE_TOO_LARGE: max size of trace (5000000) exceeded while adding 387 bytes
59      max_bytes_per_trace: {max_bytes_per_trace}
60"#
61        )
62    }
63}