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

Collect ClientSettingsPolicy, ObservabilityPolicy, and NginxProxy count #2179

Merged
merged 5 commits into from
Jul 8, 2024

Conversation

bjee19
Copy link
Contributor

@bjee19 bjee19 commented Jun 27, 2024

Collect count for ClientSettingsPolicies attached at the Gateway level, ClientSettingsPolicies attached at the Route level, ObservabilityPolicies, and NginxProxy.

Problem: I want to collect the number of ClientSettings, Observability, and NginxProxy Policies used in NGF for each context they are used in.

Solution: Collect the counts of the resources.

Testing: Manual testing and addition to unit tests.

Output with a Gateway level ClientSettingsPolicy, a Route level ClientSettingsPolicy, an ObservabilityPolicy, and the NGINXProxy attached.

{"level":"debug","ts":"2024-06-27T21:53:53Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ImageSource":"local","ProjectName":"NGF"…"GatewayAttachedClientSettingsPolicyCount":1,"RouteAttachedClientSettingsPolicyCount":1,"ObservabilityPolicyCount":1,"NginxProxyCount":1,"NGFReplicaCount":1}}

Output with none of the above resources attached:

{"level":"debug","ts":"2024-06-27T21:59:53Z","logger":"telemetryExporter","msg":"Exporting telemetry","data":{"ImageSource":"local","ProjectName":"NGF"…"GatewayAttachedClientSettingsPolicyCount":0,"RouteAttachedClientSettingsPolicyCount":0,"ObservabilityPolicyCount":0,"NginxProxyCount":0,"NGFReplicaCount":1}}

Closes #1898

Checklist

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

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have updated necessary documentation
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch from my own fork

Release notes

If this PR introduces a change that affects users and needs to be mentioned in the release notes,
please add a brief note that summarizes the change.

Collect Policy and NGINXProxy count for telemetry data

@bjee19 bjee19 requested review from a team as code owners June 27, 2024 22:14
@github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 27, 2024
Copy link

codecov bot commented Jun 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.62%. Comparing base (6061483) to head (d02d232).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2179      +/-   ##
==========================================
+ Coverage   87.59%   87.62%   +0.03%     
==========================================
  Files          96       96              
  Lines        6698     6715      +17     
  Branches       50       50              
==========================================
+ Hits         5867     5884      +17     
  Misses        774      774              
  Partials       57       57              

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

@sjberman
Copy link
Contributor

In the future, I may consider this a chore, not an enhancement. Not really any direct user value here.

internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
internal/mode/static/telemetry/collector.go Outdated Show resolved Hide resolved
@bjee19 bjee19 changed the title Collect ClientSettingsPolicy, ObservabilityPolicy, and NGINXProxy count Collect ClientSettingsPolicy, ObservabilityPolicy, and NginxProxy count Jun 28, 2024
@bjee19 bjee19 merged commit 8884c70 into nginxinc:main Jul 8, 2024
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Report the number of Route and Gateway ClientSettingPolicies
5 participants