Comments (6)
Hi @igorwojda and thanks for opening this question,
this is working as intended, as mentioned in the EventMapper's javadoc.
We have a check in place to ensure the event mapper returns the same instance of the event it receives. This is to ensure that all the internal fields marked as non mutable are indeed preserved by the event mapper implementation. You don't need to make a copy as all the fields that are allowed to be modified are mutable in the event object.
from dd-sdk-android.
This is an unintuitive behaviour. Also silent fail makes this quite concerning.
Ideal solution would be not to use mutable fields, but you should at least consider throwing an exception.
from dd-sdk-android.
Also silent fail makes this quite concerning.
This behavior is not silent if you enable the SDK internal logs :
Datadog.setVerbosity(Log.VERBOSE)
Would print a warning log in the logcat saying:
"RumEventMapper: the returned mapped object was not the same instance as the original object. This event will be dropped: { …}"
Ideal solution would be not to use mutable fields
Again, because we need to ensure that only some specific fields would change via the mapper, we can't allow any copy. Doing that would mean making complex nested comparison between the original and updated event, which would degrade the performance of the host application.
Making the relevant fields mutable, as stated in the docs, let customers map the fields effortlessly by replacing the mutable fields.
but you should at least consider throwing an exception.
Our policy is to never throw exceptions in our SDK, as we don't want to inadvertently crash the host application on the end user's device.
from dd-sdk-android.
I got the idea behind, not failing the app, although this behaviour could be more strict in debug
build by default (or at least there should be a way to enable strict verification as warning in LogCat is not enough to prevent incorrect config).
from dd-sdk-android.
@xgouchet So what is the correct way of adding these custom properties?
from dd-sdk-android.
You can add custom properties to events in a variety of ways, depending on which event type we're talking about. Using the event mapper to add custom properties is not reccomended as custom properties often relate to the state of the application, and the event mapper is called asynchronously, when the state of the app might have changed.
Our documentation highlights several ways this can be achieved, and if you have a specific use case in mind we'd be happy to help suggest a solution for it.
from dd-sdk-android.
Related Issues (20)
- Lower than expected startup times since 2.6.0 HOT 2
- Logging: setNetworkInfoEnabled(false) doesn't seem to take effect HOT 5
- ANR on `Rum.enable()` HOT 7
- Rum works but logger don't send logs HOT 6
- Remove a default attribute HOT 2
- Crash generated by DrawableUtils HOT 2
- JankStatsActivityLifecycleListener.onActivityStopped - HOT 4
- setTelemetrySampleRate, explanation HOT 3
- Security vulnerability introduced with SDK v2.7.1 (okio) HOT 2
- Unable to log custom actions HOT 1
- Memory Leak : AggregatingVitalMonitor listeners are never unregistered HOT 3
- Missing DataDog events caused by UnknownError HOT 10
- Cannot implementation com.datadoghq:dd-sdk-android-logs HOT 4
- ./gradlew uploadMappingRelease crashes trying to upload mapping.txt file after release build HOT 2
- How to group views as Service? HOT 1
- Fragment views stopped getting registered HOT 1
- Crash gets assigned to wrong view HOT 1
- Fatal Exception: java.lang.IllegalStateException Recording currently in progress - missing #endRecording() call? HOT 5
- What's the preferred `DataDogInterceptor` sampling rate? HOT 2
- ValueError: Invalid traceparent version HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dd-sdk-android.