()
| 136 | } |
| 137 | |
| 138 | func 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 |
nothing calls this directly
no test coverage detected