Monitoring Streams for Errors

Use error streams to monitor other streams for errors and the events that cause them.

Process

  1. Identify the project and the specific streams to monitor.
  2. Determine whether to use multiple error streams. Determine the visibility for each error stream.
  3. Create the error streams in that project.
  4. Display some or all of the information from the error streams in the error record, that is, information aggregated or derived from the error records.

Examples

In a project that has one input stream and two derived streams, create a locally visible error stream to monitor all three streams using:
CREATE ERROR STREAM AllErrors ON InputStream, DerivedStream1, DerivedStream2;
To keep a count of the errors according to the error code reported, add:
CREATE OUTPUT WINDOW errorHandlerAgg SCHEMA (errorNum integer, cnt long)
PRIMARY KEY DEDUCED
AS
SELECT e.errorCode AS errorNum, COUNT(*) AS cnt
FROM AllErrors e
GROUP BY e.errorCode
;
In a project that has three derived streams, create an externally visible error stream to monitor only the third derived stream (which calculates a volume weighted average price) using:
CREATE OUTPUT ERROR STREAM vwapErrors ON DerivedStream3;
To convert the format of the triggering record from binary to string, add:
CREATE OUTPUT vwapMessages SCHEMA (errorNum integer, streamName string, errorRecord string) AS
SELECT  e.errorcode AS errorNum,
        e.streamName AS streamName,
        recordDataToString(e.sourceStreamName, e.errorRecord) AS errorRecord
FROM vwapErrors e;
To convert the format of the triggering record from binary to record, add:
CREATE OUTPUT vwapMessages SCHEMA (errorNum integer, streamName string, errorRecord string) AS
SELECT  e.errorcode AS errorNum,
        e.streamName AS streamName,
        recordDataToRecord(e.sourceStreamName, e.errorRecord) AS errorRecord
FROM vwapErrors e;