PackedHistoricalTagValue uses Deprecated TagPath

The docs for PackedHistoricalTagValue show a constructor that uses a TagPath Object.

I'm trying to store data in the tag historian tables using 'virtual' tags to use the pre-existing Power Chart component to display data easily along with other tags data.

Does the following show the correct way to instantiate a TagPath object? I have the following function, and it seems like these tags are making their way to the memory buffer without being quarantined, but I do not see any rows being added to my historian tables.

private static HistoryManager history;

private static String tagProviderName = "Completions";

private static void storeTagValue(String jobId, String apiNum, String key, Object value, Date timestamp, DataTypeClass dataType) throws Exception {
        TagPath tagPath = TagPathParser.parse(String.format("[%s]/%s/%s", tagProviderName, jobId, apiNum, key));
        PackedHistoricalTagValue tagValue = new PackedHistoricalTagValue(
                tagPath,
                dataType,
                InterpolationMode.Discrete,
                TimestampSource.Value,
                value,
                DataQuality.GOOD_DATA,
                timestamp
        );
        history.storeHistory("mocazuresql01_SCADA", tagValue);
    }

Am I missing something obvious with this Class?

I haven't quite figured it out yet, but I've made a bit of progress. I followed the advice from this old forum post and wrapped my historical data in a BasicScanClassHistorySet, and that managed to start storing data points, but it's not setting up the entries in sqlth_te, sqlth_scinfo, sqlth_sce, and sqlth_drv correctly.

Specifically, it is populating the entries with null ID's, making the historical data impossible to reference.

sqlth_te:

sqlth_scinfo:

sqlth_sce:
image

sqlth_partitions:

sqlth_drv:
image

sqlt_data:

Here is the current code:

private static void storeTagValue(String jobId, String apiNum, String key, Object value, Date timestamp, DataTypeClass dataType) throws Exception {
        if (value != null) {
            BasicScanclassHistorySet bshs = new BasicScanclassHistorySet(tagProviderName, "googlePubSub", 0);
            TagPath tagPath = TagPathParser.parse(String.format("completions/%s/%s/%s", jobId, apiNum, key));
            PackedHistoricalTagValue tagValue = new PackedHistoricalTagValue(
                    tagPath,
                    dataType,
                    InterpolationMode.Discrete,
                    TimestampSource.Value,
                    value,
                    DataQuality.GOOD_DATA,
                    timestamp
            );
            bshs.add(tagValue);
            if(history.getStatusInfo("mocazuresql01_SCADA").get(0).isAvailable()) {
                history.storeHistory("mocazuresql01_SCADA", bshs);
            } else {
                throw new Exception("Store and Forward is not available");
            }
        }
    }

@pturmel @Kevin.Herron @PGriffith Sorry to ping you guys, but do any of you have any experience with the Ignition SDK and the Tag Historian? The JavaDocs aren't doing me many favors regarding my issues.
You guys are my go-to with the hard questions... sorry.

No need to ever ping me. I read everything here, and didn't have an answer for you. (I do have some experience with History sinks, but they didn't work the way I wanted. I'm proceeding with a design based on a TagActor.)

The storeTagHistory function creates a BasicTagGroupHistorySet (with an apparently special tag group name):

BasicTagGroupHistorySet data = new BasicTagGroupHistorySet(tProv, "_existing_", 0);

Then adds PackedHistoricalTagValues to it:

com.inductiveautomation.ignition.common.sqltags.model.TagPath oldStyleTagPath =
    com.inductiveautomation.ignition.common.sqltags.parser.TagPathParser.parse(tProv, paths[i]);
data.add(new PackedHistoricalTagValue(oldStyleTagPath, getDataType(v),
    InterpolationMode.Analog_Compressed, TimestampSource.Value, v, q, ts));

Then you pass data to the StoreAndForwardManager you got from the GatewayContext:

getStoreAndForwardManager().storeData(hProv, data);

Disclaimer: All I'm doing is reading the code for an existing solution; I can guarantee you two things:

  1. I'm not an expert in this area, so I can't help you if you need to deviate from this significantly.
  2. There's going to be a new, preferred API to do this in 8.3. The existing API will (probably) continue to work, for backwards compatibility, but some amount of migration may be necessary.