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

Splunkenterprisereceiver add health metric (#36695) #36695

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

Conversation

macolby42
Copy link

@macolby42 macolby42 commented Dec 5, 2024

Description

Adds splunk.health metric that uses the introspection endpoint at /services/server/health/splunkd/details. The metric features 2 attributes:

splunk.feature: Describes the part of the server's feature
splunk.feature.health: Describes (in red, yellow, green) the health status of the given feature

The metric will remain a value of 1 unless the feature's health becomes 'red.'

Testing

Built a custom version of splunk-otel-collector that referenced this code. Then ran it on a Splunk stack, and received metrics out. Also created generated tests.

Documentation

Added an entry to documentation.md describing the new metric.

macolby42 and others added 2 commits December 5, 2024 12:05
* Initial commit

* Corrected structs to fit json API response

* Added to changelog

* PR number added to changelog
@atoulme
Copy link
Contributor

atoulme commented Dec 6, 2024

Build fails with

Generated code is out of date, please run "make generate" and commit the changes in this PR.

@macolby42 macolby42 changed the title Splunkenterprisereceiver add health metric (#1) Splunkenterprisereceiver add health metric (#36695) Dec 9, 2024
@@ -156,3 +157,17 @@ type DispatchArtifactContent struct {
StatusCacheSize string `json:"cached_job_status_status_csv_size_mb"`
CacheTotalEntries string `json:"cached_job_status_total_entries"`
}

// '/services/server/health/splunkd/details
type HealthArtifacts struct {
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
type HealthArtifacts struct {
type healthArtifacts struct {

limit your exported API to the minimum to avoid dependencies down the road using your internal structs.

Entries []HealthArtifactEntry `json:"entry"`
}

type HealthArtifactEntry struct {
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
type HealthArtifactEntry struct {
type healthArtifactEntry struct {

Content HealthDetails `json:"content"`
}

type HealthDetails struct {
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
type HealthDetails struct {
type healthDetails struct {

| Name | Description | Values |
| ---- | ----------- | ------ |
| splunk.feature | The Feature name from the Splunk Health Introspection Endpoint | Any Str |
| splunk.feature.health | The Health (in color form) of a Splunk Feature from the Splunk Health Introspection Endpoint | Any Str |
Copy link
Contributor

Choose a reason for hiding this comment

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

sure you need that? you already get the status via the value right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants