You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we have a CAP/Fiori Elements project that uses these packages for telemetry:
"@cap-js/telemetry": "^1.1.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.55.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.55.0",
For code coverage measurement, we are using "jest": "^29.7.0".
As the log gets very long, we wanted to switch off telemetry during the code coverage measurement. The npm script looks like this:
"code-coverage": "NO_TELEMETRY=true node --experimental-vm-modules ./node_modules/.bin/jest --coverage",
Unfortunately, we got a flickering in our unit tests (red/green) where the cds log is read to check audit logging. It seemed as if an asynchronous request was not finished, but required. When we removed NO_TELEMETRY again, everything works fine.
Please, check. It took me quite some time to find where the issue comes from.
Best regards,
Christine
Some more information:
The test:
it('should log an audit log message when a visitor is read', async function () {
// Read the updated poetry slam in draft mode
const visitors = await GET(/odata/v4/visitorservice/Visitors?$top=1);
expect(visitors.data.value.length).to.greaterThan(0);
const auditLog = filterLog(cdsTestLog);
expect(auditLog.length).to.eql(1);
expect(auditLog[0].type).to.eql('SensitiveDataRead');
expect(auditLog[0].attributes[0]).to.eql('email');
});
The filterLog method:
function filterLog(log) {
// Filter the audit log entries
const auditLogs = log.output
.split(/^[/m)
.filter((log) => log.startsWith('audit-log'));
// Extract the type and details
const auditLogsInfo = auditLogs.map((log) =>
log.replaceAll(/\s/g, '').match(/-(\w+):.attributes:[(.)]/)
);
// Keep the type and extract the affected attributes
const auditLogsTypeAndAttributes = auditLogsInfo.map((info) => {
return {
type: info[1],
attributes: [...info[2].matchAll(/name:'(\w+)'/g)].map((attr) => attr[1])
};
});
return auditLogsTypeAndAttributes;
}
The text was updated successfully, but these errors were encountered:
Hello,
we have a CAP/Fiori Elements project that uses these packages for telemetry:
"@cap-js/telemetry": "^1.1.0",
"@opentelemetry/exporter-metrics-otlp-grpc": "^0.55.0",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.55.0",
For code coverage measurement, we are using "jest": "^29.7.0".
As the log gets very long, we wanted to switch off telemetry during the code coverage measurement. The npm script looks like this:
"code-coverage": "NO_TELEMETRY=true node --experimental-vm-modules ./node_modules/.bin/jest --coverage",
Unfortunately, we got a flickering in our unit tests (red/green) where the cds log is read to check audit logging. It seemed as if an asynchronous request was not finished, but required. When we removed NO_TELEMETRY again, everything works fine.
Please, check. It took me quite some time to find where the issue comes from.
Best regards,
Christine
Some more information:
The test:
it('should log an audit log message when a visitor is read', async function () {
// Read the updated poetry slam in draft mode
const visitors = await GET(
/odata/v4/visitorservice/Visitors?$top=1
);expect(visitors.data.value.length).to.greaterThan(0);
const auditLog = filterLog(cdsTestLog);
expect(auditLog.length).to.eql(1);
expect(auditLog[0].type).to.eql('SensitiveDataRead');
expect(auditLog[0].attributes[0]).to.eql('email');
});
The filterLog method:
function filterLog(log) {
// Filter the audit log entries
const auditLogs = log.output
.split(/^[/m)
.filter((log) => log.startsWith('audit-log'));
// Extract the type and details
const auditLogsInfo = auditLogs.map((log) =>
log.replaceAll(/\s/g, '').match(/-(\w+):.attributes:[(.)]/)
);
// Keep the type and extract the affected attributes
const auditLogsTypeAndAttributes = auditLogsInfo.map((info) => {
return {
type: info[1],
attributes: [...info[2].matchAll(/name:'(\w+)'/g)].map((attr) => attr[1])
};
});
return auditLogsTypeAndAttributes;
}
The text was updated successfully, but these errors were encountered: