-
Notifications
You must be signed in to change notification settings - Fork 204
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of CFE_EVS_SendEventWithAppID
in APIs doesn't follow preferred model
#1388
Comments
Do we need to restrict this or just document it better? I think the use-case is justified, It is used when a function in one app is called by another app (of which there are many examples, such as CFE_ES_RegisterCDS), and the function needs to generate one of the ES-defined event IDs (e.g. The same problem can easily occur in user-defined apps too. Even if the functions are put into a library, if one wants to send an event, one has to associate that event with an appID. I do consider this to be a "specialized" API - but I think its a valid tool to have in the tool box. It has to be used properly, but it's not wrong to have it. |
Joe, |
I thought we discouraged sending of events from libraries/APIs, in favor of providing return status that the app could then handle within it's context. From what I see there's nothing deconflicting them when sent from APIs, I thought we had an open issue to that effect but couldn't find it. Just as a random example, not actually looking if these are sent by APIs but:
|
ES knows what the issues are and defines the event/error codes in context of ES. This approach decouples the ES implementation from the calling app and potentially reduces code duplication. It is a judgement call on when to use events in an API so your questioning is valid. For this case I think it's better that ES send the event since ES detected and defined the error condition being reported. |
Well, if we do want API's to send events (which would also keep the message contents consistent), then it seems like we need to deconflict EIDs since it's the only way to tell them apart on a short message (if type is the same). Maybe assign/reserve bits to uniquely identify API events, either in the type or event? If it was type we might be able to filter in useful ways? |
It is already de-conflicted (sort of) because the combination of (appID + eventID) is what is unique. My only concern is that the "appID" here is not a fixed/consistent ID, so you might boot once and get one appID, then reboot and get a different appID. But either way, event IDs need to be combined with app IDs, then they are unique. This is the exact reason why, depending on the use case of the function, it needs to ensure that the event ID is indeed associated with the correct app ID. I also concur that it is often more appropriate for the implementer (e.g. ES) to handle the events in many cases, for instance going back to the CDS example, the ES provides the implementation, the ES knows exactly what went wrong and has full context info to assemble the message. It is impossible to encode all the detail into a simple return code. (i.e. events include the CDS name, caller name, plus any other detail). The pattern should be that the event gets generated by the spot that has the best context info to describe the problem.... That being said, I do think we might want to consider notion of app IDs assigned at compile-time, which can provide a consistent identifier that doesn't change after every reboot/reload, to supplement the runtime app ID. Maybe the app name itself could serve this but it is too long to put into binary structures many times. |
How so? If the SB API defines an EID of 6, how can you tell that apart from an app EID of 6, or an ES API EID of 6 (or any other random library that is used that defines EIDs used in APIs)? Where is the appID in a SHORT message? How would you filter any of these differently, since the filter is based on EID? Wouldn't the filter logic collide (if you set to filter all but the first, only the first EID of 6 would get through)? All you get in a short message is the CFE_EVS_PacketID structure: cFE/modules/evs/fsw/inc/cfe_evs_msg.h Lines 1235 to 1248 in e80aae9
|
ping @tngo67, @klystron78 for participation/awareness |
In the short message the App Name is serving to de-conflict. One must look at the app name in order to decipher event ID. (FWIW, I thought it was sending app ID, this is actually better - app name will at least be consistent from run to run, so this is not bad, it is just verbose/large in size) |
I'm still not following. How do you tell the difference between an event created by sample app with an EID defined within sample app with a value of 6 vs an event created by sample app calling an API that uses an EID it defines as a value of 6? What am I missing? We don't do anything I'm aware of to deconflict EIDs between apps/libs/modules. I am aware there are external systems that do deconflict across a distribution, but cFE doesn't make this easy since the EIDs are defined internally (modules/es/fsw/inc/cfe_es_events.h for example). |
From splinter - I definitely had it confused, I assumed "AppName" was the calling context, where instead it's the EID namespace context. So really what happens is if sample_app calls an ES API that generates an EID of 6, the "AppName" that is sent down in telemetry is ES (NOT sample_app). Therefore for short messages, it's currently impossible to tell the calling context from a short event for events created by APIs (you wouldn't know if sample_app or some other app caused it), nor can you filter based on calling context since the filter is within the context of ES. |
Remaining action/options - Could improve documentation and/or change AppName to better reflect that it is the EID context not the calling context. Could enhance reporting to include calling context. Could add filtering options to additionally filter based on context. Also still pending feedback from reviewers who recommended removing this... seems like it's still the recommended pattern and a required capability. |
CCB:2021-04-21 DISCUSSED
EDIT (skliper): Just going to leave as-is for now, future work to clean up/improve. |
Marking as invalid and closing this issue since there is a use case, future work to improve naming/reporting/filtering. |
Is your feature request related to a problem? Please describe.
CFE_EVS_SendEventWitAppID
is used in many of the cFE core APIs. This leads to possible EID collisions (core to app), cross dependencies for filter management, and doesn't really follow preferred pattern.Describe the solution you'd like
Apps should manage their events, APIs should return status for apps to handle.
Describe alternatives you've considered
Manage EIDs to prevent collisions, still not great since they are compiled in so fairly fragile
Additional context
Code review
Requester Info
Jacob Hageman - NASA/GSFC
The text was updated successfully, but these errors were encountered: