Comments (12)
Hi @rohith-alphanso thanks for reporting!
2.1.0 added a finalizer to Loggers to remove them when Dart no longer can reach them. I'm curious why the finalizer is working differently on the iPhone SE simulator....
Is this reproducable with a simple case? Can you give me a simple example project to see if I can figure out why Dart might be finalizing the logger?
from dd-sdk-flutter.
Hi @rohith-alphanso thanks for reporting!
2.1.0 added a finalizer to Loggers to remove them when Dart no longer can reach them. I'm curious why the finalizer is working differently on the iPhone SE simulator....
Is this reproducable with a simple case? Can you give me a simple example project to see if I can figure out why Dart might be finalizing the logger?
We are facing this exception, with 2.0.0
as well, we will try to have a simple repro
from dd-sdk-flutter.
@rohith-alphanso That is incredibly strange, as prior to 2.1.0 we didn't remove loggers from the registry. I'll continue looking into this but please let me know if you find a simple repro.
from dd-sdk-flutter.
@rohith-alphanso I can't reproduce here with my simple examples. I'm wondering if there's something weird in your initialization. Are you awaiting DatadogSdk.initialize
before creating a logger?
from dd-sdk-flutter.
@rohith-alphanso I can't reproduce here with my simple examples. I'm wondering if there's something weird in your initialization. Are you awaiting
DatadogSdk.initialize
before creating a logger?
yes,
final datadogConfiguration = DatadogUtils.getDatadogSdkConfiguration();
await DatadogSdk.instance
.initialize(datadogConfiguration, TrackingConsent.granted);
from dd-sdk-flutter.
@rohith-alphanso I can't reproduce here with my simple examples. I'm wondering if there's something weird in your initialization. Are you awaiting
DatadogSdk.initialize
before creating a logger?
static final _datadogLogger = DatadogLogger(
InternalLogger(),
DatadogLoggerConfiguration(
networkInfoEnabled: true,
),
);
static DatadogConfiguration getDatadogSdkConfiguration() {
final datadogEnvironment = _getDatadogEnvironment();
return DatadogConfiguration(
service: 'XXXXX',
clientToken: _clientToken,
env: datadogEnvironment,
site: _datadogSite,
nativeCrashReportEnabled: true,
firstPartyHosts: _firstPartyHosts,
uploadFrequency: UploadFrequency.frequent,
rumConfiguration: DatadogRumConfiguration(
applicationId: _applicationId,
viewEventMapper: DatadogSessionIdRetriever.viewEventMapper,
),
)..enableHttpTracking();
};
final datadogConfiguration = getDatadogSdkConfiguration();
await DatadogSdk.instance
.initialize(datadogConfiguration, TrackingConsent.granted);
- This is how we are defining logger in our application
from dd-sdk-flutter.
@rohith-alphanso I'll confirm, but my guess is that the static initialization of _datadogLogger
is running before DatadogSdk.instance.initialize
, which means that the MethodChannels aren't available to create the actual logger when you call DatadogSdk.instance.logs?.createLogger
. I'm not 100% sure how you get an logger Id in this scenario, but I'll try to recreate and see.
Hopefully your call to DatadogSdk.instance.initialize
in main
?
from dd-sdk-flutter.
Oh, actually, this is improper usage of this API. InternalLogger
in an internal type (and marked as such in the documentation). The constructor for DatadogLogger is also internal, but not marked as so via attributes (I will fix that).
To create loggers, it's expected you will call DatadogSdk.instance.logs?.createLogger
after initializing Datadog.
from dd-sdk-flutter.
@rohith-alphanso I'll confirm, but my guess is that the static initialization of
_datadogLogger
is running beforeDatadogSdk.instance.initialize
, which means that the MethodChannels aren't available to create the actual logger when you callDatadogSdk.instance.logs?.createLogger
. I'm not 100% sure how you get an logger Id in this scenario, but I'll try to recreate and see.Hopefully your call to
DatadogSdk.instance.initialize
inmain
?
yes
Future<void> initializeApp() async {
WidgetsFlutterBinding.ensureInitialized();
final datadogConfiguration = DatadogUtils.getDatadogSdkConfiguration();
await DatadogSdk.instance
.initialize(datadogConfiguration, TrackingConsent.granted);
FlutterError.onError = (final details) {
FlutterError.presentError(details);
DatadogSdk.instance.rum?.handleFlutterError(details);
};
PlatformDispatcher.instance.onError = (final error, final stackTrace) {
DatadogSdk.instance.rum?.addErrorInfo(
error.toString(),
RumErrorSource.source,
stackTrace: stackTrace,
);
return true;
};
}
This initializeApp
is called in the main method
from dd-sdk-flutter.
@rohith-alphanso See above though. You cannot create a DatadogLogger
from it's constructor. It should be marked as @internal
. Use DatadogSdk.instance.logs?.createLogger
instead after Datadog is initialized.
from dd-sdk-flutter.
@rohith-alphanso Did you ever get this resolved?
from dd-sdk-flutter.
from dd-sdk-flutter.
Related Issues (20)
- Is it not possible to use data dog from flutter isolate ? HOT 10
- Enforce native SDK dependencies HOT 2
- Datadog RUM is not working in Flutter Web HOT 5
- Apple Privacy manifest files - ITMS-91053: Missing API declaration HOT 6
- Flutter error tracking by raw code HOT 5
- DatadogTrackingHttpClient throws _TypeError if request URL is matched ignoreUrlPatterns HOT 3
- Not able to able mapping file to datadog HOT 25
- Feature Request: Expose `log` method that takes `LogLevel` parameter HOT 1
- No implementation found for method addError on channel datadog_sdk_flutter.rum HOT 34
- FirstPartyHosts formatting HOT 11
- Support WASM for Flutter 3.22 HOT 3
- Duplicate interface (iOS) HOT 5
- Persistent unexplained logs HOT 1
- Add ignoreUrlPatterns in TrackingExtensionExisting
- Migrate to package:web from dart:html HOT 2
- [Web] RUM stopped working on 16-05-2024 HOT 8
- [datadog_gql_link]Multipart request doesn't work HOT 6
- Calling DatadogSdk.instance.setUserInfo doesn't update ongoing RUM sessions HOT 8
- Add webview tracking support for flutter_inappwebview plugin HOT 3
- the two parameters "proxy" and "customEndpoint" are equivalent, but why the different names? HOT 1
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-flutter.