I'm working on a couple tasks related to historians and history queries, and have encountered some behaviors of remote tag providers (RTPs) that have me stymied:
- There's no public way to retrieve the gateway name that a RTP is pointing at, nor any public way to retrieve the far end's real tag provider name.
(Reflection has exposed com.inductiveautomation.ignition.gateway.tags.distributed.client.RemoteTagProvider
and com.inductiveautomation.metro.api.ServerId
to me, and a number of private fields in the former that look promising, so all is not lost.)
-
The default behavior of RTPs when history is queried for paths of the form
[rtpName]some/path
is to pass the query to the remote end and make it do all of the work. (Not sure if the local end does any caching.) -
An optional behavior of RTPs when history is queried, given appropriate configuration settings for the RTP, is to divert all queries to a local database connection's history provider using a full historical (qualified) path of the form:
histprov:localDB:/drv:remoteGWName:realTagProvider:/tag:some/path
This latter behavior allows a front-end gateway (presumably a UI gateway doing charting and data analysis tasks) to get history directly from the correct database, by having its own connection. Or, perhaps, having a connection to a live database replica that is co-located with the front-end gateway. Since Ignition's historian places source gateway and tag provider metadata into sqlt_*
tables, a full historical tagpath constructed as above will deliver the same result as a query over the GAN, without the GAN traffic. And if via a co-located replica, without any extra WAN traffic to the source database at all.
(I strongly recommend that my clients using front-end/back-end configurations use database replicas, so that heavy query loads for UIs and data mining do not impact back-end history storage and other close-coupled productions tasks.)
But there's a doozy of a catch. If the source gateway uses multiple database connections for storing different kinds of history, or non-database history providers (3rd parties), you have to choose:
-
Use the GAN for all history, unconditionally, or
-
Use one local DB to handle one DB storage provider in that remote gateway's tag provider, breaking all of the others.
-
Or, if willing to dive under the hood and use reflection to extract the remote gateway name and real tag provider name, manually construct full historical tagpaths using each tag's historian properties. (If you do this, you can leave the RTP configured for the GAN, and only manually construct some local diversions--the ones you've created local connections for.)
That last approach also works for 3rd party historians, modulo possible alternate historical path syntax.
And that sets up my questions:
-
Has anyone else bumped into this and worked out any solutions?
-
Has IA noticed this and made a so-far private plan to mitigate? v8.3?
-
Am I missing any public methods for constructing the
:/drv:gateway:realProvider
fragment for target tags in a remote tag provider? -
Has anyone subclassed IA's RTP in a java module to offer better options? (Perhaps a mapping for tags' storageProvider names to local history provider names? Perhaps with a fallback to GAN when a particular provider isn't mapped?)
Other suggestions welcome, of course.