(ctx context.Context, cConfig *csconfig.Config, apiClient *apiclient.ApiClient, hub *cwhub.Hub, datasources []acquisitionTypes.DataSource)
| 108 | } |
| 109 | |
| 110 | func startLPMetrics(ctx context.Context, cConfig *csconfig.Config, apiClient *apiclient.ApiClient, hub *cwhub.Hub, datasources []acquisitionTypes.DataSource) error { |
| 111 | mp := NewMetricsProvider( |
| 112 | apiClient, |
| 113 | lpMetricsDefaultInterval, |
| 114 | log.WithField("service", "lpmetrics"), |
| 115 | datasources, |
| 116 | hub, |
| 117 | ) |
| 118 | |
| 119 | go func() { |
| 120 | defer trace.ReportPanic() |
| 121 | mp.Run(ctx) |
| 122 | }() |
| 123 | |
| 124 | if cConfig.Prometheus != nil && cConfig.Prometheus.Enabled { |
| 125 | aggregated := false |
| 126 | if cConfig.Prometheus.Level == metrics.MetricsLevelAggregated { |
| 127 | aggregated = true |
| 128 | } |
| 129 | |
| 130 | if err := acquisition.GetMetrics(datasources, aggregated); err != nil { |
| 131 | return fmt.Errorf("while fetching prometheus metrics for datasources: %w", err) |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | return nil |
| 136 | } |
| 137 | |
| 138 | // runCrowdsec starts the log processor service |
| 139 | func runCrowdsec( |
no test coverage detected
searching dependent graphs…