# MQTT Engine: auto-prune removed metrics?

**URL:** <https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [May 17, 2021, 3:42pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785 "2021-05-17T15:42:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![321liftoff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/321liftoff/32/27544_2.png) [@321liftoff](https://forum.inductiveautomation.com/u/321liftoff)\
**Post date:** [May 17, 2021, 3:42pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785/1 "2021-05-17T15:42:15Z")

</div>

@wes0johnson Given the following scenario:

1. Node provides a birth certificate with 5 metrics
2. Node software is updated and 1 metric is removed
3. Node software is started and issues a birth certificate without the removed metric
4. Ignition MQTT Engine tag provider continues to show the removed metric as bad/offline

Is there an option in the MQTT Engine to prune the tag provider, where it would remove metrics if the incoming birth certification of a node does not include them?

---

<div class="post-metadata">

**Author:** ![wes0johnson](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wes0johnson](https://forum.inductiveautomation.com/u/wes0johnson)\
**Post date:** [May 17, 2021, 5:17pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785/2 "2021-05-17T17:17:32Z")

</div>

This is an existing backlog item for us. However, we haven’t implemented it or scheduled it for development yet. I’ve added a +1 based on your request. For now, the deletion at the Engine side must happen manually.

---

<div class="post-metadata">

**Author:** ![justin.brzozoski](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/justin.brzozoski/32/13452_2.png) [@justin.brzozoski](https://forum.inductiveautomation.com/u/justin.brzozoski)\
**Post date:** [May 17, 2021, 7:55pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785/3 "2021-05-17T19:55:16Z")

</div>

I think you already knew I was a +1 on this, Wes.

But as an added bit of confusion, I’ve noticed that the bad/offline tags _do_ disappear when the MQTT Engine is restarted, which is beneficial in some cases and just confusing in others.

If we truly were done with the tag and didn’t want it anymore, 🥳

But if the tag is important and expected to be there but that device hasn’t reported in for some reason (offline for maintenance, etc), it can confuse any scripts that browse for it or try to read it via normal methods since it doesn’t _quite_ exist. You can access it properly via the history methods, but not normal tag read/write or config methods.

My ideal solution would be if MQTT Engine didn’t forget any tags on restart, but instead had a general “delete tag if offline longer than” config setting, that could be set to some number of hours up to a year.

---

<div class="post-metadata">

**Author:** ![321liftoff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/321liftoff/32/27544_2.png) [@321liftoff](https://forum.inductiveautomation.com/u/321liftoff)\
**Post date:** [May 18, 2021, 3:00pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785/4 "2021-05-18T15:00:01Z")

</div>

I also see that restarting the MQTT Engine purges “Bad\_Stale” tags.

It’s interesting that the folder structure is retained (groupID/nodeID/Node Info, etc) but the tags representing the metrics themselves are not retained across restarts.

---

<div class="post-metadata">

**Author:** ![wes0johnson](https://avatars.discourse-cdn.com/v4/letter/w/7ab992/32.png) [@wes0johnson](https://forum.inductiveautomation.com/u/wes0johnson)\
**Post date:** [May 18, 2021, 9:36pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785/5 "2021-05-18T21:36:03Z")

</div>

The removal of tags across restarts is sort of historical. In Ignition7, this was/is how the SimpleTagProvider in the Ignition API behaves. There is no way to retain tags across a module restart. However, the underlying config for all of those tags is retained. They’re just not visible in the tag browser.

In Ignition8, we have some more control. But, to stay consistent with the Ignition7 behavior we kept it the same. We had a lot of feedback (mostly negative) when we left them there across restarts in the initial versions of MQTT Engine for Ignition8. So, this is largely why it is that way now. It may be possible to make this configurable in Engine - I’ll add another backlog item for this.

---

<div class="post-metadata">

**Author:** ![321liftoff](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/321liftoff/32/27544_2.png) [@321liftoff](https://forum.inductiveautomation.com/u/321liftoff)\
**Post date:** [May 19, 2021, 1:03pm UTC](https://forum.inductiveautomation.com/t/mqtt-engine-auto-prune-removed-metrics/46785/6 "2021-05-19T13:03:34Z")

</div>

Thanks for the context, Wes. I appreciate the consideration.
