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

Add proto-buf definitions for php-fpm metrics #452

Merged
merged 2 commits into from
Sep 7, 2023

Conversation

achawla2012
Copy link
Contributor

@achawla2012 achawla2012 commented Aug 24, 2023

Proposed changes

Add protobuf definitions for php-fpm metrics along the line of old agent schema

Nginx amplify agent schema for php is currently

{   
    'type': 'phpfpm', 
    'root_uuid': 'cfd5d9d600905761ac7c092ddd7e1a95', 
    'local_id': '185502c3d367a8036dfda481e8421e9ae04f6d1031375496ee7bddd7f0a5534a', 
    'name': 'master', 
    'display_name': 'phpfpm master @ Ubuntu', 
    'cmd': 'php-fpm: master process (/etc/php/7.4/fpm/php-fpm.conf)', 
    'conf_path': '/etc/php/7.4/fpm/php-fpm.conf', 
    'workers': 12, 
    'bin_path': None, 
    'version': None, 
    'version_line': None, 
    'pid': 39620, 
    'agent': '1.8.1-1', 
    'children': [
        {
            'type': 'phpfpm_pool', 
            'root_uuid': 'cfd5d9d600905761ac7c092ddd7e1a95', 
            'local_id': '545a2f0f73e2800411ded3a1b4396e8e08b21dfc900ca364bfd2dda420ad84d4', 
            'name': 'wordpress_site', 
            'display_name': 'phpfpm wordpress_site @ Ubuntu', 
            'parent_local_id': '185502c3d367a8036dfda481e8421e9ae04f6d1031375496ee7bddd7f0a5534a', 
            'listen': '/run/php/php7.4-fpm-wordpress-site.sock', 
            'flisten': '/run/php/php7.4-fpm-wordpress-site.sock', 
            'status_path': '/status', 
            'can_have_children': False, 
            'agent': '1.8.1-1'
        }, 
        {
            'type': 'phpfpm_pool', 
            'root_uuid': 'cfd5d9d600905761ac7c092ddd7e1a95', 
            'local_id': 'f53516fd0b4b4924d63e3391a6ebb0f62428f7036fbe0a9643acca681456a3cf', 
            'name': 'www', 
            'display_name': 'phpfpm www @ Ubuntu', 
            'parent_local_id': '185502c3d367a8036dfda481e8421e9ae04f6d1031375496ee7bddd7f0a5534a', 
            'listen': '/run/php/php7.4-fpm.sock', 
            'flisten': '/run/php/php7.4-fpm.sock', 
            'status_path': '/status', 
            'can_have_children': False, 
            'agent': '1.8.1-1'
        }
    ]
}

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

@github-actions github-actions bot added chore Pull requests for routine tasks dependencies documentation Improvements or additions to documentation labels Aug 24, 2023
@netlify
Copy link

netlify bot commented Aug 24, 2023

Deploy Preview for agent-public-docs canceled.

Name Link
🔨 Latest commit 7eb1e8b
🔍 Latest deploy log https://app.netlify.com/sites/agent-public-docs/deploys/64f2e6fe7c767d0008efa7e5

Copy link
Contributor

@ryepup ryepup left a comment

Choose a reason for hiding this comment

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

LGTM, although I'm still curious if we need three copies of the codebase in this codebase

sdk/proto/phpfpm.proto Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Aug 30, 2023

Codecov Report

Patch coverage: 50.00% and project coverage change: -0.35% ⚠️

Comparison is base (7c1ada3) 67.19% compared to head (496ccbd) 66.85%.
Report is 9 commits behind head on main.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the GitHub App Integration for your organization. Read more.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #452      +/-   ##
==========================================
- Coverage   67.19%   66.85%   -0.35%     
==========================================
  Files         113      113              
  Lines       12849    12931      +82     
==========================================
+ Hits         8634     8645      +11     
- Misses       3647     3715      +68     
- Partials      568      571       +3     
Files Changed Coverage Δ
...or/github.com/nginx/agent/sdk/v2/config_helpers.go 64.19% <50.00%> (+0.18%) ⬆️

... and 7 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

docs/proto/proto.md Outdated Show resolved Hide resolved
// PhpFpm process id
int32 pid = 10 [(gogoproto.jsontag) = "pid"];
// NGINX agent version
string agent = 11 [(gogoproto.jsontag) = "agent"];
Copy link
Contributor

Choose a reason for hiding this comment

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

not sure why this is required? This is provided elsewhere in the protos https://github.com/nginx/agent/blob/main/sdk/proto/agent.proto#L150

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I intend to send over agent version only, similar to how old agent schema has.

// PhpFpm master process total workers/children
int32 workers = 13 [(gogoproto.jsontag) = "workers"];
// PhpFpm process health
PhpFpmHealth health = 14 [(gogoproto.jsontag) = "health"];
Copy link
Contributor

Choose a reason for hiding this comment

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

should the health be separated from the details?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought of sending it out as part of php-information that will have meta details. Do you have any other thoughts on this?

@dhurley dhurley merged commit 53284cb into nginx:main Sep 7, 2023
29 checks passed
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.

None yet

7 participants