Skip to content

feat: Adding SentrySpan to performance monitoring.#932

Merged
bruno-garcia merged 15 commits into
feat/performance-monitoringfrom
feat/sentryspan
Feb 11, 2021
Merged

feat: Adding SentrySpan to performance monitoring.#932
bruno-garcia merged 15 commits into
feat/performance-monitoringfrom
feat/sentryspan

Conversation

@brustolin

@brustolin brustolin commented Feb 3, 2021

Copy link
Copy Markdown
Contributor

📜 Description

Creating the SentrySpan class and allowing transactions to create child.

💡 Motivation and Context

Requisite to the Performance API.

💚 How did you test it?

Unit tests

📝 Checklist

  • I reviewed the submitted code
  • I added tests to verify the changes
  • I updated the CHANGELOG if needed
  • I updated the docs if needed
  • Review from the native team if needed
  • No breaking changes

🔮 Next steps

TBD

@brustolin brustolin changed the title feat: Adding SentrySpan feat: Adding SentrySpan to performance monitoring. Feb 3, 2021

@bruno-garcia bruno-garcia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quick pass, couple nits

Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
@brustolin brustolin marked this pull request as ready for review February 4, 2021 02:07

@philipphofmann philipphofmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A first glance. I didn't have enough time to look at all of it. I will do that tomorrow.

Comment thread CHANGELOG.md Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h
Comment thread Sources/Sentry/Public/SentrySpanContext.h Outdated
Comment thread Sources/Sentry/Public/SentryTransaction.h
Comment thread Sources/Sentry/SentrySpanContext.m Outdated
brustolin and others added 2 commits February 4, 2021 20:40
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
@codecov-io

codecov-io commented Feb 5, 2021

Copy link
Copy Markdown

Codecov Report

Merging #932 (5dd6d12) into feat/performance-monitoring (1195ec0) will decrease coverage by 1.07%.
The diff coverage is 16.00%.

Impacted file tree graph

@@                       Coverage Diff                       @@
##           feat/performance-monitoring     #932      +/-   ##
===============================================================
- Coverage                        94.43%   93.36%   -1.08%     
===============================================================
  Files                               80       81       +1     
  Lines                             3612     3660      +48     
===============================================================
+ Hits                              3411     3417       +6     
- Misses                             201      243      +42     
Impacted Files Coverage Δ
Sources/Sentry/SentrySpan.m 0.00% <0.00%> (ø)
Sources/Sentry/SentryTransaction.m 77.08% <31.25%> (-22.92%) ⬇️
Sources/Sentry/SentrySpanContext.m 85.00% <33.33%> (-15.00%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1195ec0...2117314. Read the comment docs.

Comment thread Sources/Sentry/Public/SentrySpan.h
Comment thread Sources/Sentry/Public/SentrySpan.h
Comment thread Sources/Sentry/Public/SentryTransaction.h
Comment thread Sources/Sentry/Public/SentryTransaction.h
Comment thread Sources/Sentry/SentryTransaction.m
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated

@philipphofmann philipphofmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks already good. I addressed many things and also took a closer look at the tests this time. There are many minor comments.

Comment thread Sources/Sentry/Public/SentrySpan.h
Comment thread Sources/Sentry/Public/SentrySpan.h Outdated
Comment thread Sources/Sentry/Public/SentrySpan.h
Comment thread Sources/Sentry/SentryTransaction.m
Comment on lines +152 to +156
NSMutableArray *spans = [[NSMutableArray alloc] init];
for (SentrySpan *span in self.spans) {
[spans addObject:[span serialize]];
}
serializedData[@"spans"] = spans;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h: We need to make that thread-safe as well.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's true that this needs to be thread safe but it comes back to the fact that Transaction is an event, which isn't (and will never be) thread-safe. So we need to discuss what we do with this.

Lets discuss this Friday please, @mitsuhiko will be there

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thursday though

Comment thread Tests/SentryTests/SentryTransaction+Private.h Outdated
Comment thread Tests/SentryTests/SentryTransactionTests.swift Outdated
span.operation = operation;
span.spanDescription = description;
span.sampled = self.isSampled;
@synchronized(self.spans) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

m: Can we please add a test to make sure this is thread-safe?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One might argue "make sure it's thread-safe" isn't possible to achieve :P

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One might argue "make sure it's thread-safe" isn't possible to achieve :P

Indeed. Neither for positive, nor for negative outcome.

@marandaneto marandaneto Feb 10, 2021

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time has shown that this answer will come, soon or later, if it was or not :D
but I agree, at least trivial thread-safe problems could be avoided with tests, so a test would be indeed, nice.

Comment thread Tests/SentryTests/SentryTransactionTests.swift
Comment thread Tests/SentryTests/SentryTransactionTests.swift Outdated
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>

@bruno-garcia bruno-garcia left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All open comments were closed except tests for thread-safety but given SentryTransaction isn't even expected to be thread safe (It won't be bound to the scope anymore as we agreed today) it isn't relevant.

@bruno-garcia bruno-garcia merged commit 16a0088 into feat/performance-monitoring Feb 11, 2021
@bruno-garcia bruno-garcia deleted the feat/sentryspan branch February 11, 2021 23:37
@bruno-garcia

Copy link
Copy Markdown
Member

A reminder that we're merging this into a branch and not into master and we can iterate, specially after our meeting today.

@philipphofmann

Copy link
Copy Markdown
Member

Thanks, @bruno-garcia, for helping out on this one. I was swamped yesterday with other stuff, so I didn't take the time for another review.

bruno-garcia added a commit that referenced this pull request Mar 11, 2021
* feat: performance monitoring

* build: Setup CI for performance monitoring branch

* feat: Performance API: Transaction (#908)

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Clang Robot <clang-robot@sentry.io>
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>

* test: Add captureTransaction to sample apps (#922)

* docs: Improve code comments on transactions (#921)

Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>

* feat: Add missing properties to SpanContext and Transaction (#919)

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>

* feat: Adding SentrySpan to performance monitoring. (#932)

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Clang Robot <clang-robot@sentry.io>

* ref: Remove SentryTransaction from public API. (#950)

Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>

* feat: Add transaction sampling properties to SentryOptions (#961)

* Transaction sampling

* Update CHANGELOG.md

* Format code

* Apply suggestions from code review

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>

* Testing and fixes

* Using NSNumber for sampler return

* Update CHANGELOG.md

Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>

* Comment Update

* Using NSNumber for tracesSampleRate

Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>

* feat: Transaction in Sample App (#971)

* Some UI Sample

* Format code

* Apply suggestions from code review

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>

* removing button to download image

* Adding status and fixing operation value

* Fixed Tests

Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>

* merge fix

* feat: Add sampling rules to SentryHub startTransaction. (#977)

* Changing sampled from bool to enum, using TracesSampler

* removing name from span

* SamplingTests

* changelog and code format

* Lint Fix

* Fix tests

* Update Samples/iOS-Swift/iOS-Swift/TraceTestViewController.swift

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>

* Random generator for sampling

* missing comment

* remove sampler from SentryHub+TestInit.h

* Apply suggestions from code review

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>

Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>

* meta: Add missing breaking change to Changelog

* performance changelog

Co-authored-by: Philipp Hofmann <philipp.hofmann@sentry.io>
Co-authored-by: Dhiogo Brustolin <dhiogorb@gmail.com>
Co-authored-by: Clang Robot <clang-robot@sentry.io>
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
Co-authored-by: Sentry Github Bot <bot+github-bot@sentry.io>
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

Successfully merging this pull request may close these issues.

6 participants