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

feat(profiling): Add a Stacktrace ItemType to represent the stacktraces sent from Sentry SDKs #1179

Merged
merged 18 commits into from Mar 11, 2022

Conversation

phacops
Copy link
Contributor

@phacops phacops commented Feb 10, 2022

For phase 1, I added 2 ItemType in a previous PR to allow ingesting Specto payloads. Those payloads were a session containing information about the device and a trace containing metrics about cpu, memory, network usage and a stack trace. This was ingested via a Specto service into Spanner.

For phase 2, we will implement our profiling code into Sentry SDKs and we now only have a stack trace to ingest via a Snuba worker. This is why we need to implement a new ItemType since it's a very different type of data (JSON payload instead of protobuf and containing only the stack trace and no other metric).

After our work for phase 2 on the SDKs is released, we'll be able to drop whatever we implemented for phase 1.

@phacops phacops requested a review from a team February 10, 2022 06:56
CHANGELOG.md Outdated Show resolved Hide resolved
@@ -106,6 +106,8 @@ pub enum ItemType {
ProfilingSession,
/// Profiling data
ProfilingTrace,
/// Stacktrace event payload encoded in JSON
Stacktrace,
Copy link
Member

Choose a reason for hiding this comment

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

A general question on the naming of this: Does this still contain profiling/specto-specific payloads? If so, it would be great if we could reflect this in the name of this item type somehow.

In parts, my thinking here is that we also have a stack trace schema in Sentry's error events. It would be good if we either separate the two clearly, including by using different terminology, or alternatively use the same schema. Choosing the second option is clearly a larger discussion.

Same applies to all other references in this PR, such as the Kafka topic assignment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not contain anything Specto specific, it's only profiling related now. You're not the only one mentioning this so I decided to change the name to "profile". I think it's a better name overall since it's easy to think "profiling team manages profiles" and it doesn't collide with other names in other repos (except maybe user profiles but it's so unrelated, I think it's OK).

Copy link
Member

Choose a reason for hiding this comment

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

That said, it probably still makes sense somewhat aligning the fields so SDKs and backend code does not have to deal with two stacktrace formats. Particularly if you plan on forwarding this to symbolicator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess we do have the timing information for each address, so we can't 100% match that format. We'll use a superset of that format, I'll need to transform what I get anyway to send the addresses to symbolicator but keep the original format.

It's going to look like that:

{
    "samples": [
      {
       "timestamp": <some duration from start of transaction>,
        "thread_id": "<some uint64 thread ID>",
        "frames": [
          { "instruction_addr": "0x7fff5bf3456c" },
          { "instruction_addr": "0x7fff5bf346c0" }
          ...
       ],
      },
      ...
    ]
}

relay-server/src/utils/sizes.rs Outdated Show resolved Hide resolved
relay-server/src/actors/store.rs Outdated Show resolved Hide resolved
@phacops phacops force-pushed the pierre/profiling-stacktrace-item-type branch from 806853d to e9bac93 Compare February 18, 2022 14:12
Copy link
Contributor Author

@phacops phacops left a comment

Choose a reason for hiding this comment

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

Renaamed to Profile, I think it makes it clearer it's related to the profiling team that way and it doesn't confuse with the existing stack traces.

relay-server/src/utils/sizes.rs Outdated Show resolved Hide resolved
@@ -106,6 +106,8 @@ pub enum ItemType {
ProfilingSession,
/// Profiling data
ProfilingTrace,
/// Stacktrace event payload encoded in JSON
Stacktrace,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not contain anything Specto specific, it's only profiling related now. You're not the only one mentioning this so I decided to change the name to "profile". I think it's a better name overall since it's easy to think "profiling team manages profiles" and it doesn't collide with other names in other repos (except maybe user profiles but it's so unrelated, I think it's OK).

relay-server/src/actors/store.rs Outdated Show resolved Hide resolved
@phacops phacops requested a review from a team February 18, 2022 15:39
@phacops phacops force-pushed the pierre/profiling-stacktrace-item-type branch from e9bac93 to 4f41d69 Compare February 21, 2022 14:55
@jan-auer jan-auer self-assigned this Feb 23, 2022
@jan-auer
Copy link
Member

As per @phacops, this PR should be ready. I'll give it a read today 👍

@phacops phacops force-pushed the pierre/profiling-stacktrace-item-type branch from 451fbb0 to 9b92ae0 Compare March 8, 2022 14:16
relay-server/Cargo.toml Show resolved Hide resolved
relay-config/src/config.rs Show resolved Hide resolved
@@ -821,6 +826,7 @@ impl Default for TopicAssignments {
metrics: "ingest-metrics".to_owned().into(),
profiling_sessions: "profiling-sessions".to_owned().into(),
profiling_traces: "profiling-traces".to_owned().into(),
profiles: "profiles".to_owned().into(),
Copy link
Member

Choose a reason for hiding this comment

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

Please remember to deploy the prod config in getsentry/ops before deploying this PR.

relay-server/src/utils/sizes.rs Outdated Show resolved Hide resolved
relay-server/src/actors/store.rs Outdated Show resolved Hide resolved
relay-server/src/utils/profile.rs Outdated Show resolved Hide resolved
relay-server/src/utils/profile.rs Outdated Show resolved Hide resolved
relay-server/src/utils/profile.rs Outdated Show resolved Hide resolved
relay-server/src/utils/profile.rs Outdated Show resolved Hide resolved
relay-server/src/utils/profile.rs Outdated Show resolved Hide resolved
@phacops phacops requested a review from jan-auer March 9, 2022 16:22
relay-config/src/config.rs Outdated Show resolved Hide resolved
relay-server/src/actors/envelopes.rs Outdated Show resolved Hide resolved
relay-server/src/actors/envelopes.rs Outdated Show resolved Hide resolved
relay-server/src/utils/sizes.rs Show resolved Hide resolved
@phacops phacops merged commit ec83095 into master Mar 11, 2022
@phacops phacops deleted the pierre/profiling-stacktrace-item-type branch March 11, 2022 14:04
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.

None yet

3 participants