Skip to content

Commit 0a6c7bc

Browse files
committed
[processor/k8sattributes] introduce new selfmon metrics
Signed-off-by: odubajDT <[email protected]>
1 parent 095de6b commit 0a6c7bc

File tree

8 files changed

+266
-35
lines changed

8 files changed

+266
-35
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: 'enhancement'
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: processor/k8sattributes
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "Added processor-specific observability metrics: `processor_k8sattributes_pod_association_success`, `processor_k8sattributes_pod_association_error`, and `processor_k8sattributes_resource_attributes_added` with k8s_telemetry_type attribute for signal differentiation"
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [44587]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext:
19+
20+
# If your change doesn't affect end users or the exported elements of any package,
21+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
22+
# Optional: The change log or logs in which this entry should be included.
23+
# e.g. '[user]' or '[user, api]'
24+
# Include 'user' if the change is relevant to end users.
25+
# Include 'api' if there is a change to a library API.
26+
# Default: '[user]'
27+
change_logs: []

processor/k8sattributesprocessor/documentation.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,3 +152,45 @@ Number of ReplicaSet update events received [Development]
152152
| Unit | Metric Type | Value Type | Monotonic | Stability |
153153
| ---- | ----------- | ---------- | --------- | --------- |
154154
| 1 | Sum | Int | true | Development |
155+
156+
### otelcol_processor_k8sattributes_pod_association_error
157+
158+
Number of failed pod associations [Development]
159+
160+
| Unit | Metric Type | Value Type | Monotonic | Stability |
161+
| ---- | ----------- | ---------- | --------- | --------- |
162+
| {resources} | Sum | Int | true | Development |
163+
164+
#### Attributes
165+
166+
| Name | Description | Values |
167+
| ---- | ----------- | ------ |
168+
| k8s_telemetry_type | The type of telemetry data being processed (traces, metrics, logs, profiles) | Str: ``traces``, ``metrics``, ``logs``, ``profiles`` |
169+
170+
### otelcol_processor_k8sattributes_pod_association_success
171+
172+
Number of successful pod associations [Development]
173+
174+
| Unit | Metric Type | Value Type | Monotonic | Stability |
175+
| ---- | ----------- | ---------- | --------- | --------- |
176+
| {resources} | Sum | Int | true | Development |
177+
178+
#### Attributes
179+
180+
| Name | Description | Values |
181+
| ---- | ----------- | ------ |
182+
| k8s_telemetry_type | The type of telemetry data being processed (traces, metrics, logs, profiles) | Str: ``traces``, ``metrics``, ``logs``, ``profiles`` |
183+
184+
### otelcol_processor_k8sattributes_resource_attributes_added
185+
186+
Number of times resource attributes were successfully added to resources [Development]
187+
188+
| Unit | Metric Type | Value Type | Monotonic | Stability |
189+
| ---- | ----------- | ---------- | --------- | --------- |
190+
| {resources} | Sum | Int | true | Development |
191+
192+
#### Attributes
193+
194+
| Name | Description | Values |
195+
| ---- | ----------- | ------ |
196+
| k8s_telemetry_type | The type of telemetry data being processed (traces, metrics, logs, profiles) | Str: ``traces``, ``metrics``, ``logs``, ``profiles`` |

processor/k8sattributesprocessor/factory.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"go.opentelemetry.io/collector/processor/processorhelper"
1515
"go.opentelemetry.io/collector/processor/processorhelper/xprocessorhelper"
1616
"go.opentelemetry.io/collector/processor/xprocessor"
17+
"go.uber.org/zap"
1718

1819
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig"
1920
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sattributesprocessor/internal/kube"
@@ -171,11 +172,17 @@ func createKubernetesProcessor(
171172
cfg component.Config,
172173
options ...option,
173174
) *kubernetesprocessor {
175+
telemetry, err := metadata.NewTelemetryBuilder(params.TelemetrySettings)
176+
if err != nil {
177+
params.Logger.Error("failed to create telemetry builder", zap.Error(err))
178+
}
179+
174180
kp := &kubernetesprocessor{
175181
logger: params.Logger,
176182
cfg: cfg,
177183
options: options,
178184
telemetrySettings: params.TelemetrySettings,
185+
telemetry: telemetry,
179186
}
180187

181188
return kp

processor/k8sattributesprocessor/internal/metadata/generated_telemetry.go

Lines changed: 50 additions & 29 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/k8sattributesprocessor/internal/metadatatest/generated_telemetrytest.go

Lines changed: 48 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/k8sattributesprocessor/internal/metadatatest/generated_telemetrytest_test.go

Lines changed: 12 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/k8sattributesprocessor/metadata.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,16 @@ tests:
140140
goleak:
141141
skip: true
142142

143+
attributes:
144+
k8s_telemetry_type:
145+
description: The type of telemetry data being processed (traces, metrics, logs, profiles)
146+
type: string
147+
enum:
148+
- traces
149+
- metrics
150+
- logs
151+
- profiles
152+
143153
telemetry:
144154
metrics:
145155
otelsvc_k8s_daemonset_added:
@@ -375,3 +385,34 @@ telemetry:
375385
sum:
376386
value_type: int
377387
monotonic: true
388+
processor_k8sattributes_pod_association_error:
389+
enabled: true
390+
description: Number of failed pod associations
391+
stability:
392+
level: development
393+
unit: "{resources}"
394+
attributes: [k8s_telemetry_type]
395+
sum:
396+
value_type: int
397+
monotonic: true
398+
processor_k8sattributes_pod_association_success:
399+
enabled: true
400+
description: Number of successful pod associations
401+
stability:
402+
level: development
403+
unit: "{resources}"
404+
attributes: [k8s_telemetry_type]
405+
sum:
406+
value_type: int
407+
monotonic: true
408+
processor_k8sattributes_resource_attributes_added:
409+
enabled: true
410+
description: Number of times resource attributes were successfully added to resources
411+
stability:
412+
level: development
413+
unit: "{resources}"
414+
attributes: [k8s_telemetry_type]
415+
sum:
416+
value_type: int
417+
monotonic: true
418+

0 commit comments

Comments
 (0)