Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Features not working on dashboard #2

Open
taku-ka opened this issue Nov 16, 2020 · 7 comments
Open

Features not working on dashboard #2

taku-ka opened this issue Nov 16, 2020 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@taku-ka
Copy link

taku-ka commented Nov 16, 2020

I can see Android and iOS app on the dashboard but I notice the following:
Crashes are not working - I crash the app for both Android and iOS but no crushes recorded
HTTP errors and network failure rate is not working in Android but is working in iOS
App Launches is working for both Android and iOS
HTTP response time is not working for Android but its working for iOS
Most frequent interactions is not working for Android but its working for iOS.
Handle exceptions is not working for both Android and iOS

@taku-ka taku-ka added the bug Something isn't working label Nov 16, 2020
@vvydier vvydier self-assigned this Jan 11, 2021
@vvydier
Copy link
Contributor

vvydier commented Jan 11, 2021

@taku-ka Android instrumentation gets injected by a gradle task and there is no equivalent of that inXamarin. You will need to add the instrumentation manually in Android
recordHandledException should be available in the Xamarin binding for iOS.
crashes can be recorded if the dSYM file is uploaded during build (nspostbuild script) and only one crash handler (newrelic) is setup.

@emanuelbalea
Copy link

emanuelbalea commented Mar 16, 2021

Any idea of where the Gradle adds the hooks for these crash handlers etc? I'd be willing to try hook those up somehow.
I was able to hack around the crashes not working by just doing this:

this.StartNewRelic(); //normal init stuff AndroidEnvironment.UnhandledExceptionRaiser += (sender, args) => { Throwable throwable = Throwable.FromException(args.Exception); NewRelic.RecordHandledException(new Exception(args.Exception.Message, throwable)); }

But it feels like there should be easier and better hooks for that? Potentially the configuration that defines the stores and add to those? Or am I too far off.

@vvydier
Copy link
Contributor

vvydier commented Mar 17, 2021

I think you are on the right track. I have not looked at if xamarin has ways of adding gradle tasks recently, so if there is a hook mechanisms, please link the relevant examples/strategies on how to do it, Thanks

@emanuelbalea
Copy link

@vvydier not gradle as such no. but we do have things like Fody Weaver which can inject code at build time or generate/inject code by modifying the csproj files etc. that said you can launch external tasks from there as well. it just depends on what those tasks are. im not sure where the source of the gradle files for mobile are so that i can see if they can translate to xamarin or if they can be added as post/pre compile tasks. Note i'm not great at gradle but willing to give it a shot.

alternatively if we can expose the sendcrash methods or something for noticing errors and http messages etc then we can just work with xamarin hooks on those as well.

@vvydier
Copy link
Contributor

vvydier commented Sep 21, 2021

@emanuelbalea I have not used Fody Weaver, can you point me to an example how you plan on adding auto-instrumentation in xamarin

@emanuelbalea
Copy link

Adding/creating a weaver is not overly difficult, depending on if you just need to inject some C# files to get compiled, or replace files at compile time but if you inject IL it can get a bit messier. Another way to do this is to use roslyn generators but i think they are slightly more complicated.

The problem is I don't know what hooks you had in gradle or what they did to point you in their equivalent places but in general if there is an android/ios api then there will be a xamarin counter part. So if you can point me to where the gradle does stuff i could help more.

In general for xamarin regardless of the platform you usually do your init and hook up with calls in oncreate in the application or similar unless you inject using something fody in the same place.

https://github.com/Fody/Home/blob/master/pages/addin-development.md

However i made android bindings for a version of the jar file from about 1-2 major release ago (current release had lots of changed namespaces and didn't have the time to add them to the transform or ignore list) and that seems to record exceptions just fine, and even some ui transitions.

@ndesai-newrelic
Copy link

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants