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

Implemented metric index reading from annotation #12

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .chloggen/metric-index-from-annottaions.yaml
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: enhancement
# The name of the component, or a single word describing the area of concern, (e.g. agent, clusterReceiver, gateway, networkExplorer, 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: Added support for rerouting metrics index with pod/namespace annotations
# One or more tracking issues related to the change
issues: [1053]
# (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:
6 changes: 6 additions & 0 deletions ci_scripts/k8s-splunk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ data:
homePath: $SPLUNK_DB/pod-anno/db
maxTotalDataSizeMB: 512000
thawedPath: $SPLUNK_DB/pod-anno/thaweddb
test_metrics:
coldPath: $SPLUNK_DB/test_metrics/colddb
datatype: metric
homePath: $SPLUNK_DB/test_metrics/db
maxTotalDataSizeMB: 512000
thawedPath: $SPLUNK_DB/test_metrics/thaweddb
---
apiVersion: v1
kind: Pod
Expand Down
1 change: 1 addition & 0 deletions docs/advanced-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ Manage Splunk OTel Collector Logging with these supported annotations.

* Use `splunk.com/index` annotation on pod and/or namespace to tell which Splunk platform indexes to ingest to. Pod annotation will take precedence over namespace annotation when both are annotated.
For example, the following command will make logs from `kube-system` namespace to be sent to `k8s_events` index: `kubectl annotate namespace kube-system splunk.com/index=k8s_events`
* Use `splunk.com/metricsIndex` annotation on pod and/or namespace to tell which Splunk platform metric indexes to ingest to. Pod annotation will take precedence over namespace annotation when both are annotated.
* 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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,35 @@ data:
- sources:
- from: resource_attribute
name: host.name
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata: []
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -429,6 +458,7 @@ data:
- batch
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- hostmetrics
- kubeletstats
Expand All @@ -444,6 +474,7 @@ data:
- resource/add_agent_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/agent
traces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,35 @@ data:
processors:
batch:
send_batch_max_size: 32768
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata: []
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -106,6 +135,7 @@ data:
- memory_limiter
- batch
- resource
- k8sattributes/metrics
- resource/k8s_cluster
receivers:
- k8s_cluster
Expand All @@ -118,6 +148,7 @@ data:
- resource/add_collector_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/k8s_cluster_receiver
telemetry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
component: otel-collector-agent
release: default
annotations:
checksum/config: 1e403a41cc6f461fdb2e6cdbb8b9f6cbbac9f1ef9d9def2b9a1b19e51a4edad7
checksum/config: 1ac6bb159cb4e899265ef7db4a8bb1dde9f62446df6e6b16995bcf7d212e09f2
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
component: otel-k8s-cluster-receiver
release: default
annotations:
checksum/config: c96290e06409602ae77ddb5b867ab2c00d568da4a31fda5ee5e8f0cbbff5a760
checksum/config: 2014df4d79530856fc4c52d10df0cbee831f67b794e53081e3569d1970af9943
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,35 @@ data:
- sources:
- from: resource_attribute
name: host.name
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata: []
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -429,6 +458,7 @@ data:
- batch
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- hostmetrics
- kubeletstats
Expand All @@ -444,6 +474,7 @@ data:
- resource/add_agent_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/agent
traces:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,35 @@ data:
processors:
batch:
send_batch_max_size: 32768
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata: []
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -106,6 +135,7 @@ data:
- memory_limiter
- batch
- resource
- k8sattributes/metrics
- resource/k8s_cluster
receivers:
- k8s_cluster
Expand All @@ -118,6 +148,7 @@ data:
- resource/add_collector_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/k8s_cluster_receiver
telemetry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
component: otel-collector-agent
release: default
annotations:
checksum/config: 1ac2acf8252d8317c6ada3aacf85bbf865dc2d340336e3c7dec8af277002e3af
checksum/config: 005a69103acb8660014c49e7c37407fda7dd1d2a464dc4faa68d53c3587849be
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
component: otel-k8s-cluster-receiver
release: default
annotations:
checksum/config: c96290e06409602ae77ddb5b867ab2c00d568da4a31fda5ee5e8f0cbbff5a760
checksum/config: 2014df4d79530856fc4c52d10df0cbee831f67b794e53081e3569d1970af9943
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,35 @@ data:
- sources:
- from: resource_attribute
name: host.name
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata: []
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -239,6 +268,7 @@ data:
- batch
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- hostmetrics
- kubeletstats
Expand All @@ -254,6 +284,7 @@ data:
- resource/add_agent_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/agent
telemetry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,35 @@ data:
processors:
batch:
send_batch_max_size: 32768
k8sattributes/metrics:
extract:
annotations:
- from: pod
key: splunk.com/sourcetype
- from: namespace
key: splunk.com/metricsIndex
tag_name: com.splunk.index
- from: pod
key: splunk.com/metricsIndex
tag_name: com.splunk.index
metadata: []
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: ip
- sources:
- from: connection
memory_limiter:
check_interval: 2s
limit_mib: ${SPLUNK_MEMORY_LIMIT_MIB}
Expand Down Expand Up @@ -106,6 +135,7 @@ data:
- memory_limiter
- batch
- resource
- k8sattributes/metrics
- resource/k8s_cluster
receivers:
- k8s_cluster
Expand All @@ -118,6 +148,7 @@ data:
- resource/add_collector_k8s
- resourcedetection
- resource
- k8sattributes/metrics
receivers:
- prometheus/k8s_cluster_receiver
telemetry:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ spec:
component: otel-collector-agent
release: default
annotations:
checksum/config: 885ac89d11ea4495aaaa8cceff3f3251814e43e145a72063ab38c45e47bd8dfc
checksum/config: 11b7dc56fc2e8bb7707daea4f680cdcc59af58cb61bcea3e2c433834767e6a04
kubectl.kubernetes.io/default-container: otel-collector
spec:
hostNetwork: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
component: otel-k8s-cluster-receiver
release: default
annotations:
checksum/config: c96290e06409602ae77ddb5b867ab2c00d568da4a31fda5ee5e8f0cbbff5a760
checksum/config: 2014df4d79530856fc4c52d10df0cbee831f67b794e53081e3569d1970af9943
spec:
serviceAccountName: default-splunk-otel-collector
nodeSelector:
Expand Down
Loading
Loading