Skip to content
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

Quick way to trigger reports for testing? #3

Closed
Clafou opened this issue Apr 1, 2022 · 3 comments
Closed

Quick way to trigger reports for testing? #3

Clafou opened this issue Apr 1, 2022 · 3 comments

Comments

@Clafou
Copy link
Contributor

Clafou commented Apr 1, 2022

I integrated MeterReporter into an app as a replacement for Stacksift, which took just a minute. My prior Stacksift setup did successfully send reports.

But I am now having trouble sending reports so that I can test my backend. I have edited my app with a fatalError() and also tried a forced unwrap crash, but no report is being sent at the next app launch after these crashes, even after 10 seconds when it should kick in. Wells's handleExistingLogs finds no report.

What is the right approach to test the sending of reports?

This is the setup code in my AppDelegate:

var config = MeterReporter.Configuration(endpointURL: URL(string: "https://myendpoint")!)
config.hostIdentifier = "Test"
config.backgroundIdentifier = nil
let reporter = MeterReporter(configuration: config)
reporter.start()
@mattmassicotte
Copy link
Contributor

mattmassicotte commented Apr 1, 2022

hmm, does simulating the MetricKit payloads from Xcode work? The string skipping simulated payload should be logged with the default config when this happens.

@Clafou
Copy link
Contributor Author

Clafou commented Apr 1, 2022

I do not recall seeing skipping simulated payload when debugging in the simulator, no.
I was working in the simulator, and I just tried on a device and it does work now!

But I discovered another issue: it crashes after 10 seconds at the line below:
wellsReporter.existingLogHandler = { [unowned self] in self.handleExistingLog(at: $0, date: $1) }
This new problem is fixed if I change my app to hold a reference to MeterReporter. I was just setting it up in the AppDelegate without storing it (which was fine with Stacksift, no longer the case). Maybe this is worth an update or a mention in the README as I think it's quite common for crash reporters to just set them up that way, without keeping a reference to them.

@mattmassicotte
Copy link
Contributor

Whew, sorry for not answering this sooner. I think the original issue has been resolved right?

As for the crash, your comments are good. I've changed the owned, and added comment docs about the strong ref requirements.

Thanks again for finding and reporting this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants