MCPcopy
hub / github.com/grafana/tempo / main

Function main

cmd/tempo-vulture/main.go:138–244  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

136}
137
138func main() {
139 flag.Parse()
140
141 config := zap.NewDevelopmentEncoderConfig()
142 logger = zap.New(zapcore.NewCore(
143 zaplogfmt.NewEncoder(config),
144 os.Stdout,
145 zapcore.DebugLevel,
146 ))
147
148 vultureConfig := vultureConfiguration{
149 tempoQueryURL: tempoQueryURL,
150 tempoPushURL: tempoPushURL,
151 tempoOrgID: tempoOrgID,
152 tempoWriteBackoffDuration: tempoWriteBackoffDuration,
153 tempoLongWriteBackoffDuration: tempoLongWriteBackoffDuration,
154 tempoReadBackoffDuration: tempoReadBackoffDuration,
155 tempoSearchBackoffDuration: tempoSearchBackoffDuration,
156 tempoMetricsBackoffDuration: tempoMetricsBackoffDuration,
157 tempoRetentionDuration: tempoRetentionDuration,
158 tempoRecentTracesCutoffDuration: tempoRecentTracesCutoffDuration,
159 tempoPushTLS: tempoPushTLS,
160 tempoQueryLiveStores: tempoQueryLiveStores,
161 }
162 pushEndpoint, err := getGRPCEndpoint(vultureConfig.tempoPushURL)
163 if err != nil {
164 panic(err)
165 }
166
167 logger.Info("Tempo Vulture starting", zap.String("tempoQueryURL", vultureConfig.tempoQueryURL), zap.String("tempoPushURL", pushEndpoint))
168 jaegerClient, err := utilpkg.NewJaegerToOTLPExporterWithAuth(pushEndpoint, "", "", vultureConfig.tempoPushTLS)
169 httpClient := createHTTPClient(vultureConfig.tempoQueryURL, vultureConfig.tempoOrgID, vultureConfig.tempoQueryLiveStores)
170 if err != nil {
171 panic(err)
172 }
173
174 tickerWrite, tickerRead, tickerSearch, tickerMetrics, err := initTickers(
175 vultureConfig.tempoWriteBackoffDuration,
176 vultureConfig.tempoReadBackoffDuration,
177 vultureConfig.tempoSearchBackoffDuration,
178 vultureConfig.tempoMetricsBackoffDuration,
179 )
180 if err != nil {
181 panic(err)
182 }
183 startTime := time.Now()
184 r := rand.New(rand.NewSource(startTime.Unix()))
185 interval := vultureConfig.tempoWriteBackoffDuration
186
187 selectRecentTimestamp := func(now time.Time) (newStart, ts time.Time, skip bool) {
188 oldest := now.Add(-vultureConfig.tempoRecentTracesCutoffDuration)
189 if oldest.Before(startTime) { // if vulture's just started
190 oldest = startTime
191 }
192 newStart, ts = selectPastTimestamp(oldest, now, interval, vultureConfig.tempoRetentionDuration, r)
193 return newStart, ts, skip
194 }
195

Callers

nothing calls this directly

Calls 15

getGRPCEndpointFunction · 0.85
initTickersFunction · 0.85
selectPastTimestampFunction · 0.85
RunValidationModeFunction · 0.85
doWriteFunction · 0.85
runCheckerFunction · 0.85
doReadFunction · 0.85
doSearchFunction · 0.85
doMetricsFunction · 0.85
HandlerMethod · 0.80
createHTTPClientFunction · 0.70
ParseMethod · 0.65

Tested by

no test coverage detected