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

Fix metrics sourcetype annotation #1375

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

mstopa-splunk
Copy link
Contributor

Description: Fixed updating metrics' sourcetype with annotations
Link to Splunk idea:
Testing: Added a new unit test
Documentation: Added splunk.com/metricsSourceType to advanced-configuration.md

@mstopa-splunk mstopa-splunk requested review from a team as code owners August 8, 2024 08:28
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Fixed updating metrics' sourcetype with annotations
# One or more tracking issues related to the change
issues: []
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
issues: []
issues: [1375]

@@ -563,7 +563,7 @@ Manage Splunk OTel Collector Logging with these supported annotations.
* Filter logs using pod and/or namespace annotation
* If `logsCollection.containers.useSplunkIncludeAnnotation` is `false` (default: false), set `splunk.com/exclude` annotation to `true` on pod and/or namespace to exclude its logs from ingested.
* If `logsCollection.containers.useSplunkIncludeAnnotation` is `true` (default: false), set `splunk.com/include` annotation to `true` on pod and/or namespace to only include its logs from ingested. All other logs will be ignored.
* Use `splunk.com/sourcetype` annotation on pod to overwrite `sourcetype` field. If not set, it is dynamically generated to be `kube:container:CONTAINER_NAME`.
* Use `splunk.com/sourcetype` annotation on pod to overwrite `sourcetype` field. If not set, it is dynamically generated to be `kube:container:CONTAINER_NAME` for logs and defaults to "httpevent" for metrics.
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I might suggest updating this to something like this.

Suggested change
* Use `splunk.com/sourcetype` annotation on pod to overwrite `sourcetype` field. If not set, it is dynamically generated to be `kube:container:CONTAINER_NAME` for logs and defaults to "httpevent" for metrics.
* Use `splunk.com/sourcetype` annotation on pod to overwrite `sourcetype` field.
* For logs, if not set, it defaults to `kube:container:CONTAINER_NAME`.
* For metrics, if not set, it defaults to `httpevent`.

password=setup["splunk_password"])
logger.info("Splunk received %s events in the last minute",
len(events))
assert len(events) >= expected
Copy link
Contributor

Choose a reason for hiding this comment

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

This test is failing in CI/CD still, see what you can do about it.

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.

3 participants