Metadata Endpoint Limiting Results

We have an application that relies on the response from the metadata endpoint, as shown in the following example request:

localhost:6155/historian/metadata/read/json

However, the response appears to be limited.

Note 1: We have 20,581 measurements registered in the OH2 under the Metadata > Measurements tab, but only the first 422 are being returned when calling the 6155 port.
Note 2: We are observing the same behavior with openPDC (port 6151) on this server.

I would like to receive all measurements, if possible, when using localhost:6155/historian/metadata/read/json.
Does anyone have any ideas regarding the cause of this limitation?

Thank you in advance for your support.

Hello Renan_Pires,

I have a feeling this is due to a gap in the historian metadata IDs. Likely, you do not have a measurement configured in your system with ID 423, and this is causing the metadata query to stop at that point, thinking it’s reached the end of the archive.

This throws a bit of a wrench in my theory, though. Where is the openPDC’s metadata coming from? Is it hosting its own openHistorian 1.0 archive? The openHistorian 1.0 archive is supposed to insert blank records into the data set wherever there is a gap in historian IDs.

Thanks,
Stephen

Hello StephenCWills,

Thank you for your quick response!

There is indeed a gap in the historian metadata IDs. We don’t have a measurement configured with ID 423.

What additional information can I provide to help identify the cause of this gap and assist in finding a solution?

Best regards,
Renan Pires

The issue occurs due to a mismatch between the file formats used by openHistorian 1.0 and the scalability improvements we made in openHistorian 2.0. The legacy code returns blank metadata records whereas the new code returns null. The code basically looks like this…

int historianID = 0;
while (true)
{
    Metadata metadata = Archive.ReadMetadata(++historianID);
    if (metadata == null)
        break;
    metadataRecords.Add(metadata);
}

(The actual code: MetadataService.cs#L183-L196)

As you can see, it’s reading metadata records sequentially from zero, and at the first gap it encounters it’s going to bail. Ideally, we would just read all the metadata that exists instead of blindly reading sequentially and filling in gaps with blank records.

If you’re proficient with C#, you can try to code up a fix and submit a pull request. Otherwise, you’ll just have to wait for us to come up with something ourselves.

I would like to issue a small correction to my previous message.

In Note 2, I mentioned that we were observing the same behavior with openPDC (port 6151) on this server. This was a mistake.

The correct statement is:
Note 2: It’s not possible to test the historian/metadata response from openPDC on this server because openPDC is configured not to store historian data. It directly forwards the received STTP stream to openHistorian 2.

I apologize for any confusion caused, and thank you again for your assistance!

Best regards,
Renan Pires