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

Support unix socket to collect NGINX OSS and Plus metrics #938

Merged
merged 27 commits into from
Dec 5, 2024

Conversation

aphralG
Copy link
Contributor

@aphralG aphralG commented Nov 29, 2024

Proposed changes

  • Changed nginxConfigContext.PlusAPI & nginxConfigContext.StubStatus from strings to APIDetails which is a struct containing URL and Location & Listen to support unix sockets. Where listen is the socket if using sockets, same change was made to OSS & Plus Receivers Config & Otel template, example below
  • Changed Stub Status Scraper to use default http client instead of otel http client to enable the setting of the dial context for sockets to work.
  • Removed duplicate code in config parser, the same functions are used to get StubStatus & PlusAPI
    • urlsForLocationDirectiveAPIDetails replaces urlsForLocationDirective
    • pingAPIEndpoint replaces pingPlusAPIEndpoint & pingStubStatusAPIEndpoint
    • crossplaneConfigTraverseAPIDetails replaces crossplaneConfigTraverseStr
    • apiCallback replaces plusAPICallback & stubStatusAPICallback
    • traverseAPIDetails replaces traverseStr
    • The format for the unix api and stub status format were taken from other projects to be consistent
&APIDetails{
			URL:      "[http://localhost:80/status](http://localhost/status)",
			Listen: "localhost:80",
                         Location: "/status"
		},
&APIDetails{
			URL:      ""http://config-status/stub_status",
			Listen: "unix:/var/run/nginx/nginx-status.sock",
                         Location: "/stub_status"
		},

Checklist

Before creating a PR, run through this checklist and mark each as complete.

  • I have read the CONTRIBUTING document
  • I have run make install-tools and have attached any dependency changes to this pull request
  • If applicable, I have added tests that prove my fix is effective or that my feature works
  • If applicable, I have checked that any relevant tests pass after adding my changes
  • If applicable, I have updated any relevant documentation (README.md)
  • If applicable, I have tested my cross-platform changes on Ubuntu 22, Redhat 8, SUSE 15 and FreeBSD 13

@aphralG aphralG self-assigned this Nov 29, 2024
@aphralG aphralG requested a review from a team as a code owner November 29, 2024 11:23
@github-actions github-actions bot added chore Pull requests for routine tasks dependencies labels Nov 29, 2024
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Dec 3, 2024
Copy link
Collaborator

@dhurley dhurley left a comment

Choose a reason for hiding this comment

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

Can you update the README files for the 2 receivers as well?

@aphralG aphralG requested a review from dhurley December 5, 2024 10:28
@aphralG aphralG merged commit 0c83c0c into v3 Dec 5, 2024
20 checks passed
@aphralG aphralG deleted the add-ability-to-use-unix-socket branch December 5, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Pull requests for routine tasks dependencies documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants