Skip to content

Splunkenterprisereceiver add health metric (#36695) #36695

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

Merged
merged 23 commits into from
Feb 11, 2025

Conversation

macolby42
Copy link
Contributor

@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
| 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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The value only indicates whether it is red or not. A value of 1 could be green or yellow. It's not ideal, but color system for splunkd what implemented long before our use of OTel.

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Dec 24, 2024
@github-actions github-actions bot removed the Stale label Jan 3, 2025
return
}

ctx = context.WithValue(ctx, endpointType("type"), typeCm)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind expanding on why there is values being stored inside the context here?

Copy link
Contributor

Choose a reason for hiding this comment

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

This context value (which is defined in each scrape) is used to route the request to the correct api endpoint

Copy link
Contributor

github-actions bot commented Feb 5, 2025

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Feb 5, 2025
@atoulme
Copy link
Contributor

atoulme commented Feb 11, 2025

@shalper2 and @greatestusername please review

Copy link
Contributor

@greatestusername-splunk greatestusername-splunk left a comment

Choose a reason for hiding this comment

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

lgtm 🖖

@shalper2
Copy link
Contributor

Looks great, thanks!

@MovieStoreGuy MovieStoreGuy added ready to merge Code review completed; ready to merge by maintainers and removed waiting-for-code-owners labels Feb 11, 2025
@MovieStoreGuy MovieStoreGuy merged commit 7191212 into open-telemetry:main Feb 11, 2025
177 of 180 checks passed
@github-actions github-actions bot added this to the next release milestone Feb 11, 2025
khushijain21 pushed a commit to khushijain21/opentelemetry-collector-contrib that referenced this pull request Feb 14, 2025
…en-telemetry#36695)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### 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.'

<!--Describe what testing was performed and which tests were added.-->
#### 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.

<!--Describe the documentation added.-->
#### Documentation

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

---------

Co-authored-by: Sean Marciniak <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/splunkenterprise
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants