Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

February Developer Challenge - CAP Plugins: Week 4

thomas_jung
Developer Advocate
Developer Advocate
8,330

If you missed week 1, you could find all the details: here
If you missed week 2, you could find all the details: here
If you missed week 3, you could find all the details: here

Now that the challenge is complete: here is my sample solution: jung-thomas/dev-challenge-feb-2024: Developer Challenge February 2024 (github.com)

For the final week we are going to go all in. We have several remaining plugins and your challenge this week is to integrate all of them into your application.

Audit Logging

The new Audit Log plugin provides out-of-the box support for logging personal data-related operations with the SAP Audit Log Service. All we need is annotations of respective entities and fields.

https://github.com/cap-js/audit-logging

Add the Audit Logging plugin to your application and add Personal Data Annotations to the Books entity. Share your screenshot of the audit entries after accessing the entity. 

auditLog.png

Bonus: Add a custom audit log entry when the submitOrder action is triggered 
auditLog2.png

Notifications

The Notifications plugin provides integration with the SAP Alert Notifications service to send notifications via email, Slack, Microsoft Teams, or SAP Fiori notifications. The client is implemented as a CAP service, which gives us a very simple programmatic API

https://github.com/cap-js/notifications

Add the Notifications plugin to your application. Throw a notification every time ListOfBooks entity is read and a discount has been applied. Post a screenshot of your notification in the log. 
notificationService.png

Telemetry

The Telemetry plugin provides observability features such as tracing and metrics, including automatic OpenTelemetry instrumentation. Simply add the plugin to your project and you will find telemetry output written to the console

https://github.com/cap-js/telemetry

Add the Telemetry plugin to your application. Post a screenshot of the telemetry output in our log.

telemetry.png

26 REPLIES 26
Read only

satya-dev
Participant
Read only

brunonalon
Explorer
Read only

smok1
Explorer
7,876

Audit Logging:

smok1_0-1709202715154.png

Bonus: Submit Order:

smok1_1-1709202750592.png

Notifications:

smok1_2-1709202783606.png

Telemetry:

smok1_3-1709202827028.png

 

 

 

Read only

Former Member
Read only

ajmaradiaga
Developer Advocate
Developer Advocate
7,663

CAP Plugins - screenshots

Audit LoggingAudit Logging

 

NotificationNotification

TelemetryTelemetry

Read only

SandipAgarwalla
Active Contributor
7,594

Does it matter where you write the annotations for these plug-ins? I added annotations for audit log, but I can not see those details in console when I access the entity. 

Thanks

Read only

7,579

I had the same issue. Had to debug the plugin to find out why. There must be at least a 

@PersonalData.IsPotentiallySensitive annotation for it to work. It won't work if only 
@PersonalData.IsPotentiallyPersonal exist, which i find it weird. Not sure if this is a bug or by design?
Maybe @thomas_jung can shed some light.
Read only

thomas_jung
Developer Advocate
Developer Advocate
7,435

Sounds like you generally got your solution. It shouldn't matter where you place your annotations as long as the file is reachable by the CDS compiler. I will share my solution. I did just happen to use IsPontentiallyPersonal and IsPotentiallySensitive on the same entity. I didn't know of any requirement to have both; maybe it was just dumb luck on my part. I don't think it's supposed to be a requirement to have both on the same entity.  There is an example in the documentation that only has IsPotentiallyPersonal. 

Spoiler
//Audit Log
annotate Authors with @PersonalData: {
  DataSubjectRole : 'Author',
  EntitySemantics : 'DataSubject'
}{
  ID @PersonalData.FieldSemantics: 'DataSubjectID';
  name @PersonalData.IsPotentiallyPersonal;
  dateOfBirth @PersonalData.IsPotentiallySensitive;  
}
Read only

7,545

The example on the plugin documentation is not complete. It is missing the DataSubjectRole and EntitySemantics on the annotation.

Here you can find some more complete documentation about the plugin.

https://cap.cloud.sap/docs/guides/data-privacy/annotations#annotated-model

 

Read only

Ruthiel
Product and Topic Expert
Product and Topic Expert
7,577
  • Audit-log:
    Ruthiel_1-1709290626372.png

     

  • Notifications:
    Ruthiel_2-1709290655075.png

     

  • Telemetry:
    Ruthiel_3-1709290678539.png

     

Thanks a lot @thomas_jung for this great opportunity to learn!

 

 

Read only

RameshShrestha
Contributor
7,507

Audit Logging :

RameshShrestha_0-1709296427064.png

Bonus 1: Done but it shows tenant as undefined for me but your screenshot gives t1.

RameshShrestha_1-1709296452634.png

Notification

RameshShrestha_2-1709296506291.png

Telemetry

RameshShrestha_3-1709296583788.png

With Reagrds,

Ramesh Shrestha

 

 

 

 

 

Read only

MioYasutake
SAP Champion
SAP Champion
7,395

Hi,
I am facing issues with audit-log.
I have installed the @cap-js/audit-logging plugin and added annotations as described below.

using { sap.capire.bookshop as db } from '../db/schema';

annotate db.Books with @PersonalData: {
    EntitySemantics : 'DataSubject'
}
{
  ID @PersonalData.FieldSemantics: 'DataSubjectID';
  title @PersonalData.IsPotentiallyPersonal;
};

However, I am not seeing the 'SensitiveDataRead' logs, nor do I see the '[cds] connected to audit-log' message in the console. Am I missing any steps?

Read only

MioYasutake
SAP Champion
SAP Champion
Read only

SandipAgarwalla
Active Contributor
Read only

NicholasB
Product and Topic Expert
Product and Topic Expert
Read only

Jarek
Explorer
Read only

Alpesa1990
Participant
Read only

tobiasz_h
Active Participant
6,857

Hello,

Audit-logging:

tobiasz_h_2-1709563896257.png

 

Notifications:

tobiasz_h_1-1709563580767.png

 

Telementry:

tobiasz_h_0-1709563498827.png

 

Read only

MatLakaemper
Participant
Read only

MatLakaemper
Participant
6,667

Hello Thomas,
can you give us at the end of the challenge a complete example Project (as a git-Repository) with all Topics?
I could not find out all special topics.

Kind Regards, 
Matthias

Read only

sabarna17
Contributor
Read only

qmacro
Developer Advocate
Developer Advocate
Read only

Nagarajan-K
Explorer
0 Kudos
5,657

Here are my tryouts.

Audit Log - 

NagarajanK_0-1709777290226.png

 

Notifications 

NagarajanK_1-1709777342926.png

Telemetry

NagarajanK_2-1709777387916.png

 

 

Read only

Cmdd
Participant
0 Kudos
5,512

Late submission but this week I have been busy playing with Flexible Programming Model 🙂

Cmdd_0-1709889966604.jpeg

Cmdd_1-1709890025082.jpegCmdd_2-1709890053457.jpegCmdd_3-1709890073346.jpeg