Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helm logging support (#1) #38

Closed
wants to merge 1 commit into from

Conversation

rockb1017
Copy link

@rockb1017 rockb1017 commented Mar 13, 2021

Improving the helm chart:

  • k8s tagger to enrich with k8s metadata from container logs
  • remove hostport from default values.yaml
  • Optimize container log parsing by specifying the container runtime
  • make it configurable to collect otel collector log
  • create cluster role and role binding required for k8s metadata enrichment

@rockb1017 rockb1017 requested review from a team March 13, 2021 06:03
@linux-foundation-easycla
Copy link

linux-foundation-easycla bot commented Mar 13, 2021

CLA Signed

The committers are authorized under a signed CLA.

@tigrannajaryan
Copy link
Member

@rockb1017 please sign the CLA.

@rockb1017
Copy link
Author

@rockb1017 please sign the CLA.

Do I do a individual CLA?

@tigrannajaryan
Copy link
Member

@rockb1017 is this PR still needed?

@rockb1017
Copy link
Author

@tigrannajaryan
I rebased and updated my commit.
It includes

  • k8s tagger to enrich with k8s metadata from container logs
  • remove hostport from default values.yaml
  • Optimize container log parsing by specifying the container runtime
  • make it configurable to collect otel collector log
  • create cluster role and role binding required for k8s metadata enrichment
  • disable liveness and readiness because it is not working atm

@tigrannajaryan tigrannajaryan requested a review from dmitryax April 9, 2021 15:57
@tigrannajaryan
Copy link
Member

EasyCLA is stuck. Let me try to close and reopen.

@tigrannajaryan
Copy link
Member

@rockb1017 please update PR description / commit message to reflect what you listed here #38 (comment)

@@ -110,25 +110,21 @@ ports:
enabled: true
containerPort: 4317
servicePort: 4317
hostPort: 4317
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please keep the hostPorts enabled conditionally if being run as a daemonset (agent) ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@naseemkullah Could you explain why you would want it by default?
without using hostPort, it can be accessed through using k8s service.
in my AWS EKS cluster, it fails to be deployed when trying to use hostPort. it seems that it requires additional cluster configuration to map it to host port. It would make it a bit more complicated to deploy it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This how the instrumented workloads communicate with the collector when it runs as a daemon set in agent mode, I agree that in standalone collector mode they should be disabled and the k8s service used, hence enabling them under the condition that agent mode is enabled.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so pods that are running apps that has been instrumented to send trace information are sending it to its node ip it is running on?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats right! with something like this in their env:

      - name: OTEL_EXPORTER_JAEGER_AGENT_HOST
        valueFrom:
          fieldRef:
            fieldPath: status.hostIP

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the alternative is running the otel-collector agent as a sidecar container, which is outside the scope of this helm chart

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, let's keep host ports. The only stable pipeline of the otel collector currently is tracing. And running agent with no ports exposed doesn't provide any value for traces collection.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in my AWS EKS cluster, it fails to be deployed when trying to use hostPort. it seems that it requires additional cluster configuration to map it to host port. It would make it a bit more complicated to deploy it.

@rockb1017 Could you please share the errors you see? I never saw any issues with exposed ports on this deamonset.

remove hostport from default values.yaml
Optimize container log parsing by specifying the container runtime
make it configurable to collect otel collector log
create cluster role and role binding required for k8s metadata enrichment
includeAgentLogs: false
enrichK8sMetadata: true
listOfAnnotations: []
listOfLabels: []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K8s metadata applicable not only to logs, but widely used for traces and metrics as well.

All the default configuration can be easily overridden (by merging with defaults) in user's values.yaml. So I don't see a lot of benefit in providing extra configuration ways. Especially listOfAnnotations and listOfLabels can be easily replaced by the existing configuration method.

config:
  processors:
    k8s_tagger:
      annotations: ...
      labels: ...

it's just one line more to print than

agentCollector:
  containerLogs:
    listOfAnnotations:
    listOfLabels:

but less configuration options -> less confusion.

Speaking of enrichK8sMetadata, I would recommend to move the option one level up to be able to apply it to any of the pipelines. Like:

agentCollector:
  pipelinesWithK8sMetadata: [metrics, traces, logs]

Let's keep agentCollector.k8sMetadataPipelines: [] by default.

@tigrannajaryan @naseemkullah thoughts?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

K8s metadata applicable not only to logs, but widely used for traces and metrics as well.

All the default configuration can be easily overridden (by merging with defaults) in user's values.yaml. So I don't see a lot of benefit in providing extra configuration ways. Especially listOfAnnotations and listOfLabels can be easily replaced by the existing configuration method.

config:
  processors:
    k8s_tagger:
      annotations: ...
      labels: ...

it's just one line more to print than

agentCollector:
  containerLogs:
    listOfAnnotations:
    listOfLabels:

but less configuration options -> less confusion.

Good catch 💯

Speaking of enrichK8sMetadata, I would recommend to move the option one level up to be able to apply it to any of the pipelines. Like:

agentCollector:
  pipelinesWithK8sMetadata: [metrics, traces, logs]

Let's keep agentCollector.k8sMetadataPipelines: [] by default.

I just learned about this. so we would have both agentCollector.pipelines and agentCollector.pipelinesWithK8sMetadata?

Seeing that this is a helm chart maybe we just add the k8s_tagger and so on directly in the pipelines out of the box if that makes sense?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just learned about this. so we would have both agentCollector.pipelines and agentCollector.pipelinesWithK8sMetadata?

right

Seeing that this is a helm chart maybe we just add the k8s_tagger and so on directly in the pipelines out of the box if that makes sense?

Sounds good, but having k8s_tagger enabled by default requires installing the cluster role. At least we need a way to opt out from that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but less configuration options -> less confusion.

I agree.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think by having less config, you are making the users to study more on documentation to properly set up configOverride.
For example,

      k8s_tagger:
        passthrough: false
        auth_type: "kubeConfig"
        pod_association:
          - from: resource_attribute
            name: k8s.pod.uid
        extract:
          metadata:
            - deployment
            - cluster
            - namespace
            - node
            - startTime
          annotations: []
          labels: []
        filter:
          node_from_env_var: KUBE_NODE_NAME

this is required config for enriching it with k8s metadata.
most of it is static. Users doesn't need to know what passthrough value they need to pick, nor search though this plugin documentation to properly choose what pod_association I need to use.
So I think in this case, "less configuration options -> less confusion" doesn't quite fit here. it is more like "more guided helm chart -> less confusion".
We are helping users by presenting the configuration they need to look and hiding what they don't need to waste their minds on.

expr: '$$record matches "^[^ Z]+ "'
- output: parser-containerd
expr: '$$record matches "^[^ Z]+Z"'
{{- if eq .Values.agentCollector.containerLogs.containerRunTime "cri-o" }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not fully understand what this change does. Did this change delete the ability to automatically detect the format used by kubernetes and requires the user to specify the format?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rockb1017 please clarify why want to change this. It appears to me automatic detection is valuable since there is one less thing for users to worry about.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, instead of collector detecting the format, we are allowing users to provide their container runtime. this is how it is done in SCK. Though I am not saying this is definitely better way, but at least it will definitely be better for performance. I would say asking users to specify the container runtime once and have more efficient pipeline is better.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a tradeoff between ease of use and performance. Both are valid approach and different users likely will have different preferences. I think what we can do is by default have automatic detection of the format and in addition to that allow the user to specify the format, in which case the detection will be disabled and we will have better performance.

@dmitryax
Copy link
Member

Closing this PR since it's too specific for a particular logs collection use case. Feel free to open it again if you want to address the comments

@dmitryax dmitryax closed this Jun 17, 2021
matej-g pushed a commit to matej-g/opentelemetry-helm-charts that referenced this pull request Oct 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants