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

CI testing PR - DO NOT MERGE #383

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
Partially enable delayed spans
kstenerud committed Jan 27, 2025

Verified

This commit was signed with the committer’s verified signature.
tstirrat15 Tanner Stirrat
commit d3bc7e053e37bb6bd831cc600df0f0a8ec856c6b
26 changes: 13 additions & 13 deletions Sources/BugsnagPerformance/Private/BugsnagPerformanceImpl.mm
Original file line number Diff line number Diff line change
@@ -309,27 +309,27 @@
bool includeSamplingHeader = configuration_ == nil || configuration_.samplingProbability == nil;

// Delay so that the sampler has time to fetch one more sample.
// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((SAMPLER_INTERVAL_SECONDS + 0.5) * NSEC_PER_SEC)),
// dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
// BSGLogTrace(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): Delayed %f seconds, now getting system info", SAMPLER_INTERVAL_SECONDS + 0.5);
// for(BugsnagPerformanceSpan *span: spans) {
// auto samples = systemInfoSampler_.samplesAroundTimePeriod(span.actuallyStartedAt, span.actuallyEndedAt);
// BSGLogTrace(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): System info sample size = %zu", samples.size());
// if (samples.size() >= 2) {
// if (shouldSampleCPU(span)) {
// BSGLogTrace(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): Getting CPU sample attributes for span %@", span.name);
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)((SAMPLER_INTERVAL_SECONDS + 0.5) * NSEC_PER_SEC)),
dispatch_get_global_queue(QOS_CLASS_BACKGROUND, 0), ^{
BSGLogTrace(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): Delayed %f seconds, now getting system info", SAMPLER_INTERVAL_SECONDS + 0.5);
for(BugsnagPerformanceSpan *span: spans) {
auto samples = systemInfoSampler_.samplesAroundTimePeriod(span.actuallyStartedAt, span.actuallyEndedAt);
BSGLogTrace(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): System info sample size = %zu", samples.size());
if (samples.size() >= 2) {
if (shouldSampleCPU(span)) {
BSGLogInfo(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): Getting CPU sample attributes for span %@", span.name);
// [span forceMutate:^() {
// [span internalSetMultipleAttributes:spanAttributesProvider_->cpuSampleAttributes(samples)];
// }];
// }
// }
// }
}
}
}

#ifndef __clang_analyzer__
BSGLogTrace(@"BugsnagPerformanceImpl::sendCurrentBatchTask(): Sending %zu sampled spans (out of %zu)", origSpansSize, spans.count);
#endif
uploadPackage(traceEncoding_.buildUploadPackage(spans, resourceAttributes_->get(), includeSamplingHeader), false);
// });
});

return true;
}