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

[8.14](backport #4893) Make k8sattributesprocessor available in Agent running in OTel mode #4981

Merged
merged 13 commits into from
Jun 21, 2024

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Jun 21, 2024

What does this PR do?

This PR makes the k8sattributesprocessor available to users running Elastic Agent in otel mode.

Why is it important?

To allow users of Elastic Agent running as as OpenTelemetry Collector to configure pipelines containing the k8sattributesprocessor.

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

How to test this PR locally

  1. Prepare the binaryDEV=true EXTERNAL=true SNAPSHOT=true PLATFORMS=linux/amd64 PACKAGES=docker mage -v package
  2. build the image cd build/package/elastic-agent/elastic-agent-linux-amd64.docker/docker-build && docker build -t agent-otel-dev .
  3. Load to local cluster kind load docker-image agent-otel-dev:latest
  4. prepare the ES secrets
kubectl create secret generic elastic-secret \
     --from-literal=es_endpoint='https://test-otel-blablabla.es.us-central1.gcp.cloud.es.io/' \                 
     --from-literal=es_password='asdfgp' \     
     --from-literal=es_user='elastic'
  1. specify the image:
image: agent-otel-dev:latest
imagePullPolicy: Never
  1. Deploy the manifest from https:/elastic/opentelemetry-dev/pull/258 : k apply -f elastic-otel-collector.yaml
  2. Verify the output:
2024-06-10T13:17:25.677Z	info	ResourceLog #0
Resource SchemaURL: 
Resource attributes:
     -> k8s.namespace.name: Str(kube-system)
     -> k8s.pod.name: Str(kindnet-6lgrl)
     -> k8s.container.restart_count: Str(0)
     -> k8s.pod.uid: Str(3844b30e-67ee-4bcc-98ac-8f2196852939)
     -> k8s.container.name: Str(kindnet-cni)
     -> k8s.daemonset.name: Str(kindnet)
     -> k8s.node.name: Str(kind-control-plane)
     -> k8s.pod.start_time: Str(2024-06-10T13:09:03Z)
ScopeLogs #0
ScopeLogs SchemaURL: 
InstrumentationScope  
LogRecord #0
ObservedTimestamp: 2024-06-10 13:17:25.420729149 +0000 UTC
Timestamp: 2024-06-10 13:17:25.300601954 +0000 UTC
SeverityText: 
SeverityNumber: Unspecified(0)
Body: Str(I0610 13:17:25.300466       1 main.go:223] Handling node with IPs: map[172.21.0.2:{}])
Attributes:
     -> logtag: Str(F)
     -> log.file.path: Str(/var/log/pods/kube-system_kindnet-6lgrl_3844b30e-67ee-4bcc-98ac-8f2196852939/kindnet-cni/0.log)
     -> log.iostream: Str(stderr)
     -> time: Str(2024-06-10T13:17:25.300601954Z)
Trace ID: 
Span ID: 
Flags: 0
LogRecord #1
ObservedTimestamp: 2024-06-10 13:17:25.420987445 +0000 UTC
Timestamp: 2024-06-10 13:17:25.300633177 +0000 UTC
SeverityText: 
SeverityNumber: Unspecified(0)
Body: Str(I0610 13:17:25.300494       1 main.go:227] handling current node)
Attributes:
     -> log.iostream: Str(stderr)
     -> logtag: Str(F)
     -> log.file.path: Str(/var/log/pods/kube-system_kindnet-6lgrl_3844b30e-67ee-4bcc-98ac-8f2196852939/kindnet-cni/0.log)
     -> time: Str(2024-06-10T13:17:25.300633177Z)
Trace ID: 
Span ID: 
Flags: 0
	{"kind": "exporter", "data_type": "logs", "name": "debug"}
```<hr>This is an automatic backport of pull request #4893 done by [Mergify](https://mergify.com).

Signed-off-by: ChrsMark <[email protected]>
Co-authored-by: Michal Pristas <[email protected]>
(cherry picked from commit 2e09c33)

# Conflicts:
#	go.mod
#	go.sum
#	internal/pkg/otel/README.md
#	internal/pkg/otel/components.go
@mergify mergify bot requested a review from a team as a code owner June 21, 2024 08:25
@mergify mergify bot added backport conflicts There is a conflict in the backported pull request labels Jun 21, 2024
@mergify mergify bot requested review from michalpristas and blakerouse and removed request for a team June 21, 2024 08:25
Copy link
Contributor Author

mergify bot commented Jun 21, 2024

Cherry-pick of 2e09c33 has failed:

On branch mergify/bp/8.14/pr-4893
Your branch is up to date with 'origin/8.14'.

You are currently cherry-picking commit 2e09c33864.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   NOTICE.txt
	new file:   changelog/fragments/1717939159-add-k8sattributesprocessor.yaml

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   go.mod
	both modified:   go.sum
	both modified:   internal/pkg/otel/README.md
	both modified:   internal/pkg/otel/components.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

@michalpristas
Copy link
Contributor

depends on #4980

Copy link
Contributor Author

mergify bot commented Jun 21, 2024

This pull request is now in conflicts. Could you fix it? 🙏
To fixup this pull request, you can check out it locally. See documentation: https://help.github.com/articles/checking-out-pull-requests-locally/

git fetch upstream
git checkout -b mergify/bp/8.14/pr-4893 upstream/mergify/bp/8.14/pr-4893
git merge upstream/8.14
git push upstream mergify/bp/8.14/pr-4893

@michalpristas michalpristas requested a review from a team as a code owner June 21, 2024 11:09
@michalpristas michalpristas requested review from MichaelKatsoulis and constanca-m and removed request for a team June 21, 2024 11:09
@michalpristas michalpristas merged commit c7a9d27 into 8.14 Jun 21, 2024
13 checks passed
@michalpristas michalpristas deleted the mergify/bp/8.14/pr-4893 branch June 21, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport conflicts There is a conflict in the backported pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants