Add simplified emitEvent API for custom event logging in OpenTelemetryRum #650
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses the issue #573 requesting a simplified mechanism for logging custom events in the OpenTelemetryRum interface.
Previously, developers had to go through multiple steps to log an event. The new emitEvent API provides a much simpler and more concise method for emitting custom events.
Changes Introduced:
New method: emitEvent(eventName, body, attributes) added to the OpenTelemetryRum interface and implemented in OpenTelemetryRumImpl.
The method allows developers to quickly log custom events by providing the event name, body content, and additional attributes.
Logging provider: The method uses SdkEventLoggerProvider from the OpenTelemetry SDK for logging events.
Usage Example:
Developers can now log custom events using:
rum.emitEvent("UserLoggedIn", "LoginSuccessBody", attributes);
Instead of the multi-step process of setting up event builders, this simplified API should significantly reduce the complexity of custom event logging.