@@ -1341,11 +1341,13 @@ func (f *fakeVarsManager) DefaultProvider() string {
1341
1341
var _ OTelManager = (* fakeOTelManager )(nil )
1342
1342
1343
1343
type fakeOTelManager struct {
1344
- updateCollectorCallback func (* confmap.Conf ) error
1345
- updateComponentCallback func ([]component.Component ) error
1346
- errChan chan error
1347
- collectorStatusChan chan * status.AggregateStatus
1348
- componentStateChan chan []runtime.ComponentComponentState
1344
+ updateCollectorCallback func (* confmap.Conf ) error
1345
+ updateComponentCallback func ([]component.Component ) error
1346
+ performDiagnosticsCallback func (context.Context , ... runtime.ComponentUnitDiagnosticRequest ) []runtime.ComponentUnitDiagnostic
1347
+ performComponentDiagnosticsCallback func (context.Context , []cproto.AdditionalDiagnosticRequest , ... component.Component ) ([]runtime.ComponentDiagnostic , error )
1348
+ errChan chan error
1349
+ collectorStatusChan chan * status.AggregateStatus
1350
+ componentStateChan chan []runtime.ComponentComponentState
1349
1351
}
1350
1352
1351
1353
func (f * fakeOTelManager ) Run (ctx context.Context ) error {
@@ -1385,12 +1387,28 @@ func (f *fakeOTelManager) WatchComponents() <-chan []runtime.ComponentComponentS
1385
1387
1386
1388
func (f * fakeOTelManager ) MergedOtelConfig () * confmap.Conf { return nil }
1387
1389
1390
+ func (f * fakeOTelManager ) PerformDiagnostics (ctx context.Context , reqs ... runtime.ComponentUnitDiagnosticRequest ) []runtime.ComponentUnitDiagnostic {
1391
+ if f .performDiagnosticsCallback != nil {
1392
+ return f .performDiagnosticsCallback (ctx , reqs ... )
1393
+ }
1394
+ return nil
1395
+ }
1396
+
1397
+ func (f * fakeOTelManager ) PerformComponentDiagnostics (ctx context.Context , additionalMetrics []cproto.AdditionalDiagnosticRequest , req ... component.Component ) ([]runtime.ComponentDiagnostic , error ) {
1398
+ if f .performComponentDiagnosticsCallback != nil {
1399
+ return f .performComponentDiagnosticsCallback (ctx , additionalMetrics , req ... )
1400
+ }
1401
+ return nil , nil
1402
+ }
1403
+
1388
1404
// An implementation of the RuntimeManager interface for use in testing.
1389
1405
type fakeRuntimeManager struct {
1390
- state []runtime.ComponentComponentState
1391
- updateCallback func ([]component.Component ) error
1392
- result error
1393
- errChan chan error
1406
+ state []runtime.ComponentComponentState
1407
+ updateCallback func ([]component.Component ) error
1408
+ performDiagnosticsCallback func (context.Context , ... runtime.ComponentUnitDiagnosticRequest ) []runtime.ComponentUnitDiagnostic
1409
+ performComponentDiagnosticsCallback func (context.Context , []cproto.AdditionalDiagnosticRequest , ... component.Component ) ([]runtime.ComponentDiagnostic , error )
1410
+ result error
1411
+ errChan chan error
1394
1412
}
1395
1413
1396
1414
func (r * fakeRuntimeManager ) Run (ctx context.Context ) error {
@@ -1428,12 +1446,18 @@ func (r *fakeRuntimeManager) SubscribeAll(context.Context) *runtime.Subscription
1428
1446
1429
1447
// PerformDiagnostics executes the diagnostic action for the provided units. If no units are provided then
1430
1448
// it performs diagnostics for all current units.
1431
- func (r * fakeRuntimeManager ) PerformDiagnostics (context.Context , ... runtime.ComponentUnitDiagnosticRequest ) []runtime.ComponentUnitDiagnostic {
1449
+ func (r * fakeRuntimeManager ) PerformDiagnostics (ctx context.Context , req ... runtime.ComponentUnitDiagnosticRequest ) []runtime.ComponentUnitDiagnostic {
1450
+ if r .performDiagnosticsCallback != nil {
1451
+ return r .performDiagnosticsCallback (ctx , req ... )
1452
+ }
1432
1453
return nil
1433
1454
}
1434
1455
1435
1456
// PerformComponentDiagnostics executes the diagnostic action for the provided components.
1436
- func (r * fakeRuntimeManager ) PerformComponentDiagnostics (_ context.Context , _ []cproto.AdditionalDiagnosticRequest , _ ... component.Component ) ([]runtime.ComponentDiagnostic , error ) {
1457
+ func (r * fakeRuntimeManager ) PerformComponentDiagnostics (ctx context.Context , additionalMetrics []cproto.AdditionalDiagnosticRequest , req ... component.Component ) ([]runtime.ComponentDiagnostic , error ) {
1458
+ if r .performComponentDiagnosticsCallback != nil {
1459
+ return r .performComponentDiagnosticsCallback (ctx , additionalMetrics , req ... )
1460
+ }
1437
1461
return nil , nil
1438
1462
}
1439
1463
0 commit comments