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 additional fields to model count #47

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Kircheneer
Copy link
Contributor

Description

This PR is a follow-up on #46 (has to be merged after that) that introduces breaking changes to the output of the model count metrics.

  • The model count metric has been renamed from nautobot_model_count to nautobot_model_count_${model}_total to better align with Prometheus standards
  • In addition to the basic metric, you can now specify additional fields in the configuration by which the metric should be filterable (see example below)

Example

In this example, the site count includes the status of the site, meaning that in this example there is one site with "Active" status and one with "Decommissioning". Here is corresponding configuration that shows this off (note that you can traverse more than one relationship as in the rack example):

"nautobot_capacity_metrics": {
        "app_metrics": {
            "models": {
                "dcim": {
                    "Site": ["status__name", "region__name"],
                    "Rack": ["site__name", "site__region__name"],
                }
            }
        }
    }
# HELP nautobot_model_count_site_by_status_total Nautobot model count per status
# TYPE nautobot_model_count_site_by_status_total gauge
nautobot_model_count_site_by_status_total{app="dcim",status="Active"} 1.0
nautobot_model_count_site_by_status_total{app="dcim",status="Decommissioning"} 1.0

development/Dockerfile Outdated Show resolved Hide resolved
development/nautobot_config.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
tasks.py Outdated Show resolved Hide resolved
@Kircheneer Kircheneer force-pushed the lk-model-count-additional-fields branch from f1d7117 to c89b050 Compare October 24, 2023 12:31
@Kircheneer Kircheneer marked this pull request as ready for review October 24, 2023 12:53
@Kircheneer Kircheneer requested a review from a team as a code owner October 24, 2023 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants