sonar-esql-plugin icon indicating copy to clipboard operation
sonar-esql-plugin copied to clipboard

Code coverage via trace files in txt format

Open abhi-malhotra opened this issue 3 years ago • 4 comments

With App Connect Enterprise 11 onwards, user trace is generated as plain text format instead of xml. Plugin currently ingests trace in xml format for code coverage.

From App Connect Enterprise infocenter: When trace is active, information is recorded in the user trace log files in plain text format.

https://www.ibm.com/docs/en/app-connect/11.0.0?topic=trace-user

Are there any plans to ingest traces in the new format?

abhi-malhotra avatar Jan 13 '22 21:01 abhi-malhotra

There are no plans, yet.

First I need to analyse the new format and see how we can find out what ESQL code has been executed.

ThomasPohl avatar Jan 14 '22 05:01 ThomasPohl

@ThomasPohl, I was looking into the new trace format and was able to parse it with below changes.

In file TraceFileReader, changed PATTERN_REGEX to ".* at \((.), (\w+)\.\w+\).".

Next change was in readLine function for identifying begin and end statement.

int statementBegin = line.indexOf("'", line.indexOf("'", (line.indexOf("'") + 1) +1) + 1); int statementEnd = line.lastIndexOf("'", line.indexOf(" at "));

These 3 changes allowed the new format to be parsed. Attaching the trace file generated by App Connect Enterprise v12.

Is there a way to incorporate these changes keeping the plugin backward compatible.

integration_server.intserver.userTrace.0.txt

abhi-malhotra avatar Jan 18 '22 22:01 abhi-malhotra

@abhi-malhotra Thanks for your suggestions. I made the regex a little more general. Now it should work for both plain text formats.

ThomasPohl avatar Jul 23 '22 05:07 ThomasPohl

@abhi-malhotra Parsing oof the new coverage-format is part of the current release candidate. It would be great if you could check, if it works for you.

ThomasPohl avatar Oct 08 '23 08:10 ThomasPohl