Replies: 4 comments 5 replies
-
One thing to note is that you cannot sort objects in GUI based on tags but you can sort by custom fields. Just saying if that is important for you. |
Beta Was this translation helpful? Give feedback.
-
tldr; I'm just talking through it...but I think Tags have more utility when used on the Device (and VM) model than boolean custom_fields because they can be used for grouping in Ansible inventory and Config Contexts
/ipam/vrfs/?cf_enable_mpls=True (or False) works for me(tm) but I don't think there is any null/unset vs populated check (so maybe not trinary)
I've also used
/dcim/device-types/?cf_item_sku__gt=0 for numeric fields (xref to internal inventory/financial system in this case) and for string fields ?cf_name__empty should work /static/docs/reference/filtering/
I suppose that if you have a data set queried that is a mix of enabled/disabled items that filtering in software on a custom field with a known name is easier (just a hash existence/value check) than looping over an array of tags to see if the name exists.
With tags it's easy to query _across_ data models (at least in the UI) and see where they are applied, I dunno if that's useful though. Tags also have a more compact display in the UI than needing columns of custom fields.
Maybe it depends on how many different services a particular object might be associated with, if it's more than a handful then tags might be more managable than dozens of custom field columns, or maybe having a big tag soup without the possibility of longer description/labels/hovertext becomes a usability problem.
Some things maybe could use, but that's not a good fit for some of these kinds of things.
One area where Tags make sense is in grouping hosts for Ansible playbooks with the Netbox inventory module https://docs.ansible.com/ansible/latest/collections/netbox/netbox/nb_inventory_inventory.html#parameter-group_by so tags on Devices (or maybe using the /ipam/services/ model, which I haven't touched) may have more utility than an equivilant custom field. Tags can also be used with Config Contexts so there is another way that they have more utility.
—
Mark Tinberg ***@***.***>
Division of Information Technology-Network Services
University of Wisconsin-Madison
…________________________________
From: Brian Candler ***@***.***>
Sent: Thursday, January 19, 2023 2:24 AM
To: netbox-community/netbox ***@***.***>
Cc: Mark Tinberg ***@***.***>; Author ***@***.***>
Subject: Re: [netbox-community/netbox] Guidelines for using tags vs boolean custom fields (Discussion #11529)
Another is that you can't limit which object types a tag can be assigned to. Your "enable_mpls" tag could be assigned to an IP Address, a Site, a Power Feed etc.
But on the flip side: if you're using the REST API, it's easy to filter on the presence of a tag ("devices with tag foo"), but I couldn't find a way to filter on custom fields ("devices where cf_foo is not empty"). So I've ended up having to do both.
—
Reply to this email directly, view it on GitHub<#11529 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAS7UMZTDAWA2U7IFMF53ZTWTD22LANCNFSM6AAAAAAT7IWFDI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
One thing I dislike with custom fields is that they apply to all objects, so for example if you need to signal some info relevant to only WAN routers, well too bad you now have an irrelevant new custom field on all your other devices. As you implement more and more use cases, you end up with more and more irrelevant custom fields which clog up the UI. It would be neat if we could configure custom fields so that they are only displayed on objects meeting certain conditions. |
Beta Was this translation helpful? Give feedback.
-
This is great discussion topic. I just started asking myself the same question, and found the pros and cons described here very helpful. I think a concise version of these guidelines could go in the official documentation. |
Beta Was this translation helpful? Give feedback.
-
Do people have opinions on when using tags on objects to show they are enabled for a service vs using boolean custom fields works better? Are there any technical limitations or operational challenges that cause you to prefer one or the other? The functionality seems mostly equivalent, tags are boolean present/not present and custom_fields are trinary, yes/no/undefined. For example I'm starting to model MPLS L2VPN and have both an enable_mpls tag and an enable_mpls boolean custom field, on Device and VRF objects, and was trying to figure out if one way is going to work better than another. I've mostly been using custom fields more than tags but I'm trying to figure out what the engineering trade-offs are before wholly embracing one method or the other for service enablement.
Thoughts, or am I overthinking it?
Beta Was this translation helpful? Give feedback.
All reactions