Skip to content

Expose internal/external metadata flags in Config to prevent empty external metadata #11

Description

@ritchiecarroll

When a Python subscriber connects to the C# STTP publisher, metadata for external measurements can be silently excluded. Python defines OperationalModes.RECEIVEINTERNALMETADATA and RECEIVEEXTERNALMETADATA, but DataSubscriber._send_operationalmodes() sends neither flag, and neither Config nor Settings exposes an option to enable them.

The C# publisher's AcquireMetadata() interprets this combination by applying Internal <> 0 to MeasurementDetail and, unless MutualSubscription is enabled, OriginalSource IS NULL to DeviceDetail. Consequently, an external-only input selection produces an empty measurement metadata table even when the publisher's SQL returns the intended records.

Reproduction and confirmed workaround

  1. Connect a Python Subscriber with the default Config to a C# STTP publisher whose selected measurements are external (Internal=0).
  2. Request metadata, as the subscriber does automatically by default.
  3. Observe that the returned MeasurementDetail table is empty.
  4. Add the following flags in _send_operationalmodes() before sending DEFINEOPERATIONALMODES, then reconnect:
operationalModes |= OperationalModes.RECEIVEINTERNALMETADATA
operationalModes |= OperationalModes.RECEIVEEXTERNALMETADATA

Enabling these flags was confirmed to resolve the issue in the affected runtime. Offline examination of the corresponding database also showed that the publisher SQL selected 19 external measurements, 1 device, and 6 phasors; the existing metadata inclusion filters explain why those records were excluded. A version row can remain, so a successful response or positive aggregate metadata count does not establish that measurement metadata was received.

Requested change

Expose internal/external metadata inclusion as supported Python connection configuration, equivalent to the C# subscriber options:

config = Config(
    receiveinternalmetadata=True,
    receiveexternalmetadata=True,
)
subscriber.connect("publisher:port", config)

Suggested implementation:

  • Add documented options and defaults to Config/Defaults.
  • Propagate them to DataSubscriber in Subscriber._connect().
  • Set the corresponding OperationalModes bits in _send_operationalmodes(), including on reconnect.
  • Document the chosen defaults and their compatibility implications. Explicit configuration should allow external metadata regardless of the default policy.
  • Add tests for flag combinations and configuration propagation, ensuring compression/version/encoding bits are preserved.

Relevant source

Config.metadatafilters cannot provide this behavior: those expressions further restrict metadata and do not override the internal/external inclusion flags. Currently, an application must modify the library or intercept the outgoing operational-mode command to request both categories.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions