Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AF SDK Reference

PISystem.GetClientRpcMetrics Method

  • Last UpdatedNov 18, 2025
  • 4 minute read
PISystem.GetClientRpcMetrics Method
Get the remote procedure call metrics to the server for this PISystem.

Namespace:  OSIsoft.AF
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182

Syntax

public AFRpcMetric[] GetClientRpcMetrics()
Public Function GetClientRpcMetrics As AFRpcMetric()

Dim instance As PISystem
Dim returnValue As AFRpcMetric()

returnValue = instance.GetClientRpcMetrics()
public:
array<AFRpcMetric>^ GetClientRpcMetrics()
member GetClientRpcMetrics : unit -> AFRpcMetric[] 

Return Value

Type: AFRpcMetric
Returns an array of AFRpcMetric values that represent the remote procedure call metrics since the PISystem was instantiated.

Remarks

This will return the remote procedure call metrics for this PISystem in the client communicating with the server. The execution time reported in the metrics is the total execution time to make the call to the server including the time to communicate with the server.

You can use the SubtractList(IListAFRpcMetric, IListAFRpcMetric) method to return the difference between two arrays of AFRpcMetric values. This is useful to determine the metrics since the last call by subtracting the array returned by the previous call to this method from the current array of metrics.

Note Note
Since retries occur at the server and not the client level, client RPC metrics will have a RetryCount of zero.

Examples

// This example demonstrates how to get and display RpcMetrics

// Get the Database
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
AFDatabase myDB = myPISystem.Databases.DefaultDatabase;

// Get current metrics
AFRpcMetric[] lastClientMetrics = myPISystem.GetClientRpcMetrics();
AFRpcMetric[] lastServerMetrics = myPISystem.GetRpcMetrics();

// Do some operations which load objects from the server
AFNamedCollectionList<AFElement> allElements =
    AFElement.LoadElementsToDepth(myDB.Elements, true, 4, 2000);

// Get new client metrics and display results
AFRpcMetric[] newClientMetrics = myPISystem.GetClientRpcMetrics();
IList<AFRpcMetric> diffClientMetrics = AFRpcMetric.SubtractList(newClientMetrics, lastClientMetrics);
Console.WriteLine("Client RPC, Count, RetryCount, Duration(ms), PerCall(ms)");
if (null != diffClientMetrics)
{
    foreach (AFRpcMetric item in diffClientMetrics)
    {
        Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}",
            item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall);
    }
}

// Get new server metrics and display results
Console.WriteLine();
AFRpcMetric[] newServerMetrics = myPISystem.GetRpcMetrics();
IList<AFRpcMetric> diffServerMetrics = AFRpcMetric.SubtractList(newServerMetrics, lastServerMetrics);
Console.WriteLine("Server RPC, Count, RetryCount, Duration(ms), PerCall(ms)");
if (null != diffServerMetrics)
{
    foreach (AFRpcMetric item in diffServerMetrics)
    {
        Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}",
            item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall);
    }
}
' This example demonstrates how to get and display RpcMetrics

' Get the Database
Dim myPISystems As New PISystems
Dim myPISystem As PISystem = myPISystems.DefaultPISystem
Dim myDB As AFDatabase = myPISystem.Databases.DefaultDatabase

' Get current metrics
Dim lastClientMetrics() As AFRpcMetric = myPISystem.GetClientRpcMetrics
Dim lastServerMetrics() As AFRpcMetric = myPISystem.GetRpcMetrics

' Do some operations which load objects from the server
Dim allElements As AFNamedCollectionList(Of AFElement) =
    AFElement.LoadElementsToDepth(myDB.Elements, True, 4, 2000)

' Get new client metrics and display results
Dim newClientMetrics() As AFRpcMetric = myPISystem.GetClientRpcMetrics
Dim diffClientMetrics As IList(Of AFRpcMetric) = AFRpcMetric.SubtractList(newClientMetrics, lastClientMetrics)
Console.WriteLine("Client RPC, Count, RetryCount, Duration(ms), PerCall(ms)")
If (Not (diffClientMetrics) Is Nothing) Then
    For Each item As AFRpcMetric In diffClientMetrics
        Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}",
                          item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall)
    Next
End If

' Get new server metrics and display results
Console.WriteLine()
Dim newServerMetrics() As AFRpcMetric = myPISystem.GetRpcMetrics
Dim diffServerMetrics As IList(Of AFRpcMetric) = AFRpcMetric.SubtractList(newServerMetrics, lastServerMetrics)
Console.WriteLine("Server RPC, Count, RetryCount, Duration(ms), PerCall(ms)")
If (Not (diffServerMetrics) Is Nothing) Then
    For Each item As AFRpcMetric In diffServerMetrics
        Console.WriteLine("{0}, {1}, {2}, {3:F1}, {4:F3}",
                          item.Name, item.Count, item.RetryCount, item.Milliseconds, item.MillisecondsPerCall)
    Next
End If

No code example is currently available or this language may not be supported.

No code example is currently available or this language may not be supported.

Version Information

AFSDK

Supported in: 3.1.1, 3.1.0, 3.0.2, 3.0.1, 3.0.0, 2.10.11, 2.10.5, 2.10.0, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6

See Also

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in