Export ErrNoService and handle it as expected condition to prevent error log spam When the OTel config has no service block, ConfigToContainerProbe returns errNoService which was unexported and not matched by the sentinel error checks in Container(). This caused it to fall through to logger.Error() on every reconcile loop, spamming the operator logs with error-level messages and full stacktraces. Export errNoService as ErrNoService and add a dedicated check in Container() that logs at Info level, consistent with how ErrNoServiceExtensions and ErrNoServiceExtensionHealthCheck are handled.
Export ErrNoService and handle it as expected condition to prevent error log spam
When the OTel config has no service block, ConfigToContainerProbe returns errNoService which was unexported and not matched by the sentinel error checks in Container(). This caused it to fall through to logger.Error() on every reconcile loop, spamming the operator logs with error-level messages and full stacktraces.
Export errNoService as ErrNoService and add a dedicated check in Container() that logs at Info level, consistent with how ErrNoServiceExtensions and ErrNoServiceExtensionHealthCheck are handled.
The Amazon CloudWatch Agent Operator is software developed to manage the CloudWatch Agent on kubernetes.
Supported Languages:
This repo is based off of the OpenTelemetry Operator
make container
make deploy
Have an existing kubernetes cluster, such as minikube
Install cert-manager on your cluster
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.12.0/cert-manager.yaml
kubectl config set-context --current --namespace=amazon-cloudwatch
kubectl get all
kubectl logs amazon-cloudwatch-agent-operator-controller-manager-66f67f47f78
You should see logs that look similar to below
{"level":"info","ts":"2023-06-29T01:37:36Z","msg":"Starting workers","controller":"amazoncloudwatchagent","controllerGroup":"cloudwatch.aws.amazon.com","controllerKind":"AmazonCloudWatchAgent","worker count":1}
kubectl apply -f - <<EOF apiVersion: cloudwatch.aws.amazon.com/v1alpha1 kind: AmazonCloudWatchAgent metadata: name: cloudwatch-agent namespace: amazon-cloudwatch spec: mode: daemonset serviceAccount: cloudwatch-agent config: | { // insert cloudwatch agent config here } volumeMounts: - mountPath: /rootfs name: rootfs readOnly: true - mountPath: /var/run/docker.sock name: dockersock readOnly: true - mountPath: /run/containerd/containerd.sock name: containerdsock - mountPath: /var/lib/docker name: varlibdocker readOnly: true - mountPath: /sys name: sys readOnly: true - mountPath: /dev/disk name: devdisk readOnly: true volumes: - name: rootfs hostPath: path: / - hostPath: path: /var/run/docker.sock name: dockersock - hostPath: path: /var/lib/docker name: varlibdocker - hostPath: path: /run/containerd/containerd.sock name: containerdsock - hostPath: path: /sys name: sys - hostPath: path: /dev/disk/ name: devdisk env: - name: K8S_NODE_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: HOST_IP valueFrom: fieldRef: fieldPath: status.hostIP - name: HOST_NAME valueFrom: fieldRef: fieldPath: spec.nodeName - name: K8S_NAMESPACE valueFrom: fieldRef: fieldPath: metadata.namespace EOF
kubectl apply -f - <<EOF apiVersion: cloudwatch.aws.amazon.com/v1alpha1 kind: Instrumentation metadata: name: java-instrumentation namespace: default # use a namespace with pods you'd like to inject spec: exporter: endpoint: http://cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics propagators: - tracecontext - baggage - b3 - xray java: env: - name: OTEL_METRICS_EXPORTER value: "none" - name: OTEL_LOGS_EXPORTER value: "none" - name: OTEL_AWS_APPLICATION_SIGNALS_ENABLED value: "true" - name: OTEL_EXPORTER_OTLP_PROTOCOL value: "http/protobuf" - name: OTEL_AWS_APPLICATION_SIGNALS_EXPORTER_ENDPOINT value: "http://cloudwatch-agent.amazon-cloudwatch:4316/v1/metrics" EOF
make manifests
config/crd
config/rbac
make generate
See CONTRIBUTING for more information.
This project is licensed under the Apache-2.0 License.
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802032778号
Amazon CloudWatch Agent Operator
The Amazon CloudWatch Agent Operator is software developed to manage the CloudWatch Agent on kubernetes.
Supported Languages:
This repo is based off of the OpenTelemetry Operator
Build and Deployment
make containermake deployPre requisites
Have an existing kubernetes cluster, such as minikube
Install cert-manager on your cluster
Getting started
You should see logs that look similar to below
Helpful tools
make manifeststo create crds and roles inconfig/crdandconfig/rbacmake generateSecurity
See CONTRIBUTING for more information.
License
This project is licensed under the Apache-2.0 License.