-
Notifications
You must be signed in to change notification settings - Fork 154
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
base: main
Are you sure you want to change the base?
Changes from 8 commits
3b0a2cb
e31b53e
db92808
46cb97b
5c5c4a8
52c5ee0
127c211
ffa3a20
861eeb3
19b586d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' | ||
change_type: bug_fix | ||
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, operator, chart, other) | ||
component: other | ||
# 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: [] | ||
# (Optional) One or more lines of additional information to render under the primary note. | ||
# These lines will be padded with 2 spaces and then inserted directly into the document. | ||
# Use pipe (|) for multiline entries. | ||
subtext: |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nit: I might suggest updating this to something like this.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please see the updated version |
||||||||||
|
||||||||||
### Performance of native OpenTelemetry logs collection | ||||||||||
|
||||||||||
|
Original file line number | Diff line number | Diff line change | ||
---|---|---|---|---|
|
@@ -81,3 +81,24 @@ def test_metric_index_from_annotations(setup, index, expected): | |||
logger.info("Splunk received %s events in the last minute", | ||||
len(events)) | ||||
assert len(events) >= expected | ||||
|
||||
@pytest.mark.parametrize("index,sourcetype,expected", [ | ||||
("test_metrics", "sourcetype-anno", 1) | ||||
]) | ||||
def test_metric_sourcetype_from_annotations(setup, index, sourcetype, expected): | ||||
|
||||
''' | ||||
Test that metrics are being assigned the "sourcetype-anno" sourcetype, as defined by splunk.com/sourcetype annotation added during setup | ||||
''' | ||||
logger.info("testing for metrics index={0} sourcetype={1} expected={2} event(s)".format(index, sourcetype, expected)) | ||||
search_query = "index={0} filter=\"sourcetype={1}\"".format(index, sourcetype) | ||||
|
||||
events = check_events_from_splunk(start_time="-1h@h", | ||||
url=setup["splunkd_url"], | ||||
user=setup["splunk_user"], | ||||
query=["mpreview {0}".format( | ||||
search_query)], | ||||
password=setup["splunk_password"]) | ||||
logger.info("Splunk received %s events in the last minute", | ||||
len(events)) | ||||
assert len(events) >= expected | ||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done