How Can We Help?

Ingestion APIs of Heal help you ingest Metric data from any bespoke application into the Heal system via GRPC (http2).

Ingestion APIs Listing

  • Requests (Transaction) API
  • KPI API

Prerequisites

  1. Java in environment path is set.
  2. Protobuf-3.6.1 is installed, if not installed already install it now.

Protocol Buffer Installation

This section will guide you in installing Protocol Buffer.

  1. Download protobuf-3.6.1 and copy the build to the required location.
  2. Extract the download.
  3. Navigate to the source ‘src’ folder.
  4. Create an output folder to store the Java code to be generated from the Protobuf.
  5. Execute the following command in the terminal.

<path of source folder of pro>/protoc –java_out=<output file path> <protobuf source file path>

For Example:

/opt/heal/protobuf-version/src/protoc –java_out=/opt/heal/protobuff_output /opt/heal/protobufs/RPCServiceProtos.proto

Implementation of Protobuff Message

With the assumption agent has collected the XPT Transaction details in java Map (key-value pair) format You can write a method like the following convert map data into XPT proto message format.

public XpTMessageProtos.XpTMessage assemble(Map<String, String> txnCollectedData) { XpTMessageProtos.XpTMessage.Builder xpTMessageBuilder = XpTMessageProtos.XpTMessage.newBuilder() .setAgentUid(txnCollectedData.get(“AgentIdentifier”)) .setEndTimeInMilliseconds(Long.valueOf(txnCollectedData.get(“EndTimeInGMT”))) .setStartTimeInMilliseconds(Long.valueOf(txnCollectedData.get(“StartTimeInGMT”))) .setTxnId(txnCollectedData.get(“ROUTE_NAME”)) .setTxnType(XpTMessageProtos.XpTMessage.TxnType.valueOf(txnCollectedData.get(“txnType”))) .setStatus(XpTMessageProtos.XpTMessage.TxnStatus.valueOf(txnCollectedData.get(“STATUS”))) .putAllContext(txnCollectedData); return xpTMessageBuilder.build(); }

Method to Initialize GRPC Channel

To initialize the GRPC channel using the following method.

public void init(String grpcServerIp, int grpcServerPort, boolean isSSLEnabled, String certificateFilePath) { try { if(isSSLEnabled) { File certFile = new File(certificateFilePath); io.netty.handler.ssl.SslContext sslContext = null; if(certFile.exists()) { sslContext = GrpcSslContexts.forClient().sslProvider(SslProvider.OPENSSL).trustManager(certFile).build(); } else { sslContext = GrpcSslContexts.forClient().sslProvider(SslProvider.OPENSSL).build(); }channel = NettyChannelBuilder .forAddress((String) grpcServerIp, (Integer) grpcServerPort) .sslContext(sslContext) .build(); } else { channel = NettyChannelBuilder .forAddress((String) grpcServerIp, (Integer) grpcServerPort) .build(); } blockingStub = MessagePublisherGrpc.newBlockingStub(channel); } catch (Exception e) { } }

Input Parameters

ArgumentDescriptionMandatoryPredefined ValuesMore Info
grpcServerIpThe IP address or Hostname of the GRPC ServerYes
grpcServerPortPort number of the GRPC ServerYes
isSSLEnabledFlag to identify if the SSL is enabled on the GRPCYes0, 10= false, 1= true
certificateFilePathPath of the Certificate fileYes
## Method to Ingest Data to GRPC
To ingest XPT data to GRPC, you can use the following method.

public void sendOnNetwork(XpTMessageProtos.XpTMessage xpTMessage) { try { RPCServiceProtos.ResponseCode responseCode = blockingStub.publishXpTMessage(xpTMessage); logger.info(“XpT message is sent successfully and received response code ” + responseCode.getReturnCode().getValueDescriptor().toString() + ” from RPC server”); } catch (Exception e) { logger.error(“Exception is got while sending xpt message – ” + e.getMessage(), e); } }
 

Sample
Sample Message and Response for the data ingested to GRPC is as follows.

Request

