Skip to content

Update N+ license handling to reflect reporting section presence #528

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

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

Conversation

defanator
Copy link
Member

Proposed changes

Previously there was an assumption that /api/9/license will always include the reporting subtree (docs), and if it was absent, related values were populated with zeroes making the whole struct hard to rely on.

With the proposed change, NginxLicense.Reporting will be a pointer to the original subtree if it present in the API response, or nil otherwise.

Related to nginx/nginx-prometheus-exporter#1102.

May potentially break other consumers of this package (e.g. https://github.com/nginx/kubernetes-ingress, https://github.com/nginx/nginx-prometheus-exporter) - future dep updates will require appropriate changes.

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

Previously there was an assumption that `/api/9/license` will always include
the `reporting` subtree, and if it was absent, related values were populated
with zeroes [1] making the whole struct hard to rely on.

With this change, NginxLicense.Reporting will be a pointer to the original
subtree if it present in the API response, or nil otherwise.

[1] https://betterstack.com/community/guides/scaling-go/json-in-go/#2-missing-fields-fallback-to-zero-values
defanator added a commit to defanator/nginx-prometheus-exporter that referenced this pull request Jul 25, 2025
This one depends on pending PR in nginx-plus-go-client:
nginx/nginx-plus-go-client#528
@vepatel vepatel moved this from Todo ☑ to In Review 👀 in NGINX Ingress Controller Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Review 👀
Development

Successfully merging this pull request may close these issues.

3 participants