# What is the best way to query all tags using a certain HistoryProvider?

**URL:** <https://forum.inductiveautomation.com/t/what-is-the-best-way-to-query-all-tags-using-a-certain-historyprovider/109506>\
**Category:** Module Development\
**Created:** [August 7, 2025, 9:30pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-query-all-tags-using-a-certain-historyprovider/109506 "2025-08-07T21:30:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew.jank](https://avatars.discourse-cdn.com/v4/letter/a/e9a140/32.png) [@andrew.jank](https://forum.inductiveautomation.com/u/andrew.jank)\
**Post date:** [August 7, 2025, 9:30pm UTC](https://forum.inductiveautomation.com/t/what-is-the-best-way-to-query-all-tags-using-a-certain-historyprovider/109506/1 "2025-08-07T21:30:51Z")

</div>

I am trying to get all the tags using my history provider and send them to my historian during startup. Is there a better way I can achieve this than the following? I am doing this for each tag provider during startup() for my Gateway module.

```python
private void browseNode(TagProvider provider, TagPath parentPath, JSONArray tags) throws Exception {
        Results<NodeDescription> results = provider.browseAsync(parentPath, BrowseFilter.NONE).get(30, TimeUnit.SECONDS);
        if(results.getResultQuality().isNotGood()) {
            throw new Exception("Bad quality results: "+ results.getResultQuality().toString());
        }

        Collection<NodeDescription> nodes = results.getResults();
        assert nodes != null;
        for (NodeDescription node : nodes) {
            var tagPath = node.getFullPath();
            // TODO get all at once?
            var tagConfig = provider.getTagConfigsAsync(List.of(tagPath), true, false).get().get(0);
            var historyProvider = tagConfig.getOrDefault(WellKnownTagProps.HistoryProvider);
            if (historyProvider != null && historyProvider.equalsIgnoreCase(MyHistoryModule.TypeId)) {
                var tagId = tagConfig.get(MyHistoryModule.TagIdProperty);
                tags.put(Utility.getTagJsonObject(tagId, tagPath, node.getDataType()));
            }

            // Browse child nodes, but not Document nodes such as UDT parameters
            if (node.hasChildren() && DataType.Document != node.getDataType()) {
                TagPath childPath = parentPath.getChildPath(node.getName());
                browseNode(provider, childPath, tags);
            }
        }
    }

```