Feb 07 2020 05:04:25.007 PM [grpc-default-executor-1] DEBUG c.a.a.grpc.server.util.GRPCUtils:23 – Received PSAgent Message agentUid: “ase5434-234rc234-4234r452-qwerq” serverIp: “172.16.1.130” serverPort: 7543 clientIp: “192.168.57.59” clientPort: 4734 transactionType: HTTP responseTime { responseTimeType: DC startTimeInGMT: “2017-07-06 01:58:01.002” endTimeInGMT: “2017-07-06 01:58:01.787” responseInMicroseconds: 785000 responseStatusTag: FAIL } http { url: “http://xrtravels.com/check” method: POST requestSizeInBytes: 1589 responseSizeInBytes: 256 responseBody: “ROUTE_NAME=fsbwebservie&REQUESTUUID=Req_1470370115996&TRANSTAT=failure&FAILSTAT=ONSNONFAT-505&REQUESTTYPE=0” } context { key: “RespCode” value: “0” } context { key: “TRANSTAT” value: “failure” } context { key: “fileName” value: “/home/ankurkumar/Desktop/VJLogger/ExampleLogs/FILogs/Instance2/access_fi_log.txt” } context { key: “REQUESTUUID” value: “Req_1470370115996” } context { key: “REQUESTTYPE” value: “0” } context { key: “TXNType” value: “FI” } context { key: “ROUTE_NAME” value: “fsbwebservie” } context { key: “Type” value: “3” } context { key: “TimeZone” value: “+05:30” } context { key: “TXNTimeDiff” value: “500” } context { key: “SIp” value: “172.16.1.130” } context { key: “FAILSTAT” value: “ONSNONFAT-505” }

Response
Sending response code [OK] to the client

Transaction API

Transaction API lets you ingest the Request aka Transaction into the Heal via GRPC. The agent sending the data is expected to send the details as specified in the Message format below. Also, ensure the values sent to match the data type specified in the message format.

Message Format

message PSAgentMessage { string agentUid = <Agent identifier>; string serverIp = <Server IP collected by the Agent>; int32 serverPort = <Server Port collected by the Agent>; string clientIp = <Client IP collected by the Agent>; int32 clientPort = <Client Port collected by the Agent>; TransactionType transactionType = <Value of the TransactionType>; repeated ResponseTime responseTime = <Transactions response time as in the ResponseTime format>; oneof transaction { Http http = 8; Tcp tcp = 9; } string txnId = <Id of the transaction as in the Heal database>; map<string, string> context = 11; enum TransactionType { TCP = 0; HTTP = 1; } } message ResponseTime { ResponseTimeType responseTimeType = <Value of the ResponseTimeTupe>; string startTimeInGMT = <Start time of the transaction in GMT>; string endTimeInGMT = <End time of the transaction in GMT>; int32 responseInMicroseconds = <Transaction response time in Microseconds>; ResponseStatusTag responseStatusTag = <Value of the ResponseStatusTag; enum ResponseTimeType { RENDER = 0; DC = 1; EUE0 = 2; EUE1 = 3; EUE2 = 4; L0 = 5; L1 = 6; L2 = 7; L3 = 8; L4 = 9; } enum ResponseStatusTag { UNKNOWN = 0; GOOD = 1; FAIL = 2; TIMEOUT = 3; SLOW = 4; } } message Http { string url = <HTTP Transaction URI>; Method method = <Value for the HTTP Transaction Method>; string header = <HTTP Transaction Header details>; string requestBody = <HTTP Transaction Request Body details>; int32 responseCode = <HTTP Response Code>; int32 requestSizeInBytes = <Size of the Request in Bytes>; int32 responseSizeInBytes = <Size of the Response in Bytes>; string responseBody = <HTTP Transaction Response Body Details>; enum Method { OTHER = 0; GET = 1; HEAD = 2; POST = 3; PUT = 4; DELETE = 5; CONNECT = 6; OPTIONS = 7; TRACE = 8; } } message Tcp { string requestBody = <TCP Transaction Request Body details>; string responseBody = <TCP Transaction Response Body details>; int32 requestSizeInBytes = <Size of the Request in Bytes>;; int32 responseSizeInBytes = <Size of the Response in Bytes>; }

Input Parameters

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
agentUidValid agent identifier for the agentYesThe identifier for the agent must be present in the Heal database
serverIpIP Address or Hostname of the Server which serves the RequestYesThe target server IP where the Agent is present or collects data from
serverPortPort number on which the Server listensYesTarget Server Port on which the transaction is happening
clientIpIP Address or Hostname of the Client which sends the RequestYesIP address or Hostname of the Client that is sending the requests to the server.
clientPortPort number from which the request is sent.YesClient Server Port from where the transactions started.
transactionTypeValue of the TransactionTypeValues defined under “enum TransactionType”YesTCP & HTTP are the supported Transaction Types
responseTimeTransactions response time as in the ResponseTime formatValues defined under “message ResponseTime”Yescell
txnIdId of the transaction as in the Heal databaseYescell
enum TransactionTypeContains the list of Transaction type and value for it.TCP = 0;
HTTP = 1;YesDo not change the values.

Message Response Time

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
responseTimeTypeValue of the ResponseTimeTypeValues defiened under “enum ResponseTimeType”Yescell
startTimeInGMTStart time of the transaction in GMTYesTime when the request(transaction) started
endTimeInGMTEnd time of the transaction in GMTYesTime when the request(transaction) ended
responseInMicrosecondsTransaction response time in MicrosecondsYesResponse time must in Microseconds, hence the agent sending the details must send accordingly.
responseStatusTagValue of the ResponseStatusTagValues defined under “enum ResponseStatusTag”Yescell
enum ResponseTimeTypeContains the list of Response Types and value for it.RENDER = 0;
DC = 1;
EUE0 = 2;
EUE1 = 3;
EUE2 = 4;
L0 = 5;
L1 = 6;
L2 = 7;
L3 = 8;
L4 = 9;YesDo not change the values.
enum ResponseStatusTagContains the list of Response tags and value for it.UNKNOWN = 0;
GOOD = 1;
FAIL = 2;
TIMEOUT = 3;
SLOW = 4;YesDo not change the values.

message Http

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
urlHTTP Transaction URIYesThe URI of the transaction. (example: /flights/flightbooking)
methodValue for the HTTP Transaction MethodValues defiened in the “enum Method”Yescell
headerHTTP Transaction Header detailsYes
requestBodyHTTP Transaction Request Body detailsYescell
responseCodeHTTP Response CodeYes
requestSizeInBytesSize of the Request in BytesYes
responseSizeInBytesSize of the Response in BytesYes
responseBodyHTTP Transaction Response Body DetailsNo
enum MethodContains the list of HTTP Methods and its values.OTHER = 0;GET = 1; HEAD = 2; POST = 3; PUT = 4; DELETE = 5; CONNECT = 6; OPTIONS = 7; TRACE = 8;Yes

message Tcp

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
requestBodyTCP Transaction Request Body details
responseBodyTCP Transaction Response Body details
requestSizeInBytesSize of the Request in Bytes
responseSizeInBytesSize of the Response in Bytes

KPI API

Performance metric KPIs collected by your agent can be ingested in the Heal by KPI API. The message format for the KPI to sent by the agent is expected as follows.

Message format for KPI API

message KPIAgentMessage { string agentUid = <Agent Identifier>;message KpiData { int32 kpiUid = <Unique Identifier of KPI>; string timeInGMT = <Time in GMT format>; KpiType kpiType = <Type of the KPI>; string kpiName = <Name of the KPI>; string kpiGroupName = <Name of the KPI Group>; oneof value { string val = 6; GroupKpi groupKpi = 7; WatcherKpiValue watcherKpiValue = 8; } string errorCode = <Error code>; boolean isKpiGroup = <Flag to know if the KPI belongs to a group>; int32 collectionInterval = <Data collection frequency>;enum KpiType { Core = 0; Availability = 1; Forensic = 2; ConfigWatch = 3; FileWatch = 4; ComputedAvailability =5; }message GroupKpi { map<string, string> pairs = 1; }message WatcherKpiValue { map<string, GroupKpi> keyValuePair = 1; } } message Instance { string instanceId = <Identifier of the Component instance>; repeated KpiData kpiData = 2; }repeated Instance instances = 2; }

Inputs Required

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
string agentUidValid agent identifier for the agentYesThe identifier for the agent must be present in the Heal database

message KpiData

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
kpiUidUnique Identifier of KPIYesKPI ID for the Heal database
timeInGMTTime in GMT formatYesThe time when the KPI was collected
kpiTypeType of the KPIYescell
kpiNameName of the KPIYescell
kpiGroupNameName of the KPI GroupValues as defined in enum KpiTypeYes
errorCodeError codeYesYesValues of Error codes present in the Heal database must be used.
isKpiGroupFlag to know if the KPI belongs to a group0, 1Yes0 = false, 1 = true
collectionIntervalData collection frequencyYesData collection interval configured for the KPI from Heal database
enum KpiTypeContains the list KPI Types supported by HealCore = 0;
Availability = 1;
Forensic = 2;
ConfigWatch = 3;
FileWatch = 4;
ComputedAvailability =5;YesDo not change the values

message Instance

NameDescriptionDefault ValuePredefined ValuesMandatoryMore Info
instanceIdinstanceIdYesInstance id for the component must be obtained from Heal database
Table of Contents