Skip to content

Introduce metrics representing N+ license status #1102

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 1 commit into
base: main
Choose a base branch
from

Conversation

defanator
Copy link
Member

@defanator defanator commented Jul 18, 2025

Proposed changes

This PR adds N+ specific metrics indicating license status (expiration date plus some reporting counters available through the N+ API license object). Primary purpose of these is to be used in associated alerting, as N+ API is the lowest possible source of truth in regard to everything connected to N+ license.

The semantic is borrowed from similar cert-manager metrics which are widely used in lots of environments.

Example output in Prometheus format:

[2025-08-20 14:59:43 MDT] a.belov@F67QQWKXLK ~ % curl -fs http://localhost:9113/metrics | grep -i -- 'nginxplus_license'
# HELP nginxplus_license_expiration_timestamp_seconds License expiration date (expressed as Unix Epoch Time)
# TYPE nginxplus_license_expiration_timestamp_seconds gauge
nginxplus_license_expiration_timestamp_seconds 1.8220032e+09
# HELP nginxplus_license_reporting_fails_count Number of failed reporting attempts, reset each time the usage report is successfully sent
# TYPE nginxplus_license_reporting_fails_count gauge
nginxplus_license_reporting_fails_count 0
# HELP nginxplus_license_reporting_grace_period_seconds Number of seconds before traffic processing is stopped after unsuccessful report attempt
# TYPE nginxplus_license_reporting_grace_period_seconds gauge
nginxplus_license_reporting_grace_period_seconds 1.5551908e+07
# HELP nginxplus_license_reporting_healthy Indicates whether the reporting state is still considered healthy despite recent failed attempts
# TYPE nginxplus_license_reporting_healthy gauge
nginxplus_license_reporting_healthy 1

Checklist

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

  • I have read the CONTRIBUTING guide
  • I have proven my fix is effective or that my feature works
  • I have checked that all unit tests pass after adding my changes
  • I have ensured the README is up to date
  • I have rebased my branch onto main
  • I will ensure my PR is targeting the main branch and pulling from my branch on my own fork

@defanator defanator requested a review from a team as a code owner July 18, 2025 18:28
Copy link

nginx-bot bot commented Jul 18, 2025

Hi @defanator! Welcome to the project! 🎉

Thanks for opening this pull request!
Be sure to check out our Contributing Guidelines while you wait for someone on the team to review this.

@nginx-bot nginx-bot bot added the community Issues or PRs opened by an external contributor label Jul 18, 2025
@defanator
Copy link
Member Author

@mpstefan @pdabelf5 @javorszky appreciate extra eyes on this one gentlemen, it would be great if it could land into next release of exporter itself + hopefully included into one of the next NIC releases. We have a few ongoing and upcoming tasks where we do consider lack of proposed metric as a blocker. TIA!

Copilot

This comment was marked as outdated.

@defanator defanator force-pushed the license_expiration_metric branch from 458945a to 84ad998 Compare August 20, 2025 20:45
@defanator defanator requested review from pdabelf5 and Copilot August 20, 2025 20:48
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces NGINX Plus license-related metrics to enable monitoring and alerting on license expiration and reporting status. The implementation adds a new API call to retrieve license information and exposes it through Prometheus metrics.

  • Adds four new license-related metrics for expiration date, reporting health, failure count, and grace period
  • Integrates with existing NGINX Plus client to fetch license data during metric collection
  • Follows established patterns for metric naming and error handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@defanator defanator changed the title Introduce metric representing N+ license expiration date Introduce metrics representing N+ license status Aug 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues or PRs opened by an external contributor
Projects
Status: In Review 👀
Development

Successfully merging this pull request may close these issues.

3 participants