diff --git a/controllers/monitor/oteld_controller_test.go b/controllers/monitor/oteld_controller_test.go index 2e0a4135bf5..66df29f7dbc 100644 --- a/controllers/monitor/oteld_controller_test.go +++ b/controllers/monitor/oteld_controller_test.go @@ -42,7 +42,7 @@ const ( mysqlCompName = "mysql" ) -var _ = Describe("Oteld Monitor Controller", func() { +var _ = Describe("OTeld Monitor Controller", func() { const ( clusterDefName = "test-clusterdef" diff --git a/controllers/monitor/reconcile/deployment.go b/controllers/monitor/reconcile/deployment.go index 6a9d56c5d62..00c5f856020 100644 --- a/controllers/monitor/reconcile/deployment.go +++ b/controllers/monitor/reconcile/deployment.go @@ -77,7 +77,7 @@ func Deployment(reqCtx monitortypes.ReconcileCtx, params monitortypes.OTeldParam } func buildDeploymentForOteld(instance *monitortypes.OteldInstance, namespace, name string) *appsv1.Deployment { - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil } @@ -93,7 +93,7 @@ func buildDeploymentForOteld(instance *monitortypes.OteldInstance, namespace, na MatchLabels: commonLabels, } - template := instance.Oteld + template := instance.OTeld podTemplate := corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: commonLabels, diff --git a/controllers/monitor/reconcile/oteld.go b/controllers/monitor/reconcile/oteld.go index f1388b350b5..2acb1f88480 100644 --- a/controllers/monitor/reconcile/oteld.go +++ b/controllers/monitor/reconcile/oteld.go @@ -54,7 +54,7 @@ func OTeld(reqCtx monitortype.ReconcileCtx, params monitortype.OTeldParams) erro return err } - instanceMap, err := BuildInstanceMapForPipline(userDateSources, metricsExporters, logsExporters, reqCtx.OTeld, params.Client, reqCtx.Ctx) + instanceMap, err := BuildInstanceMapForPipeline(userDateSources, metricsExporters, logsExporters, reqCtx.OTeld, params.Client, reqCtx.Ctx) if err != nil { return err } @@ -63,7 +63,7 @@ func OTeld(reqCtx monitortype.ReconcileCtx, params monitortype.OTeldParams) erro return nil } -func BuildInstanceMapForPipline(appDatasources *v1alpha1.CollectorDataSourceList, +func BuildInstanceMapForPipeline(appDatasources *v1alpha1.CollectorDataSourceList, metricsExporters *v1alpha1.MetricsExporterSinkList, logsExporters *v1alpha1.LogsExporterSinkList, oteld *v1alpha1.OTeld, @@ -98,6 +98,6 @@ func buildSystemInstanceMap(oteld *v1alpha1.OTeld, buildNodePipeline(). buildPodLogsPipeline(). appendUserDataSource(). - buildFixedPipline(). + buildFixedPipeline(). complete() } diff --git a/controllers/monitor/reconcile/oteld_agent.go b/controllers/monitor/reconcile/oteld_agent.go index 3776498ee04..e2b4ad54cf6 100644 --- a/controllers/monitor/reconcile/oteld_agent.go +++ b/controllers/monitor/reconcile/oteld_agent.go @@ -85,7 +85,7 @@ func buildDaemonSetForOteld(instance *types.OteldInstance, namespace string, nam MatchLabels: commonLabels, } - template := instance.Oteld + template := instance.OTeld podTemplate := corev1.PodTemplateSpec{ ObjectMeta: metav1.ObjectMeta{ Labels: commonLabels, diff --git a/controllers/monitor/reconcile/oteld_helper.go b/controllers/monitor/reconcile/oteld_helper.go index 14fb6b84189..aa12c421cea 100644 --- a/controllers/monitor/reconcile/oteld_helper.go +++ b/controllers/monitor/reconcile/oteld_helper.go @@ -115,20 +115,20 @@ func (w *oteldWrapper) buildPodLogsPipeline() *oteldWrapper { return w } -func (w *oteldWrapper) createPipeline(mode v1alpha1.Mode, name string, collectType collectType) *types.Pipline { +func (w *oteldWrapper) createPipeline(mode v1alpha1.Mode, name string, collectType collectType) *types.Pipeline { var instance *types.OteldInstance if instance = w.instanceMap[mode]; instance == nil { instance = types.NewOteldInstance(w.OTeld, w.cli, w.ctx) w.instanceMap[mode] = instance } - if instance.MetricsPipline == nil { - instance.MetricsPipline = []types.Pipline{} + if instance.MetricsPipeline == nil { + instance.MetricsPipeline = []types.Pipeline{} } return foundOrCreatePipeline(instance, name, collectType) } -func (w *oteldWrapper) buildProcessor(pipeline *types.Pipline) { +func (w *oteldWrapper) buildProcessor(pipeline *types.Pipeline) { if w.Spec.Batch.Enabled { pipeline.ProcessorMap[types.BatchProcessorName] = true } @@ -137,7 +137,7 @@ func (w *oteldWrapper) buildProcessor(pipeline *types.Pipline) { } } -func (w *oteldWrapper) buildMetricsExporter(pipeline *types.Pipline) { +func (w *oteldWrapper) buildMetricsExporter(pipeline *types.Pipeline) { for _, exporter := range w.metricsExporters.Items { if exporter.Name == w.source.MetricsExporterRef { pipeline.ExporterMap[fmt.Sprintf(ExporterNamePattern, exporter.Spec.Type, exporter.Name)] = true @@ -147,7 +147,7 @@ func (w *oteldWrapper) buildMetricsExporter(pipeline *types.Pipline) { w.errs = append(w.errs, cfgcore.MakeError("the metrics exporter[%s] relied on by %s was not found.", w.source.MetricsExporterRef, pipeline.Name)) } -func (w *oteldWrapper) buildLogsExporter(pipeline *types.Pipline) { +func (w *oteldWrapper) buildLogsExporter(pipeline *types.Pipeline) { for _, exporter := range w.logsExporters.Items { if exporter.Name == w.source.LogsExporterRef { pipeline.ExporterMap[fmt.Sprintf(ExporterNamePattern, exporter.Spec.Type, exporter.Name)] = true @@ -157,13 +157,13 @@ func (w *oteldWrapper) buildLogsExporter(pipeline *types.Pipline) { w.errs = append(w.errs, cfgcore.MakeError("the logs exporter[%s] relied on by %s was not found.", w.source.LogsExporterRef, pipeline.Name)) } -func (w *oteldWrapper) appendAllMetricsExporter(pipeline *types.Pipline) { +func (w *oteldWrapper) appendAllMetricsExporter(pipeline *types.Pipeline) { for _, exporter := range w.metricsExporters.Items { pipeline.ExporterMap[fmt.Sprintf(ExporterNamePattern, exporter.Spec.Type, exporter.Name)] = true } } -func (w *oteldWrapper) appendAllLogsExporter(pipeline *types.Pipline) { +func (w *oteldWrapper) appendAllLogsExporter(pipeline *types.Pipeline) { for _, exporter := range w.logsExporters.Items { pipeline.ExporterMap[fmt.Sprintf(ExporterNamePattern, exporter.Spec.Type, exporter.Name)] = true } @@ -182,17 +182,17 @@ func (w *oteldWrapper) appendUserDataSource() *oteldWrapper { return w } -func (w *oteldWrapper) buildFixedPipline() *oteldWrapper { +func (w *oteldWrapper) buildFixedPipeline() *oteldWrapper { for _, instance := range w.instanceMap { - logsPipline := types.NewPipeline(LogsCreatorName) - w.buildProcessor(&logsPipline) - w.appendAllLogsExporter(&logsPipline) - instance.AppLogsPipline = &logsPipline + logsPipeline := types.NewPipeline(LogsCreatorName) + w.buildProcessor(&logsPipeline) + w.appendAllLogsExporter(&logsPipeline) + instance.AppLogsPipeline = &logsPipeline - metricsPipline := types.NewPipeline(AppMetricsCreatorName) - w.buildProcessor(&metricsPipline) - w.appendAllMetricsExporter(&metricsPipline) - instance.AppMetricsPiplien = &metricsPipline + metricsPipeline := types.NewPipeline(AppMetricsCreatorName) + w.buildProcessor(&metricsPipeline) + w.appendAllMetricsExporter(&metricsPipeline) + instance.AppMetricsPipelien = &metricsPipeline } return w } @@ -201,8 +201,8 @@ func (w *oteldWrapper) complete() error { return errors.Join(w.errs...) } -func foundOrCreatePipeline(instance *types.OteldInstance, name string, collectType collectType) *types.Pipline { - foundPipeline := func(pipelines []types.Pipline) *types.Pipline { +func foundOrCreatePipeline(instance *types.OteldInstance, name string, collectType collectType) *types.Pipeline { + foundPipeline := func(pipelines []types.Pipeline) *types.Pipeline { for i := range pipelines { pipeline := &pipelines[i] if pipeline.Name == name { @@ -211,7 +211,7 @@ func foundOrCreatePipeline(instance *types.OteldInstance, name string, collectTy } return nil } - checkAndCreate := func(pipeline []types.Pipline, update func(pipeline types.Pipline) *types.Pipline) *types.Pipline { + checkAndCreate := func(pipeline []types.Pipeline, update func(pipeline types.Pipeline) *types.Pipeline) *types.Pipeline { if p := foundPipeline(pipeline); p != nil { return p } @@ -221,14 +221,14 @@ func foundOrCreatePipeline(instance *types.OteldInstance, name string, collectTy switch collectType { case collectTypeMetrics: - return checkAndCreate(instance.MetricsPipline, func(pipeline types.Pipline) *types.Pipline { - instance.MetricsPipline = append(instance.MetricsPipline, pipeline) - return &instance.MetricsPipline[len(instance.MetricsPipline)-1] + return checkAndCreate(instance.MetricsPipeline, func(pipeline types.Pipeline) *types.Pipeline { + instance.MetricsPipeline = append(instance.MetricsPipeline, pipeline) + return &instance.MetricsPipeline[len(instance.MetricsPipeline)-1] }) case collectTypeLogs: - return checkAndCreate(instance.LogPipline, func(pipeline types.Pipline) *types.Pipline { - instance.LogPipline = append(instance.LogPipline, pipeline) - return &instance.LogPipline[len(instance.LogPipline)-1] + return checkAndCreate(instance.LogPipeline, func(pipeline types.Pipeline) *types.Pipeline { + instance.LogPipeline = append(instance.LogPipeline, pipeline) + return &instance.LogPipeline[len(instance.LogPipeline)-1] }) default: return nil diff --git a/controllers/monitor/reconcile/oteld_test.go b/controllers/monitor/reconcile/oteld_test.go index 30edca642ce..c79f0827fbb 100644 --- a/controllers/monitor/reconcile/oteld_test.go +++ b/controllers/monitor/reconcile/oteld_test.go @@ -34,7 +34,7 @@ var _ = Describe("monitor_controller", func() { BeforeEach(func() { instance = &types.OteldInstance{ - Oteld: &appsv1alpha1.OTeld{}, + OTeld: &appsv1alpha1.OTeld{}, } }) diff --git a/controllers/monitor/reconcile/service.go b/controllers/monitor/reconcile/service.go index 1034a78c5e9..80fced010b7 100644 --- a/controllers/monitor/reconcile/service.go +++ b/controllers/monitor/reconcile/service.go @@ -38,10 +38,10 @@ func Service(reqCtx types.ReconcileCtx, params types.OTeldParams) error { desired := make([]*corev1.Service, 0) if daemon := reqCtx.OteldCfgRef.GetOteldInstance(monitorv1alpha1.ModeDaemonSet); daemon != nil { - desired = append(desired, buildSvcForOtel(daemon.Oteld, reqCtx.OTeld.Namespace, monitorv1alpha1.ModeDaemonSet)) + desired = append(desired, buildSvcForOtel(daemon.OTeld, reqCtx.OTeld.Namespace, monitorv1alpha1.ModeDaemonSet)) } if deploy := reqCtx.OteldCfgRef.GetOteldInstance(monitorv1alpha1.ModeDeployment); deploy != nil { - desired = append(desired, buildSvcForOtel(deploy.Oteld, reqCtx.OTeld.Namespace, monitorv1alpha1.ModeDeployment)) + desired = append(desired, buildSvcForOtel(deploy.OTeld, reqCtx.OTeld.Namespace, monitorv1alpha1.ModeDeployment)) } return expectedService(reqCtx, params, desired) } diff --git a/controllers/monitor/reconcile/utils.go b/controllers/monitor/reconcile/utils.go index 3f12d08557f..fb8a30f7f83 100644 --- a/controllers/monitor/reconcile/utils.go +++ b/controllers/monitor/reconcile/utils.go @@ -254,7 +254,7 @@ func buildSvcForOtel(oteld *v1alpha1.OTeld, namespace string, mode v1alpha1.Mode } func buildConfigMapForOteld(instance *types.OteldInstance, namespace string, exporters *types.Exporters, mode v1alpha1.Mode, gc *types.OteldConfigGenerater) (*corev1.ConfigMap, error) { - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil, nil } @@ -278,12 +278,12 @@ func buildConfigMapForOteld(instance *types.OteldInstance, namespace string, exp return builder.NewConfigMapBuilder(namespace, name). SetData(map[string]string{"config.yaml": string(marshal)}). AddLabelsInMap(commonLabels). - SetOwnerReferences(instance.Oteld.APIVersion, instance.Oteld.Kind, instance.Oteld). + SetOwnerReferences(instance.OTeld.APIVersion, instance.OTeld.Kind, instance.OTeld). GetObject(), nil } func buildEngineConfigForOteld(instance *types.OteldInstance, namespace string, mode v1alpha1.Mode, gc *types.OteldConfigGenerater) (*corev1.ConfigMap, error) { - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil, nil } @@ -304,12 +304,12 @@ func buildEngineConfigForOteld(instance *types.OteldInstance, namespace string, return builder.NewConfigMapBuilder(namespace, name). SetData(map[string]string{"kb_engine.yaml": string(marshal)}). AddLabelsInMap(commonLabels). - SetOwnerReferences(instance.Oteld.APIVersion, instance.Oteld.Kind, instance.Oteld). + SetOwnerReferences(instance.OTeld.APIVersion, instance.OTeld.Kind, instance.OTeld). GetObject(), nil } func buildSecretForOteld(instance *types.OteldInstance, namespace string, exporters *types.Exporters, mode v1alpha1.Mode, gc *types.OteldConfigGenerater) (*corev1.Secret, error) { - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil, nil } @@ -330,12 +330,12 @@ func buildSecretForOteld(instance *types.OteldInstance, namespace string, export return builder.NewSecretBuilder(namespace, name). PutData("config.yaml", marshal). AddLabelsInMap(commonLabels). - SetOwnerReferences(instance.Oteld.APIVersion, instance.Oteld.Kind, instance.Oteld). + SetOwnerReferences(instance.OTeld.APIVersion, instance.OTeld.Kind, instance.OTeld). GetObject(), nil } func buildEngineSecretForOteld(instance *types.OteldInstance, namespace string, mode v1alpha1.Mode, gc *types.OteldConfigGenerater) (*corev1.Secret, error) { - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil, nil } @@ -356,6 +356,6 @@ func buildEngineSecretForOteld(instance *types.OteldInstance, namespace string, return builder.NewSecretBuilder(namespace, name). PutData("kb_engine.yaml", marshal). AddLabelsInMap(commonLabels). - SetOwnerReferences(instance.Oteld.APIVersion, instance.Oteld.Kind, instance.Oteld). + SetOwnerReferences(instance.OTeld.APIVersion, instance.OTeld.Kind, instance.OTeld). GetObject(), nil } diff --git a/controllers/monitor/types/otel_config.go b/controllers/monitor/types/otel_config.go index 2977156cbc9..910d1e55ad7 100644 --- a/controllers/monitor/types/otel_config.go +++ b/controllers/monitor/types/otel_config.go @@ -68,7 +68,7 @@ func (cg *OteldConfigGenerater) GenerateOteldConfiguration(instance *OteldInstan var err error var cfg = yaml.MapSlice{} - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil, nil } if cg.cache != nil && cg.cache[mode] != nil { @@ -112,8 +112,8 @@ func (cg *OteldConfigGenerater) appendReceiver(cfg yaml.MapSlice, instance *Otel func newSystemLogSlice(instance *OteldInstance) (yaml.MapSlice, error) { systemLogSlice := yaml.MapSlice{} - for _, pipline := range instance.LogPipline { - for name, receiver := range pipline.ReceiverMap { + for _, pipeline := range instance.LogPipeline { + for name, receiver := range pipeline.ReceiverMap { valMap := map[string]any{} if err := yaml.Unmarshal([]byte(receiver.Parameter), &valMap); err != nil { return nil, err @@ -131,8 +131,8 @@ func newSystemLogSlice(instance *OteldInstance) (yaml.MapSlice, error) { func newReceiverCreatorSlice(instance *OteldInstance) (yaml.MapSlice, error) { creators := yaml.MapSlice{} - for _, pipline := range instance.MetricsPipline { - creator, err := newMetricsReceiverCreator(pipline.Name, pipline.ReceiverMap) + for _, pipeline := range instance.MetricsPipeline { + creator, err := newMetricsReceiverCreator(pipeline.Name, pipeline.ReceiverMap) if err != nil { return nil, err } @@ -255,7 +255,7 @@ func (cg *OteldConfigGenerater) appendProcessor(cfg yaml.MapSlice) (yaml.MapSlic func (cg *OteldConfigGenerater) appendServices(cfg yaml.MapSlice, instance *OteldInstance) (yaml.MapSlice, error) { serviceSlice := yaml.MapSlice{} - piplneItem := cg.buildPiplineItem(instance) + piplneItem := cg.buildPipelineItem(instance) serviceSlice = append(serviceSlice, piplneItem) valmap := buildServiceValMap(instance) extensionSlice, err := buildSliceFromCUE(ServicePath, valmap) @@ -268,117 +268,117 @@ func (cg *OteldConfigGenerater) appendServices(cfg yaml.MapSlice, instance *Otel func buildServiceValMap(instance *OteldInstance) map[string]any { valMap := map[string]any{} - if instance.Oteld.Spec.LogsLevel != "" { - valMap["log_level"] = instance.Oteld.Spec.LogsLevel + if instance.OTeld.Spec.LogsLevel != "" { + valMap["log_level"] = instance.OTeld.Spec.LogsLevel } - if instance.Oteld.Spec.MetricsPort != 0 { - valMap["metrics_port"] = instance.Oteld.Spec.MetricsPort + if instance.OTeld.Spec.MetricsPort != 0 { + valMap["metrics_port"] = instance.OTeld.Spec.MetricsPort } return valMap } -func (cg *OteldConfigGenerater) buildPiplineItem(instance *OteldInstance) yaml.MapItem { +func (cg *OteldConfigGenerater) buildPipelineItem(instance *OteldInstance) yaml.MapItem { - pipline := yaml.MapSlice{} + pipeline := yaml.MapSlice{} - if len(instance.MetricsPipline) != 0 { + if len(instance.MetricsPipeline) != 0 { metricsSlice := yaml.MapSlice{} - for _, mPipline := range instance.MetricsPipline { + for _, mPipeline := range instance.MetricsPipeline { receiverSlice := []string{} - receiverSlice = append(receiverSlice, fmt.Sprintf(ReceiverNamePattern, mPipline.Name)) + receiverSlice = append(receiverSlice, fmt.Sprintf(ReceiverNamePattern, mPipeline.Name)) metricsSlice = append(metricsSlice, yaml.MapItem{Key: "receivers", Value: receiverSlice}) processorSlice := []string{} - for name := range mPipline.ProcessorMap { + for name := range mPipeline.ProcessorMap { processorSlice = append(processorSlice, name) } metricsSlice = append(metricsSlice, yaml.MapItem{Key: "processors", Value: processorSlice}) exporterSlice := []string{} - for name := range mPipline.ExporterMap { + for name := range mPipeline.ExporterMap { exporterSlice = append(exporterSlice, name) } metricsSlice = append(metricsSlice, yaml.MapItem{Key: "exporters", Value: exporterSlice}) if len(metricsSlice) > 0 { - pipline = append(pipline, yaml.MapItem{Key: fmt.Sprintf(MetricsPattern, mPipline.Name), Value: metricsSlice}) + pipeline = append(pipeline, yaml.MapItem{Key: fmt.Sprintf(MetricsPattern, mPipeline.Name), Value: metricsSlice}) } } } - if len(instance.LogPipline) != 0 { + if len(instance.LogPipeline) != 0 { logsSlice := yaml.MapSlice{} - for _, lPipline := range instance.LogPipline { + for _, lPipeline := range instance.LogPipeline { receiverSlice := []string{} - for receiverName := range lPipline.ReceiverMap { + for receiverName := range lPipeline.ReceiverMap { receiverSlice = append(receiverSlice, fmt.Sprintf("filelog/%s", receiverName)) } logsSlice = append(logsSlice, yaml.MapItem{Key: "receivers", Value: receiverSlice}) processorSlice := []string{} - for name := range lPipline.ProcessorMap { + for name := range lPipeline.ProcessorMap { processorSlice = append(processorSlice, name) } logsSlice = append(logsSlice, yaml.MapItem{Key: "processors", Value: processorSlice}) exporterSlice := []string{} - for name := range lPipline.ExporterMap { + for name := range lPipeline.ExporterMap { exporterSlice = append(exporterSlice, name) } logsSlice = append(logsSlice, yaml.MapItem{Key: "exporters", Value: exporterSlice}) if len(logsSlice) > 0 { - pipline = append(pipline, yaml.MapItem{Key: fmt.Sprintf(LogsPattern, lPipline.Name), Value: logsSlice}) + pipeline = append(pipeline, yaml.MapItem{Key: fmt.Sprintf(LogsPattern, lPipeline.Name), Value: logsSlice}) } } } - if instance.AppMetricsPiplien.Name != "" { - metricsPipline := instance.AppMetricsPiplien + if instance.AppMetricsPipelien.Name != "" { + metricsPipeline := instance.AppMetricsPipelien metricsSlice := yaml.MapSlice{} var receiverSlice []string - receiverSlice = append(receiverSlice, metricsPipline.Name) + receiverSlice = append(receiverSlice, metricsPipeline.Name) metricsSlice = append(metricsSlice, yaml.MapItem{Key: "receivers", Value: receiverSlice}) processorSlice := []string{} - for name := range metricsPipline.ProcessorMap { + for name := range metricsPipeline.ProcessorMap { processorSlice = append(processorSlice, name) } metricsSlice = append(metricsSlice, yaml.MapItem{Key: "processors", Value: processorSlice}) var exporterSlice []string - for exporter := range metricsPipline.ExporterMap { + for exporter := range metricsPipeline.ExporterMap { exporterSlice = append(exporterSlice, exporter) } metricsSlice = append(metricsSlice, yaml.MapItem{Key: "exporters", Value: exporterSlice}) - pipline = append(pipline, yaml.MapItem{Key: "metrics/app", Value: metricsSlice}) + pipeline = append(pipeline, yaml.MapItem{Key: "metrics/app", Value: metricsSlice}) } - if instance.AppLogsPipline.Name != "" { - logPipline := instance.AppLogsPipline + if instance.AppLogsPipeline.Name != "" { + logPipeline := instance.AppLogsPipeline logsSlice := yaml.MapSlice{} var receiverSlice []string - receiverSlice = append(receiverSlice, logPipline.Name) + receiverSlice = append(receiverSlice, logPipeline.Name) logsSlice = append(logsSlice, yaml.MapItem{Key: "receivers", Value: receiverSlice}) processorSlice := []string{} - for name := range logPipline.ProcessorMap { + for name := range logPipeline.ProcessorMap { processorSlice = append(processorSlice, name) } logsSlice = append(logsSlice, yaml.MapItem{Key: "processors", Value: processorSlice}) var exporterSlice []string - for exporter := range logPipline.ExporterMap { + for exporter := range logPipeline.ExporterMap { exporterSlice = append(exporterSlice, exporter) } logsSlice = append(logsSlice, yaml.MapItem{Key: "exporters", Value: exporterSlice}) if len(logsSlice) > 0 { - pipline = append(pipline, yaml.MapItem{Key: "logs", Value: logsSlice}) + pipeline = append(pipeline, yaml.MapItem{Key: "logs", Value: logsSlice}) } } - return yaml.MapItem{Key: "pipelines", Value: pipline} + return yaml.MapItem{Key: "pipelines", Value: pipeline} } func (cg *OteldConfigGenerater) appendExtentions(cfg yaml.MapSlice) (yaml.MapSlice, error) { @@ -409,7 +409,7 @@ func (cg *OteldConfigGenerater) GenerateEngineConfiguration(instance *OteldInsta var valMap map[string]any var cfg = yaml.MapSlice{} - if instance == nil || instance.Oteld == nil { + if instance == nil || instance.OTeld == nil { return nil, nil } if cg.engineCache != nil && cg.engineCache[mode] != nil { @@ -454,6 +454,6 @@ func (cg *OteldConfigGenerater) GenerateEngineConfiguration(instance *OteldInsta func buildEngineInfraValMap(instance *OteldInstance) map[string]any { return map[string]any{ - "collection_interval": instance.Oteld.Spec.CollectionInterval, + "collection_interval": instance.OTeld.Spec.CollectionInterval, } } diff --git a/controllers/monitor/types/otel_config_test.go b/controllers/monitor/types/otel_config_test.go index 8f2fe916267..74466007494 100644 --- a/controllers/monitor/types/otel_config_test.go +++ b/controllers/monitor/types/otel_config_test.go @@ -60,7 +60,7 @@ var _ = Describe("monitor_controller", func() { func fakeInstance() *OteldInstance { return &OteldInstance{ - MetricsPipline: []Pipline{ + MetricsPipeline: []Pipeline{ { Name: "metrics", ReceiverMap: map[string]Receiver{ @@ -73,7 +73,7 @@ func fakeInstance() *OteldInstance { }, }, }, - Oteld: &v1alpha1.OTeld{ + OTeld: &v1alpha1.OTeld{ Spec: v1alpha1.OTeldSpec{ Mode: v1alpha1.ModeDaemonSet, CollectionInterval: "15s", diff --git a/controllers/monitor/types/pipline.go b/controllers/monitor/types/pipeline.go similarity index 72% rename from controllers/monitor/types/pipline.go rename to controllers/monitor/types/pipeline.go index c167950328a..f313d987dad 100644 --- a/controllers/monitor/types/pipline.go +++ b/controllers/monitor/types/pipeline.go @@ -36,7 +36,7 @@ type Exporters struct { LogsExporter []v1alpha1.LogsExporterSink } -type Pipline struct { +type Pipeline struct { Name string ReceiverMap map[string]Receiver ProcessorMap map[string]bool @@ -44,19 +44,19 @@ type Pipline struct { } type OteldInstance struct { - MetricsPipline []Pipline - LogPipline []Pipline - AppLogsPipline *Pipline - AppMetricsPiplien *Pipline - Oteld *v1alpha1.OTeld - AppDataSources []v1alpha1.CollectorDataSource + MetricsPipeline []Pipeline + LogPipeline []Pipeline + AppLogsPipeline *Pipeline + AppMetricsPipelien *Pipeline + OTeld *v1alpha1.OTeld + AppDataSources []v1alpha1.CollectorDataSource Cli client.Client Ctx context.Context } -func NewPipeline(name string) Pipline { - return Pipline{ +func NewPipeline(name string) Pipeline { + return Pipeline{ Name: name, ReceiverMap: make(map[string]Receiver), ProcessorMap: make(map[string]bool), @@ -66,13 +66,13 @@ func NewPipeline(name string) Pipline { func NewOteldInstance(oteld *v1alpha1.OTeld, cli client.Client, ctx context.Context) *OteldInstance { return &OteldInstance{ - Cli: cli, - Ctx: ctx, - Oteld: oteld, - MetricsPipline: []Pipline{}, - LogPipline: []Pipline{}, - AppLogsPipline: &Pipline{}, - AppMetricsPiplien: &Pipline{}, - AppDataSources: []v1alpha1.CollectorDataSource{}, + Cli: cli, + Ctx: ctx, + OTeld: oteld, + MetricsPipeline: []Pipeline{}, + LogPipeline: []Pipeline{}, + AppLogsPipeline: &Pipeline{}, + AppMetricsPipelien: &Pipeline{}, + AppDataSources: []v1alpha1.CollectorDataSource{}, } }