diff --git a/frontend/graph/generated.go b/frontend/graph/generated.go index 4a9ff7dc8d..545bcf1266 100644 --- a/frontend/graph/generated.go +++ b/frontend/graph/generated.go @@ -251,13 +251,6 @@ type ComplexityRoot struct { Message func(childComplexity int) int } - InstrumentationLabelsAnalyze struct { - Instrumented func(childComplexity int) int - InstrumentedText func(childComplexity int) int - Namespace func(childComplexity int) int - Workload func(childComplexity int) int - } - InstrumentationLibraryGlobalId struct { Language func(childComplexity int) int Name func(childComplexity int) int @@ -277,6 +270,13 @@ type ComplexityRoot struct { Workloads func(childComplexity int) int } + InstrumentationSourcesAnalyze struct { + Instrumented func(childComplexity int) int + InstrumentedText func(childComplexity int) int + Namespace func(childComplexity int) int + Workload func(childComplexity int) int + } + K8sActualNamespace struct { K8sActualSources func(childComplexity int) int Name func(childComplexity int) int @@ -463,12 +463,12 @@ type ComplexityRoot struct { InstrumentationConfig func(childComplexity int) int InstrumentationDevice func(childComplexity int) int Kind func(childComplexity int) int - Labels func(childComplexity int) int Name func(childComplexity int) int Namespace func(childComplexity int) int Pods func(childComplexity int) int PodsPhasesCount func(childComplexity int) int RuntimeInfo func(childComplexity int) int + SourceObjects func(childComplexity int) int TotalPods func(childComplexity int) int } @@ -1386,34 +1386,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentationInstanceAnalyze.Message(childComplexity), true - case "InstrumentationLabelsAnalyze.instrumented": - if e.complexity.InstrumentationLabelsAnalyze.Instrumented == nil { - break - } - - return e.complexity.InstrumentationLabelsAnalyze.Instrumented(childComplexity), true - - case "InstrumentationLabelsAnalyze.instrumentedText": - if e.complexity.InstrumentationLabelsAnalyze.InstrumentedText == nil { - break - } - - return e.complexity.InstrumentationLabelsAnalyze.InstrumentedText(childComplexity), true - - case "InstrumentationLabelsAnalyze.namespace": - if e.complexity.InstrumentationLabelsAnalyze.Namespace == nil { - break - } - - return e.complexity.InstrumentationLabelsAnalyze.Namespace(childComplexity), true - - case "InstrumentationLabelsAnalyze.workload": - if e.complexity.InstrumentationLabelsAnalyze.Workload == nil { - break - } - - return e.complexity.InstrumentationLabelsAnalyze.Workload(childComplexity), true - case "InstrumentationLibraryGlobalId.language": if e.complexity.InstrumentationLibraryGlobalId.Language == nil { break @@ -1505,6 +1477,34 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.InstrumentationRule.Workloads(childComplexity), true + case "InstrumentationSourcesAnalyze.instrumented": + if e.complexity.InstrumentationSourcesAnalyze.Instrumented == nil { + break + } + + return e.complexity.InstrumentationSourcesAnalyze.Instrumented(childComplexity), true + + case "InstrumentationSourcesAnalyze.instrumentedText": + if e.complexity.InstrumentationSourcesAnalyze.InstrumentedText == nil { + break + } + + return e.complexity.InstrumentationSourcesAnalyze.InstrumentedText(childComplexity), true + + case "InstrumentationSourcesAnalyze.namespace": + if e.complexity.InstrumentationSourcesAnalyze.Namespace == nil { + break + } + + return e.complexity.InstrumentationSourcesAnalyze.Namespace(childComplexity), true + + case "InstrumentationSourcesAnalyze.workload": + if e.complexity.InstrumentationSourcesAnalyze.Workload == nil { + break + } + + return e.complexity.InstrumentationSourcesAnalyze.Workload(childComplexity), true + case "K8sActualNamespace.k8sActualSources": if e.complexity.K8sActualNamespace.K8sActualSources == nil { break @@ -2418,13 +2418,6 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SourceAnalyze.Kind(childComplexity), true - case "SourceAnalyze.labels": - if e.complexity.SourceAnalyze.Labels == nil { - break - } - - return e.complexity.SourceAnalyze.Labels(childComplexity), true - case "SourceAnalyze.name": if e.complexity.SourceAnalyze.Name == nil { break @@ -2460,6 +2453,13 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in return e.complexity.SourceAnalyze.RuntimeInfo(childComplexity), true + case "SourceAnalyze.sourceObjects": + if e.complexity.SourceAnalyze.SourceObjects == nil { + break + } + + return e.complexity.SourceAnalyze.SourceObjects(childComplexity), true + case "SourceAnalyze.totalPods": if e.complexity.SourceAnalyze.TotalPods == nil { break @@ -8577,8 +8577,8 @@ func (ec *executionContext) fieldContext_InstrumentationInstanceAnalyze_identify return fc, nil } -func (ec *executionContext) _InstrumentationLabelsAnalyze_instrumented(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLabelsAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLabelsAnalyze_instrumented(ctx, field) +func (ec *executionContext) _InstrumentationLibraryGlobalId_name(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_name(ctx, field) if err != nil { return graphql.Null } @@ -8591,7 +8591,7 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_instrumented(ctx conte }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Instrumented, nil + return obj.Name, nil }) if err != nil { ec.Error(ctx, err) @@ -8603,36 +8603,26 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_instrumented(ctx conte } return graphql.Null } - res := resTmp.(*model.EntityProperty) + res := resTmp.(string) fc.Result = res - return ec.marshalNEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLabelsAnalyze_instrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLabelsAnalyze", + Object: "InstrumentationLibraryGlobalId", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationLabelsAnalyze_workload(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLabelsAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLabelsAnalyze_workload(ctx, field) +func (ec *executionContext) _InstrumentationLibraryGlobalId_spanKind(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_spanKind(ctx, field) if err != nil { return graphql.Null } @@ -8645,7 +8635,7 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_workload(ctx context.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Workload, nil + return obj.SpanKind, nil }) if err != nil { ec.Error(ctx, err) @@ -8654,36 +8644,26 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_workload(ctx context.C if resTmp == nil { return graphql.Null } - res := resTmp.(*model.EntityProperty) + res := resTmp.(*model.SpanKind) fc.Result = res - return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) + return ec.marshalOSpanKind2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSpanKind(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLabelsAnalyze_workload(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_spanKind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLabelsAnalyze", + Object: "InstrumentationLibraryGlobalId", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) + return nil, errors.New("field of type SpanKind does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationLabelsAnalyze_namespace(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLabelsAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLabelsAnalyze_namespace(ctx, field) +func (ec *executionContext) _InstrumentationLibraryGlobalId_language(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_language(ctx, field) if err != nil { return graphql.Null } @@ -8696,7 +8676,7 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_namespace(ctx context. }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Namespace, nil + return obj.Language, nil }) if err != nil { ec.Error(ctx, err) @@ -8705,36 +8685,26 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_namespace(ctx context. if resTmp == nil { return graphql.Null } - res := resTmp.(*model.EntityProperty) + res := resTmp.(*model.ProgrammingLanguage) fc.Result = res - return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) + return ec.marshalOProgrammingLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLabelsAnalyze_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLabelsAnalyze", + Object: "InstrumentationLibraryGlobalId", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) + return nil, errors.New("field of type ProgrammingLanguage does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationLabelsAnalyze_instrumentedText(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLabelsAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLabelsAnalyze_instrumentedText(ctx, field) +func (ec *executionContext) _InstrumentationRule_ruleId(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_ruleId(ctx, field) if err != nil { return graphql.Null } @@ -8747,45 +8717,38 @@ func (ec *executionContext) _InstrumentationLabelsAnalyze_instrumentedText(ctx c }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InstrumentedText, nil + return obj.RuleID, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*model.EntityProperty) + res := resTmp.(string) fc.Result = res - return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) + return ec.marshalNID2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLabelsAnalyze_instrumentedText(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_ruleId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLabelsAnalyze", + Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - switch field.Name { - case "name": - return ec.fieldContext_EntityProperty_name(ctx, field) - case "value": - return ec.fieldContext_EntityProperty_value(ctx, field) - case "status": - return ec.fieldContext_EntityProperty_status(ctx, field) - case "explain": - return ec.fieldContext_EntityProperty_explain(ctx, field) - } - return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) + return nil, errors.New("field of type ID does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationLibraryGlobalId_name(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_name(ctx, field) +func (ec *executionContext) _InstrumentationRule_ruleName(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_ruleName(ctx, field) if err != nil { return graphql.Null } @@ -8798,26 +8761,23 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId_name(ctx context.Con }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Name, nil + return obj.RuleName, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*string) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_name(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_ruleName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLibraryGlobalId", + Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, @@ -8828,8 +8788,8 @@ func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_name(_ c return fc, nil } -func (ec *executionContext) _InstrumentationLibraryGlobalId_spanKind(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_spanKind(ctx, field) +func (ec *executionContext) _InstrumentationRule_notes(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_notes(ctx, field) if err != nil { return graphql.Null } @@ -8842,7 +8802,7 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId_spanKind(ctx context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.SpanKind, nil + return obj.Notes, nil }) if err != nil { ec.Error(ctx, err) @@ -8851,26 +8811,26 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId_spanKind(ctx context if resTmp == nil { return graphql.Null } - res := resTmp.(*model.SpanKind) + res := resTmp.(*string) fc.Result = res - return ec.marshalOSpanKind2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐSpanKind(ctx, field.Selections, res) + return ec.marshalOString2ᚖstring(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_spanKind(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLibraryGlobalId", + Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type SpanKind does not have child fields") + return nil, errors.New("field of type String does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationLibraryGlobalId_language(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationLibraryGlobalID) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationLibraryGlobalId_language(ctx, field) +func (ec *executionContext) _InstrumentationRule_disabled(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_disabled(ctx, field) if err != nil { return graphql.Null } @@ -8883,7 +8843,7 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId_language(ctx context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Language, nil + return obj.Disabled, nil }) if err != nil { ec.Error(ctx, err) @@ -8892,26 +8852,26 @@ func (ec *executionContext) _InstrumentationLibraryGlobalId_language(ctx context if resTmp == nil { return graphql.Null } - res := resTmp.(*model.ProgrammingLanguage) + res := resTmp.(*bool) fc.Result = res - return ec.marshalOProgrammingLanguage2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐProgrammingLanguage(ctx, field.Selections, res) + return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationLibraryGlobalId_language(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_disabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationLibraryGlobalId", + Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ProgrammingLanguage does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_ruleId(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_ruleId(ctx, field) +func (ec *executionContext) _InstrumentationRule_mutable(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_mutable(ctx, field) if err != nil { return graphql.Null } @@ -8924,7 +8884,7 @@ func (ec *executionContext) _InstrumentationRule_ruleId(ctx context.Context, fie }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.RuleID, nil + return obj.Mutable, nil }) if err != nil { ec.Error(ctx, err) @@ -8936,26 +8896,26 @@ func (ec *executionContext) _InstrumentationRule_ruleId(ctx context.Context, fie } return graphql.Null } - res := resTmp.(string) + res := resTmp.(bool) fc.Result = res - return ec.marshalNID2string(ctx, field.Selections, res) + return ec.marshalNBoolean2bool(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_ruleId(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_mutable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type ID does not have child fields") + return nil, errors.New("field of type Boolean does not have child fields") }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_ruleName(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_ruleName(ctx, field) +func (ec *executionContext) _InstrumentationRule_profileName(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_profileName(ctx, field) if err != nil { return graphql.Null } @@ -8968,21 +8928,24 @@ func (ec *executionContext) _InstrumentationRule_ruleName(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.RuleName, nil + return obj.ProfileName, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.(*string) + res := resTmp.(string) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalNString2string(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_ruleName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_profileName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentationRule", Field: field, @@ -8995,8 +8958,8 @@ func (ec *executionContext) fieldContext_InstrumentationRule_ruleName(_ context. return fc, nil } -func (ec *executionContext) _InstrumentationRule_notes(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_notes(ctx, field) +func (ec *executionContext) _InstrumentationRule_workloads(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_workloads(ctx, field) if err != nil { return graphql.Null } @@ -9009,7 +8972,7 @@ func (ec *executionContext) _InstrumentationRule_notes(ctx context.Context, fiel }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Notes, nil + return obj.Workloads, nil }) if err != nil { ec.Error(ctx, err) @@ -9018,26 +8981,34 @@ func (ec *executionContext) _InstrumentationRule_notes(ctx context.Context, fiel if resTmp == nil { return graphql.Null } - res := resTmp.(*string) + res := resTmp.([]*model.PodWorkload) fc.Result = res - return ec.marshalOString2ᚖstring(ctx, field.Selections, res) + return ec.marshalOPodWorkload2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPodWorkloadᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_notes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_workloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "namespace": + return ec.fieldContext_PodWorkload_namespace(ctx, field) + case "name": + return ec.fieldContext_PodWorkload_name(ctx, field) + case "kind": + return ec.fieldContext_PodWorkload_kind(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PodWorkload", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_disabled(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_disabled(ctx, field) +func (ec *executionContext) _InstrumentationRule_instrumentationLibraries(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_instrumentationLibraries(ctx, field) if err != nil { return graphql.Null } @@ -9050,7 +9021,7 @@ func (ec *executionContext) _InstrumentationRule_disabled(ctx context.Context, f }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Disabled, nil + return obj.InstrumentationLibraries, nil }) if err != nil { ec.Error(ctx, err) @@ -9059,26 +9030,34 @@ func (ec *executionContext) _InstrumentationRule_disabled(ctx context.Context, f if resTmp == nil { return graphql.Null } - res := resTmp.(*bool) + res := resTmp.([]*model.InstrumentationLibraryGlobalID) fc.Result = res - return ec.marshalOBoolean2ᚖbool(ctx, field.Selections, res) + return ec.marshalOInstrumentationLibraryGlobalId2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibraryGlobalIDᚄ(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_disabled(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_instrumentationLibraries(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "name": + return ec.fieldContext_InstrumentationLibraryGlobalId_name(ctx, field) + case "spanKind": + return ec.fieldContext_InstrumentationLibraryGlobalId_spanKind(ctx, field) + case "language": + return ec.fieldContext_InstrumentationLibraryGlobalId_language(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type InstrumentationLibraryGlobalId", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_mutable(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_mutable(ctx, field) +func (ec *executionContext) _InstrumentationRule_payloadCollection(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_payloadCollection(ctx, field) if err != nil { return graphql.Null } @@ -9091,38 +9070,45 @@ func (ec *executionContext) _InstrumentationRule_mutable(ctx context.Context, fi }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Mutable, nil + return obj.PayloadCollection, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(bool) + res := resTmp.(*model.PayloadCollection) fc.Result = res - return ec.marshalNBoolean2bool(ctx, field.Selections, res) + return ec.marshalOPayloadCollection2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPayloadCollection(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_mutable(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_payloadCollection(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type Boolean does not have child fields") + switch field.Name { + case "httpRequest": + return ec.fieldContext_PayloadCollection_httpRequest(ctx, field) + case "httpResponse": + return ec.fieldContext_PayloadCollection_httpResponse(ctx, field) + case "dbQuery": + return ec.fieldContext_PayloadCollection_dbQuery(ctx, field) + case "messaging": + return ec.fieldContext_PayloadCollection_messaging(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type PayloadCollection", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_profileName(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_profileName(ctx, field) +func (ec *executionContext) _InstrumentationRule_codeAttributes(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationRule_codeAttributes(ctx, field) if err != nil { return graphql.Null } @@ -9135,38 +9121,49 @@ func (ec *executionContext) _InstrumentationRule_profileName(ctx context.Context }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.ProfileName, nil + return obj.CodeAttributes, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { - if !graphql.HasFieldError(ctx, fc) { - ec.Errorf(ctx, "must not be null") - } return graphql.Null } - res := resTmp.(string) + res := resTmp.(*model.CodeAttributes) fc.Result = res - return ec.marshalNString2string(ctx, field.Selections, res) + return ec.marshalOCodeAttributes2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐCodeAttributes(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_profileName(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationRule_codeAttributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "InstrumentationRule", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { - return nil, errors.New("field of type String does not have child fields") + switch field.Name { + case "column": + return ec.fieldContext_CodeAttributes_column(ctx, field) + case "filePath": + return ec.fieldContext_CodeAttributes_filePath(ctx, field) + case "function": + return ec.fieldContext_CodeAttributes_function(ctx, field) + case "lineNumber": + return ec.fieldContext_CodeAttributes_lineNumber(ctx, field) + case "namespace": + return ec.fieldContext_CodeAttributes_namespace(ctx, field) + case "stacktrace": + return ec.fieldContext_CodeAttributes_stacktrace(ctx, field) + } + return nil, fmt.Errorf("no field named %q was found under type CodeAttributes", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_workloads(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_workloads(ctx, field) +func (ec *executionContext) _InstrumentationSourcesAnalyze_instrumented(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationSourcesAnalyze) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationSourcesAnalyze_instrumented(ctx, field) if err != nil { return graphql.Null } @@ -9179,43 +9176,48 @@ func (ec *executionContext) _InstrumentationRule_workloads(ctx context.Context, }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Workloads, nil + return obj.Instrumented, nil }) if err != nil { ec.Error(ctx, err) return graphql.Null } if resTmp == nil { + if !graphql.HasFieldError(ctx, fc) { + ec.Errorf(ctx, "must not be null") + } return graphql.Null } - res := resTmp.([]*model.PodWorkload) + res := resTmp.(*model.EntityProperty) fc.Result = res - return ec.marshalOPodWorkload2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPodWorkloadᚄ(ctx, field.Selections, res) + return ec.marshalNEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_workloads(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationSourcesAnalyze_instrumented(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationRule", + Object: "InstrumentationSourcesAnalyze", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "namespace": - return ec.fieldContext_PodWorkload_namespace(ctx, field) case "name": - return ec.fieldContext_PodWorkload_name(ctx, field) - case "kind": - return ec.fieldContext_PodWorkload_kind(ctx, field) + return ec.fieldContext_EntityProperty_name(ctx, field) + case "value": + return ec.fieldContext_EntityProperty_value(ctx, field) + case "status": + return ec.fieldContext_EntityProperty_status(ctx, field) + case "explain": + return ec.fieldContext_EntityProperty_explain(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PodWorkload", field.Name) + return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_instrumentationLibraries(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_instrumentationLibraries(ctx, field) +func (ec *executionContext) _InstrumentationSourcesAnalyze_workload(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationSourcesAnalyze) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationSourcesAnalyze_workload(ctx, field) if err != nil { return graphql.Null } @@ -9228,7 +9230,7 @@ func (ec *executionContext) _InstrumentationRule_instrumentationLibraries(ctx co }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.InstrumentationLibraries, nil + return obj.Workload, nil }) if err != nil { ec.Error(ctx, err) @@ -9237,34 +9239,36 @@ func (ec *executionContext) _InstrumentationRule_instrumentationLibraries(ctx co if resTmp == nil { return graphql.Null } - res := resTmp.([]*model.InstrumentationLibraryGlobalID) + res := resTmp.(*model.EntityProperty) fc.Result = res - return ec.marshalOInstrumentationLibraryGlobalId2ᚕᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibraryGlobalIDᚄ(ctx, field.Selections, res) + return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_instrumentationLibraries(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationSourcesAnalyze_workload(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationRule", + Object: "InstrumentationSourcesAnalyze", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "name": - return ec.fieldContext_InstrumentationLibraryGlobalId_name(ctx, field) - case "spanKind": - return ec.fieldContext_InstrumentationLibraryGlobalId_spanKind(ctx, field) - case "language": - return ec.fieldContext_InstrumentationLibraryGlobalId_language(ctx, field) + return ec.fieldContext_EntityProperty_name(ctx, field) + case "value": + return ec.fieldContext_EntityProperty_value(ctx, field) + case "status": + return ec.fieldContext_EntityProperty_status(ctx, field) + case "explain": + return ec.fieldContext_EntityProperty_explain(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type InstrumentationLibraryGlobalId", field.Name) + return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_payloadCollection(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_payloadCollection(ctx, field) +func (ec *executionContext) _InstrumentationSourcesAnalyze_namespace(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationSourcesAnalyze) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationSourcesAnalyze_namespace(ctx, field) if err != nil { return graphql.Null } @@ -9277,7 +9281,7 @@ func (ec *executionContext) _InstrumentationRule_payloadCollection(ctx context.C }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.PayloadCollection, nil + return obj.Namespace, nil }) if err != nil { ec.Error(ctx, err) @@ -9286,36 +9290,36 @@ func (ec *executionContext) _InstrumentationRule_payloadCollection(ctx context.C if resTmp == nil { return graphql.Null } - res := resTmp.(*model.PayloadCollection) + res := resTmp.(*model.EntityProperty) fc.Result = res - return ec.marshalOPayloadCollection2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐPayloadCollection(ctx, field.Selections, res) + return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_payloadCollection(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationSourcesAnalyze_namespace(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationRule", + Object: "InstrumentationSourcesAnalyze", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "httpRequest": - return ec.fieldContext_PayloadCollection_httpRequest(ctx, field) - case "httpResponse": - return ec.fieldContext_PayloadCollection_httpResponse(ctx, field) - case "dbQuery": - return ec.fieldContext_PayloadCollection_dbQuery(ctx, field) - case "messaging": - return ec.fieldContext_PayloadCollection_messaging(ctx, field) + case "name": + return ec.fieldContext_EntityProperty_name(ctx, field) + case "value": + return ec.fieldContext_EntityProperty_value(ctx, field) + case "status": + return ec.fieldContext_EntityProperty_status(ctx, field) + case "explain": + return ec.fieldContext_EntityProperty_explain(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type PayloadCollection", field.Name) + return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) }, } return fc, nil } -func (ec *executionContext) _InstrumentationRule_codeAttributes(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationRule) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_InstrumentationRule_codeAttributes(ctx, field) +func (ec *executionContext) _InstrumentationSourcesAnalyze_instrumentedText(ctx context.Context, field graphql.CollectedField, obj *model.InstrumentationSourcesAnalyze) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_InstrumentationSourcesAnalyze_instrumentedText(ctx, field) if err != nil { return graphql.Null } @@ -9328,7 +9332,7 @@ func (ec *executionContext) _InstrumentationRule_codeAttributes(ctx context.Cont }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.CodeAttributes, nil + return obj.InstrumentedText, nil }) if err != nil { ec.Error(ctx, err) @@ -9337,33 +9341,29 @@ func (ec *executionContext) _InstrumentationRule_codeAttributes(ctx context.Cont if resTmp == nil { return graphql.Null } - res := resTmp.(*model.CodeAttributes) + res := resTmp.(*model.EntityProperty) fc.Result = res - return ec.marshalOCodeAttributes2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐCodeAttributes(ctx, field.Selections, res) + return ec.marshalOEntityProperty2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐEntityProperty(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_InstrumentationRule_codeAttributes(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_InstrumentationSourcesAnalyze_instrumentedText(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ - Object: "InstrumentationRule", + Object: "InstrumentationSourcesAnalyze", Field: field, IsMethod: false, IsResolver: false, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { - case "column": - return ec.fieldContext_CodeAttributes_column(ctx, field) - case "filePath": - return ec.fieldContext_CodeAttributes_filePath(ctx, field) - case "function": - return ec.fieldContext_CodeAttributes_function(ctx, field) - case "lineNumber": - return ec.fieldContext_CodeAttributes_lineNumber(ctx, field) - case "namespace": - return ec.fieldContext_CodeAttributes_namespace(ctx, field) - case "stacktrace": - return ec.fieldContext_CodeAttributes_stacktrace(ctx, field) + case "name": + return ec.fieldContext_EntityProperty_name(ctx, field) + case "value": + return ec.fieldContext_EntityProperty_value(ctx, field) + case "status": + return ec.fieldContext_EntityProperty_status(ctx, field) + case "explain": + return ec.fieldContext_EntityProperty_explain(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type CodeAttributes", field.Name) + return nil, fmt.Errorf("no field named %q was found under type EntityProperty", field.Name) }, } return fc, nil @@ -14325,8 +14325,8 @@ func (ec *executionContext) fieldContext_Query_describeSource(ctx context.Contex return ec.fieldContext_SourceAnalyze_kind(ctx, field) case "namespace": return ec.fieldContext_SourceAnalyze_namespace(ctx, field) - case "labels": - return ec.fieldContext_SourceAnalyze_labels(ctx, field) + case "sourceObjects": + return ec.fieldContext_SourceAnalyze_sourceObjects(ctx, field) case "runtimeInfo": return ec.fieldContext_SourceAnalyze_runtimeInfo(ctx, field) case "instrumentationConfig": @@ -15410,8 +15410,8 @@ func (ec *executionContext) fieldContext_SourceAnalyze_namespace(_ context.Conte return fc, nil } -func (ec *executionContext) _SourceAnalyze_labels(ctx context.Context, field graphql.CollectedField, obj *model.SourceAnalyze) (ret graphql.Marshaler) { - fc, err := ec.fieldContext_SourceAnalyze_labels(ctx, field) +func (ec *executionContext) _SourceAnalyze_sourceObjects(ctx context.Context, field graphql.CollectedField, obj *model.SourceAnalyze) (ret graphql.Marshaler) { + fc, err := ec.fieldContext_SourceAnalyze_sourceObjects(ctx, field) if err != nil { return graphql.Null } @@ -15424,7 +15424,7 @@ func (ec *executionContext) _SourceAnalyze_labels(ctx context.Context, field gra }() resTmp, err := ec.ResolverMiddleware(ctx, func(rctx context.Context) (interface{}, error) { ctx = rctx // use context from middleware stack in children - return obj.Labels, nil + return obj.SourceObjects, nil }) if err != nil { ec.Error(ctx, err) @@ -15436,12 +15436,12 @@ func (ec *executionContext) _SourceAnalyze_labels(ctx context.Context, field gra } return graphql.Null } - res := resTmp.(*model.InstrumentationLabelsAnalyze) + res := resTmp.(*model.InstrumentationSourcesAnalyze) fc.Result = res - return ec.marshalNInstrumentationLabelsAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLabelsAnalyze(ctx, field.Selections, res) + return ec.marshalNInstrumentationSourcesAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationSourcesAnalyze(ctx, field.Selections, res) } -func (ec *executionContext) fieldContext_SourceAnalyze_labels(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { +func (ec *executionContext) fieldContext_SourceAnalyze_sourceObjects(_ context.Context, field graphql.CollectedField) (fc *graphql.FieldContext, err error) { fc = &graphql.FieldContext{ Object: "SourceAnalyze", Field: field, @@ -15450,15 +15450,15 @@ func (ec *executionContext) fieldContext_SourceAnalyze_labels(_ context.Context, Child: func(ctx context.Context, field graphql.CollectedField) (*graphql.FieldContext, error) { switch field.Name { case "instrumented": - return ec.fieldContext_InstrumentationLabelsAnalyze_instrumented(ctx, field) + return ec.fieldContext_InstrumentationSourcesAnalyze_instrumented(ctx, field) case "workload": - return ec.fieldContext_InstrumentationLabelsAnalyze_workload(ctx, field) + return ec.fieldContext_InstrumentationSourcesAnalyze_workload(ctx, field) case "namespace": - return ec.fieldContext_InstrumentationLabelsAnalyze_namespace(ctx, field) + return ec.fieldContext_InstrumentationSourcesAnalyze_namespace(ctx, field) case "instrumentedText": - return ec.fieldContext_InstrumentationLabelsAnalyze_instrumentedText(ctx, field) + return ec.fieldContext_InstrumentationSourcesAnalyze_instrumentedText(ctx, field) } - return nil, fmt.Errorf("no field named %q was found under type InstrumentationLabelsAnalyze", field.Name) + return nil, fmt.Errorf("no field named %q was found under type InstrumentationSourcesAnalyze", field.Name) }, } return fc, nil @@ -20625,51 +20625,6 @@ func (ec *executionContext) _InstrumentationInstanceAnalyze(ctx context.Context, return out } -var instrumentationLabelsAnalyzeImplementors = []string{"InstrumentationLabelsAnalyze"} - -func (ec *executionContext) _InstrumentationLabelsAnalyze(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationLabelsAnalyze) graphql.Marshaler { - fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationLabelsAnalyzeImplementors) - - out := graphql.NewFieldSet(fields) - deferred := make(map[string]*graphql.FieldSet) - for i, field := range fields { - switch field.Name { - case "__typename": - out.Values[i] = graphql.MarshalString("InstrumentationLabelsAnalyze") - case "instrumented": - out.Values[i] = ec._InstrumentationLabelsAnalyze_instrumented(ctx, field, obj) - if out.Values[i] == graphql.Null { - out.Invalids++ - } - case "workload": - out.Values[i] = ec._InstrumentationLabelsAnalyze_workload(ctx, field, obj) - case "namespace": - out.Values[i] = ec._InstrumentationLabelsAnalyze_namespace(ctx, field, obj) - case "instrumentedText": - out.Values[i] = ec._InstrumentationLabelsAnalyze_instrumentedText(ctx, field, obj) - default: - panic("unknown field " + strconv.Quote(field.Name)) - } - } - out.Dispatch(ctx) - if out.Invalids > 0 { - return graphql.Null - } - - atomic.AddInt32(&ec.deferred, int32(len(deferred))) - - for label, dfs := range deferred { - ec.processDeferredGroup(graphql.DeferredGroup{ - Label: label, - Path: graphql.GetPath(ctx), - FieldSet: dfs, - Context: ctx, - }) - } - - return out -} - var instrumentationLibraryGlobalIdImplementors = []string{"InstrumentationLibraryGlobalId"} func (ec *executionContext) _InstrumentationLibraryGlobalId(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationLibraryGlobalID) graphql.Marshaler { @@ -20776,6 +20731,51 @@ func (ec *executionContext) _InstrumentationRule(ctx context.Context, sel ast.Se return out } +var instrumentationSourcesAnalyzeImplementors = []string{"InstrumentationSourcesAnalyze"} + +func (ec *executionContext) _InstrumentationSourcesAnalyze(ctx context.Context, sel ast.SelectionSet, obj *model.InstrumentationSourcesAnalyze) graphql.Marshaler { + fields := graphql.CollectFields(ec.OperationContext, sel, instrumentationSourcesAnalyzeImplementors) + + out := graphql.NewFieldSet(fields) + deferred := make(map[string]*graphql.FieldSet) + for i, field := range fields { + switch field.Name { + case "__typename": + out.Values[i] = graphql.MarshalString("InstrumentationSourcesAnalyze") + case "instrumented": + out.Values[i] = ec._InstrumentationSourcesAnalyze_instrumented(ctx, field, obj) + if out.Values[i] == graphql.Null { + out.Invalids++ + } + case "workload": + out.Values[i] = ec._InstrumentationSourcesAnalyze_workload(ctx, field, obj) + case "namespace": + out.Values[i] = ec._InstrumentationSourcesAnalyze_namespace(ctx, field, obj) + case "instrumentedText": + out.Values[i] = ec._InstrumentationSourcesAnalyze_instrumentedText(ctx, field, obj) + default: + panic("unknown field " + strconv.Quote(field.Name)) + } + } + out.Dispatch(ctx) + if out.Invalids > 0 { + return graphql.Null + } + + atomic.AddInt32(&ec.deferred, int32(len(deferred))) + + for label, dfs := range deferred { + ec.processDeferredGroup(graphql.DeferredGroup{ + Label: label, + Path: graphql.GetPath(ctx), + FieldSet: dfs, + Context: ctx, + }) + } + + return out +} + var k8sActualNamespaceImplementors = []string{"K8sActualNamespace"} func (ec *executionContext) _K8sActualNamespace(ctx context.Context, sel ast.SelectionSet, obj *model.K8sActualNamespace) graphql.Marshaler { @@ -22253,8 +22253,8 @@ func (ec *executionContext) _SourceAnalyze(ctx context.Context, sel ast.Selectio if out.Values[i] == graphql.Null { out.Invalids++ } - case "labels": - out.Values[i] = ec._SourceAnalyze_labels(ctx, field, obj) + case "sourceObjects": + out.Values[i] = ec._SourceAnalyze_sourceObjects(ctx, field, obj) if out.Values[i] == graphql.Null { out.Invalids++ } @@ -23562,16 +23562,6 @@ func (ec *executionContext) marshalNInstrumentationInstanceAnalyze2ᚖgithubᚗc return ec._InstrumentationInstanceAnalyze(ctx, sel, v) } -func (ec *executionContext) marshalNInstrumentationLabelsAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLabelsAnalyze(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentationLabelsAnalyze) graphql.Marshaler { - if v == nil { - if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { - ec.Errorf(ctx, "the requested element is null which the schema does not allow") - } - return graphql.Null - } - return ec._InstrumentationLabelsAnalyze(ctx, sel, v) -} - func (ec *executionContext) marshalNInstrumentationLibraryGlobalId2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationLibraryGlobalID(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentationLibraryGlobalID) graphql.Marshaler { if v == nil { if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { @@ -23650,6 +23640,16 @@ func (ec *executionContext) unmarshalNInstrumentationRuleInput2githubᚗcomᚋod return res, graphql.ErrorOnPath(ctx, err) } +func (ec *executionContext) marshalNInstrumentationSourcesAnalyze2ᚖgithubᚗcomᚋodigosᚑioᚋodigosᚋfrontendᚋgraphᚋmodelᚐInstrumentationSourcesAnalyze(ctx context.Context, sel ast.SelectionSet, v *model.InstrumentationSourcesAnalyze) graphql.Marshaler { + if v == nil { + if !graphql.HasFieldError(ctx, graphql.GetFieldContext(ctx)) { + ec.Errorf(ctx, "the requested element is null which the schema does not allow") + } + return graphql.Null + } + return ec._InstrumentationSourcesAnalyze(ctx, sel, v) +} + func (ec *executionContext) unmarshalNInt2int(ctx context.Context, v interface{}) (int, error) { res, err := graphql.UnmarshalInt(v) return res, graphql.ErrorOnPath(ctx, err) diff --git a/frontend/graph/model/models_gen.go b/frontend/graph/model/models_gen.go index 44fe5f802f..c645d5f783 100644 --- a/frontend/graph/model/models_gen.go +++ b/frontend/graph/model/models_gen.go @@ -284,13 +284,6 @@ type InstrumentationInstanceAnalyze struct { IdentifyingAttributes []*EntityProperty `json:"identifyingAttributes"` } -type InstrumentationLabelsAnalyze struct { - Instrumented *EntityProperty `json:"instrumented"` - Workload *EntityProperty `json:"workload,omitempty"` - Namespace *EntityProperty `json:"namespace,omitempty"` - InstrumentedText *EntityProperty `json:"instrumentedText,omitempty"` -} - type InstrumentationLibraryGlobalID struct { Name string `json:"name"` SpanKind *SpanKind `json:"spanKind,omitempty"` @@ -326,6 +319,13 @@ type InstrumentationRuleInput struct { CodeAttributes *CodeAttributesInput `json:"codeAttributes,omitempty"` } +type InstrumentationSourcesAnalyze struct { + Instrumented *EntityProperty `json:"instrumented"` + Workload *EntityProperty `json:"workload,omitempty"` + Namespace *EntityProperty `json:"namespace,omitempty"` + InstrumentedText *EntityProperty `json:"instrumentedText,omitempty"` +} + type K8sActualNamespace struct { Name string `json:"name"` Selected bool `json:"selected"` @@ -603,16 +603,16 @@ type SingleSourceMetricsResponse struct { } type SourceAnalyze struct { - Name *EntityProperty `json:"name"` - Kind *EntityProperty `json:"kind"` - Namespace *EntityProperty `json:"namespace"` - Labels *InstrumentationLabelsAnalyze `json:"labels"` - RuntimeInfo *RuntimeInfoAnalyze `json:"runtimeInfo"` - InstrumentationConfig *InstrumentationConfigAnalyze `json:"instrumentationConfig"` - InstrumentationDevice *InstrumentationDeviceAnalyze `json:"instrumentationDevice"` - TotalPods int `json:"totalPods"` - PodsPhasesCount string `json:"podsPhasesCount"` - Pods []*PodAnalyze `json:"pods"` + Name *EntityProperty `json:"name"` + Kind *EntityProperty `json:"kind"` + Namespace *EntityProperty `json:"namespace"` + SourceObjects *InstrumentationSourcesAnalyze `json:"sourceObjects"` + RuntimeInfo *RuntimeInfoAnalyze `json:"runtimeInfo"` + InstrumentationConfig *InstrumentationConfigAnalyze `json:"instrumentationConfig"` + InstrumentationDevice *InstrumentationDeviceAnalyze `json:"instrumentationDevice"` + TotalPods int `json:"totalPods"` + PodsPhasesCount string `json:"podsPhasesCount"` + Pods []*PodAnalyze `json:"pods"` } type SourceContainerRuntimeDetails struct { diff --git a/frontend/graph/schema.graphqls b/frontend/graph/schema.graphqls index a84ff56a6c..1ccd123c8f 100644 --- a/frontend/graph/schema.graphqls +++ b/frontend/graph/schema.graphqls @@ -477,7 +477,7 @@ type EntityProperty { explain: String } -type InstrumentationLabelsAnalyze { +type InstrumentationSourcesAnalyze { instrumented: EntityProperty! workload: EntityProperty namespace: EntityProperty @@ -536,7 +536,7 @@ type SourceAnalyze { name: EntityProperty! kind: EntityProperty! namespace: EntityProperty! - labels: InstrumentationLabelsAnalyze! + sourceObjects: InstrumentationSourcesAnalyze! runtimeInfo: RuntimeInfoAnalyze! instrumentationConfig: InstrumentationConfigAnalyze! diff --git a/frontend/services/describe/source_describe/source_describe.go b/frontend/services/describe/source_describe/source_describe.go index 595a20e8ce..7944b94eec 100644 --- a/frontend/services/describe/source_describe/source_describe.go +++ b/frontend/services/describe/source_describe/source_describe.go @@ -44,11 +44,11 @@ func ConvertSourceAnalyzeToGQL(analyze *source.SourceAnalyze) *model.SourceAnaly Name: describe_utils.ConvertEntityPropertyToGQL(&analyze.Name), Kind: describe_utils.ConvertEntityPropertyToGQL(&analyze.Kind), Namespace: describe_utils.ConvertEntityPropertyToGQL(&analyze.Namespace), - Labels: &model.InstrumentationLabelsAnalyze{ - Instrumented: describe_utils.ConvertEntityPropertyToGQL(&analyze.Labels.Instrumented), - Workload: describe_utils.ConvertEntityPropertyToGQL(analyze.Labels.Workload), - Namespace: describe_utils.ConvertEntityPropertyToGQL(analyze.Labels.Namespace), - InstrumentedText: describe_utils.ConvertEntityPropertyToGQL(&analyze.Labels.InstrumentedText), + SourceObjects: &model.InstrumentationSourcesAnalyze{ + Instrumented: describe_utils.ConvertEntityPropertyToGQL(&analyze.SourceObjectsAnalysis.Instrumented), + Workload: describe_utils.ConvertEntityPropertyToGQL(analyze.SourceObjectsAnalysis.Workload), + Namespace: describe_utils.ConvertEntityPropertyToGQL(analyze.SourceObjectsAnalysis.Namespace), + InstrumentedText: describe_utils.ConvertEntityPropertyToGQL(&analyze.SourceObjectsAnalysis.InstrumentedText), }, RuntimeInfo: convertRuntimeInfoToGQL(analyze.RuntimeInfo), InstrumentationConfig: &model.InstrumentationConfigAnalyze{ diff --git a/frontend/webapp/graphql/queries/describe.ts b/frontend/webapp/graphql/queries/describe.ts index 526b0ed50d..9bd89ca650 100644 --- a/frontend/webapp/graphql/queries/describe.ts +++ b/frontend/webapp/graphql/queries/describe.ts @@ -180,7 +180,7 @@ export const DESCRIBE_SOURCE = gql` status explain } - labels { + sourceObjects { instrumented { name value diff --git a/frontend/webapp/hooks/describe/useDescribeSource.ts b/frontend/webapp/hooks/describe/useDescribeSource.ts index 062b9236af..a515b14b3d 100644 --- a/frontend/webapp/hooks/describe/useDescribeSource.ts +++ b/frontend/webapp/hooks/describe/useDescribeSource.ts @@ -32,7 +32,7 @@ export const useDescribeSource = ({ namespace, name, kind }: WorkloadId) => { }; Object.values(code).forEach((val) => mapObjects(val)); - Object.values(code.labels).forEach((val) => mapObjects(val, 'Labels')); + Object.values(code.sourceObjects).forEach((val) => mapObjects(val, 'Sources')); Object.values(code.instrumentationConfig).forEach((val) => mapObjects(val, 'Instrumentation Config')); code.runtimeInfo?.containers?.forEach((obj, i) => Object.values(obj).forEach((val) => mapObjects(val, 'Runtime Info', { keyPrefix: `Container #${i + 1} - ` }))); Object.values(code.instrumentationDevice).forEach((val) => mapObjects(val, 'Instrumentation Device')); diff --git a/frontend/webapp/types/describe.ts b/frontend/webapp/types/describe.ts index 83b0e7c0b5..4b74c3b85f 100644 --- a/frontend/webapp/types/describe.ts +++ b/frontend/webapp/types/describe.ts @@ -5,7 +5,7 @@ interface EntityProperty { explain?: string; } -interface InstrumentationLabelsAnalyze { +interface InstrumentationSourcesAnalyze { instrumented: EntityProperty; workload?: EntityProperty; namespace?: EntityProperty; @@ -64,7 +64,7 @@ interface SourceAnalyze { name: EntityProperty; kind: EntityProperty; namespace: EntityProperty; - labels: InstrumentationLabelsAnalyze; + sourceObjects: InstrumentationSourcesAnalyze; runtimeInfo?: RuntimeInfoAnalyze; instrumentationConfig: InstrumentationConfigAnalyze; diff --git a/k8sutils/pkg/describe/source.go b/k8sutils/pkg/describe/source.go index d98275564b..e37aa40104 100644 --- a/k8sutils/pkg/describe/source.go +++ b/k8sutils/pkg/describe/source.go @@ -9,6 +9,7 @@ import ( "k8s.io/client-go/kubernetes" odigosclientset "github.com/odigos-io/odigos/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1" + "github.com/odigos-io/odigos/api/k8sconsts" "github.com/odigos-io/odigos/k8sutils/pkg/describe/source" ) @@ -18,10 +19,10 @@ func printWorkloadManifestInfo(analyze *source.SourceAnalyze, sb *strings.Builde printProperty(sb, 0, &analyze.Namespace) sb.WriteString("Labels:\n") - printProperty(sb, 1, &analyze.Labels.Instrumented) - printProperty(sb, 1, analyze.Labels.Workload) - printProperty(sb, 1, analyze.Labels.Namespace) - printProperty(sb, 1, &analyze.Labels.InstrumentedText) + printProperty(sb, 1, &analyze.SourceObjectsAnalysis.Instrumented) + printProperty(sb, 1, analyze.SourceObjectsAnalysis.Workload) + printProperty(sb, 1, analyze.SourceObjectsAnalysis.Namespace) + printProperty(sb, 1, &analyze.SourceObjectsAnalysis.InstrumentedText) } func printRuntimeDetails(analyze *source.SourceAnalyze, sb *strings.Builder) { @@ -150,7 +151,7 @@ func DescribeDeployment(ctx context.Context, kubeClient kubernetes.Interface, od return nil, err } workloadObj := &source.K8sSourceObject{ - Kind: "deployment", + Kind: k8sconsts.WorkloadKindDeployment, ObjectMeta: deployment.ObjectMeta, PodTemplateSpec: &deployment.Spec.Template, LabelSelector: deployment.Spec.Selector, @@ -165,7 +166,7 @@ func DescribeDaemonSet(ctx context.Context, kubeClient kubernetes.Interface, odi return nil, err } workloadObj := &source.K8sSourceObject{ - Kind: "daemonset", + Kind: k8sconsts.WorkloadKindDaemonSet, ObjectMeta: ds.ObjectMeta, PodTemplateSpec: &ds.Spec.Template, LabelSelector: ds.Spec.Selector, @@ -180,7 +181,7 @@ func DescribeStatefulSet(ctx context.Context, kubeClient kubernetes.Interface, o return nil, err } workloadObj := &source.K8sSourceObject{ - Kind: "statefulset", + Kind: k8sconsts.WorkloadKindStatefulSet, ObjectMeta: ss.ObjectMeta, PodTemplateSpec: &ss.Spec.Template, LabelSelector: ss.Spec.Selector, diff --git a/k8sutils/pkg/describe/source/analyze.go b/k8sutils/pkg/describe/source/analyze.go index 9cccee39e6..fda042535e 100644 --- a/k8sutils/pkg/describe/source/analyze.go +++ b/k8sutils/pkg/describe/source/analyze.go @@ -10,12 +10,11 @@ import ( odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/common" - "github.com/odigos-io/odigos/common/consts" "github.com/odigos-io/odigos/k8sutils/pkg/describe/properties" "github.com/odigos-io/odigos/k8sutils/pkg/envoverwrite" ) -type InstrumentationLabelsAnalyze struct { +type InstrumentationSourcesAnalyze struct { Instrumented properties.EntityProperty `json:"instrumented"` Workload *properties.EntityProperty `json:"workload"` Namespace *properties.EntityProperty `json:"namespace"` @@ -73,10 +72,10 @@ type PodAnalyze struct { } type SourceAnalyze struct { - Name properties.EntityProperty `json:"name"` - Kind properties.EntityProperty `json:"kind"` - Namespace properties.EntityProperty `json:"namespace"` - Labels InstrumentationLabelsAnalyze `json:"labels"` + Name properties.EntityProperty `json:"name"` + Kind properties.EntityProperty `json:"kind"` + Namespace properties.EntityProperty `json:"namespace"` + SourceObjectsAnalysis InstrumentationSourcesAnalyze `json:"sourceObjects"` RuntimeInfo *RuntimeInfoAnalyze `json:"runtimeInfo"` InstrumentationConfig InstrumentationConfigAnalyze `json:"instrumentationConfig"` @@ -88,54 +87,50 @@ type SourceAnalyze struct { } // Deprecated: Sources are used to mark workloads for instrumentation. -func analyzeInstrumentationLabels(resource *OdigosSourceResources, workloadObj *K8sSourceObject) (InstrumentationLabelsAnalyze, bool) { - workloadLabel, workloadFound := workloadObj.GetLabels()[consts.OdigosInstrumentationLabel] - nsLabel, nsFound := resource.Namespace.GetLabels()[consts.OdigosInstrumentationLabel] +func analyzeInstrumentationBySources(sources *odigosv1.WorkloadSources) (InstrumentationSourcesAnalyze, bool) { + workloadSource := sources.Workload + nsSource := sources.Namespace workload := &properties.EntityProperty{Name: "Workload", Value: "unset", - Explain: "the value of the odigos-instrumentation label on the workload object in k8s"} - if workloadFound { - workload.Value = fmt.Sprintf("%s=%s", consts.OdigosInstrumentationLabel, workloadLabel) + Explain: "existence of workload specific Source object in k8s"} + if sources.Workload != nil && !sources.Workload.Spec.DisableInstrumentation { + workload.Value = "instrumented" } ns := &properties.EntityProperty{Name: "Namespace", Value: "unset", - Explain: "the value of the odigos-instrumentation label on the namespace object in k8s"} - if nsFound { - ns.Value = fmt.Sprintf("%s=%s", consts.OdigosInstrumentationLabel, nsLabel) + Explain: "existence of namespace Source for this workload in k8s"} + if sources.Namespace != nil && !sources.Namespace.Spec.DisableInstrumentation { + ns.Value = "instrumented" } var instrumented bool var decisionText string - if workloadFound { - instrumented = workloadLabel == consts.InstrumentationEnabled + if workloadSource != nil { + instrumented = !workloadSource.Spec.DisableInstrumentation if instrumented { - decisionText = "Workload is instrumented because the " + workloadObj.Kind + " contains the label '" + - consts.OdigosInstrumentationLabel + "=" + workloadLabel + "'" + decisionText = "Workload is instrumented because the workload source is present and enabled" } else { - decisionText = "Workload is NOT instrumented because the " + workloadObj.Kind + " contains the label '" + - consts.OdigosInstrumentationLabel + "=" + workloadLabel + "'" + decisionText = "Workload is NOT instrumented because the workload source is present and disabled" } } else { - instrumented = nsLabel == consts.InstrumentationEnabled - if instrumented { - decisionText = "Workload is instrumented because the " + workloadObj.Kind + - " is not labeled, and the namespace is labeled with '" + consts.OdigosInstrumentationLabel + "=" + nsLabel + "'" - } else { - if nsFound { - decisionText = "Workload is NOT instrumented because the " + workloadObj.Kind + - " is not labeled, and the namespace is labeled with '" + consts.OdigosInstrumentationLabel + "=" + nsLabel + "'" + if nsSource != nil { + instrumented = !nsSource.Spec.DisableInstrumentation + if instrumented { + decisionText = "Workload is instrumented because the workload source is not present, but the namespace source is present and enabled" } else { - decisionText = "Workload is NOT instrumented because neither the workload nor the namespace has the '" + - consts.OdigosInstrumentationLabel + "' label set" + decisionText = "Workload is NOT instrumented because the workload source is not present, but the namespace source is present and disabled" } + } else { + instrumented = false + decisionText = "Workload is NOT instrumented because neither the workload source nor the namespace source are present" } } instrumentedProperty := properties.EntityProperty{ Name: "Instrumented", Value: instrumented, - Explain: "whether this workload is considered for instrumentation based on the presence of the odigos-instrumentation label", + Explain: "whether this workload is considered for instrumentation based on the presence of the Source objects", } decisionTextProperty := properties.EntityProperty{ Name: "DecisionText", @@ -143,7 +138,7 @@ func analyzeInstrumentationLabels(resource *OdigosSourceResources, workloadObj * Explain: "a human readable explanation of the decision to instrument or not instrument this workload", } - return InstrumentationLabelsAnalyze{ + return InstrumentationSourcesAnalyze{ Instrumented: instrumentedProperty, Workload: workload, Namespace: ns, @@ -158,7 +153,7 @@ func analyzeInstrumentationConfig(resources *OdigosSourceResources, instrumented Name: "Created", Value: properties.GetTextCreated(instrumentationConfigCreated), Status: properties.GetSuccessOrTransitioning(instrumentationConfigCreated == instrumented), - Explain: "whether the instrumentation config object exists in the cluster. When a workload is labeled for instrumentation," + + Explain: "whether the instrumentation config object exists in the cluster. When a Source object is created," + " an instrumentation config object is created", } @@ -519,7 +514,7 @@ func analyzePods(resources *OdigosSourceResources, expectedDevices Instrumentati } func AnalyzeSource(resources *OdigosSourceResources, workloadObj *K8sSourceObject) *SourceAnalyze { - labelsAnalysis, instrumented := analyzeInstrumentationLabels(resources, workloadObj) + sourcesAnalysis, instrumented := analyzeInstrumentationBySources(resources.Sources) runtimeAnalysis := analyzeRuntimeInfo(resources) icAnalysis := analyzeInstrumentationConfig(resources, instrumented) device := analyzeInstrumentationDevice(resources, workloadObj, instrumented) @@ -532,7 +527,7 @@ func AnalyzeSource(resources *OdigosSourceResources, workloadObj *K8sSourceObjec Explain: "the kind of the k8s workload object that this source describes (deployment/daemonset/statefulset)"}, Namespace: properties.EntityProperty{Name: "Namespace", Value: workloadObj.GetNamespace(), Explain: "the namespace of the k8s workload object that this source describes"}, - Labels: labelsAnalysis, + SourceObjectsAnalysis: sourcesAnalysis, RuntimeInfo: runtimeAnalysis, InstrumentationConfig: icAnalysis, diff --git a/k8sutils/pkg/describe/source/resources.go b/k8sutils/pkg/describe/source/resources.go index 43f9383069..3fd19b2460 100644 --- a/k8sutils/pkg/describe/source/resources.go +++ b/k8sutils/pkg/describe/source/resources.go @@ -11,12 +11,14 @@ import ( "k8s.io/client-go/kubernetes" odigosclientset "github.com/odigos-io/odigos/api/generated/odigos/clientset/versioned/typed/odigos/v1alpha1" + "github.com/odigos-io/odigos/api/k8sconsts" odigosv1 "github.com/odigos-io/odigos/api/odigos/v1alpha1" "github.com/odigos-io/odigos/k8sutils/pkg/workload" ) type OdigosSourceResources struct { Namespace *corev1.Namespace + Sources *odigosv1.WorkloadSources InstrumentationConfig *odigosv1.InstrumentationConfig InstrumentationInstances *odigosv1.InstrumentationInstanceList Pods *corev1.PodList @@ -26,6 +28,12 @@ func GetRelevantSourceResources(ctx context.Context, kubeClient kubernetes.Inter workloadObj *K8sSourceObject) (*OdigosSourceResources, error) { sourceResources := OdigosSourceResources{} + sources, err := getSources(ctx, odigosClient, workloadObj) + if err != nil { + return nil, err + } + sourceResources.Sources = sources + workloadNs := workloadObj.GetNamespace() ns, err := kubeClient.CoreV1().Namespaces().Get(ctx, workloadNs, metav1.GetOptions{}) if err == nil { @@ -104,3 +112,55 @@ func getSourcePods(ctx context.Context, kubeClient kubernetes.Interface, workloa return pods, nil } } + +// this function is based on the GetSources function in api/odigos/v1alpha1/source_types.go +// the reason for this duplication is the different clients used. +func getSources(ctx context.Context, sourcesClient odigosclientset.SourcesGetter, obj *K8sSourceObject) (*odigosv1.WorkloadSources, error) { + if obj == nil { + return nil, fmt.Errorf("workload object is nil") + } + + var err error + workloadSources := &odigosv1.WorkloadSources{} + + namespace := obj.GetNamespace() + if namespace == "" && obj.Kind == k8sconsts.WorkloadKindNamespace { + namespace = obj.GetName() + } + + if obj.Kind != k8sconsts.WorkloadKindNamespace { + selector := labels.SelectorFromSet(labels.Set{ + k8sconsts.WorkloadNameLabel: obj.GetName(), + k8sconsts.WorkloadNamespaceLabel: namespace, + k8sconsts.WorkloadKindLabel: string(obj.Kind), + }) + sourceList, err := sourcesClient.Sources(namespace).List(ctx, metav1.ListOptions{LabelSelector: selector.String()}) + if err != nil { + return nil, err + } + if len(sourceList.Items) > 1 { + return nil, odigosv1.ErrorTooManySources + } + if len(sourceList.Items) == 1 { + workloadSources.Workload = &sourceList.Items[0] + } + } + + namespaceSelector := labels.SelectorFromSet(labels.Set{ + k8sconsts.WorkloadNameLabel: namespace, + k8sconsts.WorkloadNamespaceLabel: namespace, + k8sconsts.WorkloadKindLabel: string(k8sconsts.WorkloadKindNamespace), + }) + namespaceSourceList, err := sourcesClient.Sources(namespace).List(ctx, metav1.ListOptions{LabelSelector: namespaceSelector.String()}) + if err != nil { + return nil, err + } + if len(namespaceSourceList.Items) > 1 { + return nil, odigosv1.ErrorTooManySources + } + if len(namespaceSourceList.Items) == 1 { + workloadSources.Namespace = &namespaceSourceList.Items[0] + } + + return workloadSources, nil +} diff --git a/k8sutils/pkg/describe/source/source.go b/k8sutils/pkg/describe/source/source.go index db011a4224..8b8c601e58 100644 --- a/k8sutils/pkg/describe/source/source.go +++ b/k8sutils/pkg/describe/source/source.go @@ -3,11 +3,13 @@ package source import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + + "github.com/odigos-io/odigos/api/k8sconsts" ) type K8sSourceObject struct { metav1.ObjectMeta - Kind string + Kind k8sconsts.WorkloadKind PodTemplateSpec *corev1.PodTemplateSpec LabelSelector *metav1.LabelSelector }