Allow processing webhooks when global config context has been updated #7799

Closed
opened 2025-12-29 20:28:20 +01:00 by adam · 5 comments
Owner

Originally created by @abhi1693 on GitHub (Mar 26, 2023).

NetBox version

v3.4.6

Feature type

Change to existing functionality

Proposed functionality

When a user makes a change to the global config context, the webhooks should be triggered automatically for the affected devices.

Use case

We manage our syslog configuration by site/tenant via the global config context. In some cases, it needs a little tweak now and then when a new platform is added or to comply with our organization policy. It becomes harder to track down all the devices that are affected by the config context and do a fake update just to trigger the webhooks.

The auto-trigger of the webhooks will geatly reduce the time needed to re-run the hooks manually, will avoid human errors wherein a device could be missed.

I have thought of applying the content types of config context as well on the webhook and then use the DB ID as the condition but that seems like a hack and feels more error prone if a user deletes the context and re-creates it (for whatever reason), the hook will never be triggered.

Database changes

No response

External dependencies

No response

Originally created by @abhi1693 on GitHub (Mar 26, 2023). ### NetBox version v3.4.6 ### Feature type Change to existing functionality ### Proposed functionality When a user makes a change to the global config context, the webhooks should be triggered automatically for the affected devices. ### Use case We manage our syslog configuration by site/tenant via the global config context. In some cases, it needs a little tweak now and then when a new platform is added or to comply with our organization policy. It becomes harder to track down all the devices that are affected by the config context and do a fake update just to trigger the webhooks. The auto-trigger of the webhooks will geatly reduce the time needed to re-run the hooks manually, will avoid human errors wherein a device could be missed. I have thought of applying the content types of config context as well on the webhook and then use the DB ID as the condition but that seems like a hack and feels more error prone if a user deletes the context and re-creates it (for whatever reason), the hook will never be triggered. ### Database changes _No response_ ### External dependencies _No response_
adam added the type: featurestatus: under review labels 2025-12-29 20:28:20 +01:00
adam closed this issue 2025-12-29 20:28:20 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (Mar 26, 2023):

I don't see any way to feasibly implement this. Imagine the following netbox instance:

  • 10k devices
  • 1k virtual machines
  • 500 modules

Someone creates, edits or deletes a config context with no filters (will apply to all devices, vms and modules). The result would be 11500 webhooks being queued. The webhooks themselves are sent in a background task, but all 11500 objects must be serialized and queued in the same request as the save. Conservatively this would take minutes to complete.

Do you have a proposed implementation of your FR?

@kkthxbye-code commented on GitHub (Mar 26, 2023): I don't see any way to feasibly implement this. Imagine the following netbox instance: * 10k devices * 1k virtual machines * 500 modules Someone creates, edits or deletes a config context with no filters (will apply to all devices, vms and modules). The result would be 11500 webhooks being queued. The webhooks themselves are sent in a background task, but all 11500 objects must be serialized and queued in the same request as the save. Conservatively this would take minutes to complete. Do you have a proposed implementation of your FR?
Author
Owner

@abhi1693 commented on GitHub (Mar 27, 2023):

I guess this should be blocked until https://github.com/netbox-community/netbox/issues/11202 is implemented. With background processing, your concern should be addressed

@abhi1693 commented on GitHub (Mar 27, 2023): I guess this should be blocked until https://github.com/netbox-community/netbox/issues/11202 is implemented. With background processing, your concern should be addressed
Author
Owner

@kkthxbye-code commented on GitHub (Mar 27, 2023):

I guess this should be blocked until #11202 is implemented. With background processing, your concern should be addressed

As I said, webhooks are already processed in the background, but you still need to serialize the objects up front. So we still need a proposed implementation here.

@kkthxbye-code commented on GitHub (Mar 27, 2023): > I guess this should be blocked until #11202 is implemented. With background processing, your concern should be addressed As I said, webhooks are already processed in the background, but you still need to serialize the objects up front. So we still need a proposed implementation here.
Author
Owner

@abhi1693 commented on GitHub (Mar 29, 2023):

I'll try to think of something then. I thought serialisation would also be off loaded to the worker.

@abhi1693 commented on GitHub (Mar 29, 2023): I'll try to think of something then. I thought serialisation would also be off loaded to the worker.
Author
Owner

@jeremystretch commented on GitHub (May 4, 2023):

I have to agree that unfortunately this doesn't seem feasible without some clever solution yet to be identified. I'm going to close this out for now, but if you do come up with an approach that can scale please feel free to re-open.

@jeremystretch commented on GitHub (May 4, 2023): I have to agree that unfortunately this doesn't seem feasible without some clever solution yet to be identified. I'm going to close this out for now, but if you do come up with an approach that can scale please feel free to re-open.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7799