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

chore: Add migration docs for Hub #10126

Merged
merged 4 commits into from
Jan 10, 2024
Merged

chore: Add migration docs for Hub #10126

merged 4 commits into from
Jan 10, 2024

Conversation

lforst
Copy link
Member

@lforst lforst commented Jan 10, 2024

Adds documentation on how to migrate off the hub API to the MIGRATION guide. This is still a bit basic - we will expand on this once we have figured out all of our migration paths and are finalizing v8.

@lforst lforst requested review from Lms24 and mydea January 10, 2024 10:34
Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Nice! I prefer this table over the list we keep below (see other comment)

WDYT about mentioning getCurrentHub, too here? It's probably the most common way how users interact with the Hub API

MIGRATION.md Show resolved Hide resolved
MIGRATION.md Outdated Show resolved Hide resolved
lforst and others added 2 commits January 10, 2024 11:54
Co-authored-by: Lukas Stracke <lukas.stracke@sentry.io>
MIGRATION.md Outdated
| `new Hub()` | `withScope()`, `withIsolationScope()` or `new Scope()` |
| hub.isOlderThan() | REMOVED - Was used to compare `Hub` instances, which are gonna be removed. |
| hub.bindClient() | A combination of `scope.setClient()` and `client.setupIntegrations()` |
| hub.pushScope() | Best replaced with `withScope()` |
Copy link
Member

@mydea mydea Jan 10, 2024

Choose a reason for hiding this comment

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

Suggested change
| hub.pushScope() | Best replaced with `withScope()` |
| hub.pushScope() | `Sentry.withScope()` |

MIGRATION.md Outdated
| hub.isOlderThan() | REMOVED - Was used to compare `Hub` instances, which are gonna be removed. |
| hub.bindClient() | A combination of `scope.setClient()` and `client.setupIntegrations()` |
| hub.pushScope() | Best replaced with `withScope()` |
| hub.popScope() | When used in combination with `hub.pushScope()` best replaced with `withScope()` |
Copy link
Member

@mydea mydea Jan 10, 2024

Choose a reason for hiding this comment

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

Suggested change
| hub.popScope() | When used in combination with `hub.pushScope()` best replaced with `withScope()` |
| hub.popScope() | `Sentry.withScope()` |

MIGRATION.md Outdated
| hub.pushScope() | Best replaced with `withScope()` |
| hub.popScope() | When used in combination with `hub.pushScope()` best replaced with `withScope()` |
| hub.withScope() | `withScope()` |
| getClient() | `scope.getClient` |
Copy link
Member

@mydea mydea Jan 10, 2024

Choose a reason for hiding this comment

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

Suggested change
| getClient() | `scope.getClient` |
| getClient() | `Sentry.getClient()` |

Copy link
Member

Choose a reason for hiding this comment

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

users should never use scope.getClient() in the future, as we want to cascade the clients in v8 (so it is only set on the isolation scope).

MIGRATION.md Outdated
| hub.popScope() | When used in combination with `hub.pushScope()` best replaced with `withScope()` |
| hub.withScope() | `withScope()` |
| getClient() | `scope.getClient` |
| getScope() | REMOVED - Scopes are used directly now. |
Copy link
Member

@mydea mydea Jan 10, 2024

Choose a reason for hiding this comment

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

Suggested change
| getScope() | REMOVED - Scopes are used directly now. |
| getScope() | `Sentry.getCurrentScope()` to get the currently active scope |

MIGRATION.md Outdated
| hub.bindClient() | A combination of `scope.setClient()` and `client.setupIntegrations()` |
| hub.pushScope() | Best replaced with `withScope()` |
| hub.popScope() | When used in combination with `hub.pushScope()` best replaced with `withScope()` |
| hub.withScope() | `withScope()` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| hub.withScope() | `withScope()` |
| hub.withScope() | `Sentry.withScope()` |

MIGRATION.md Outdated
Comment on lines 34 to 36
| captureException() | `scope.captureException()` |
| captureMessage() | `scope.captureMessage()` |
| captureEvent() | `scope.captureEvent()` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| captureException() | `scope.captureException()` |
| captureMessage() | `scope.captureMessage()` |
| captureEvent() | `scope.captureEvent()` |
| captureException() | `Sentry.captureException()` |
| captureMessage() | `Sentry.captureMessage()` |
| captureEvent() | `Sentry.captureEvent()` |

IMHO users should avoid using these on the scope directly, just use the global methods.

MIGRATION.md Outdated
Comment on lines 38 to 44
| addBreadcrumb() | `scope.addBreadcrumb()` |
| setUser() | `scope.setUser()` |
| setTags() | `scope.setTags()` |
| setExtras() | `scope.setExtras()` |
| setTag() | `scope.setTag()` |
| setExtra() | `scope.setExtra()` |
| setContext() | `scope.setContext()` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| addBreadcrumb() | `scope.addBreadcrumb()` |
| setUser() | `scope.setUser()` |
| setTags() | `scope.setTags()` |
| setExtras() | `scope.setExtras()` |
| setTag() | `scope.setTag()` |
| setExtra() | `scope.setExtra()` |
| setContext() | `scope.setContext()` |
| addBreadcrumb() | `Sentry.addBreadcrumb()` |
| setUser() | `Sentry.setUser()` |
| setTags() | `Sentry.setTags()` |
| setExtras() | `Sentry.setExtras()` |
| setTag() | `Sentry.setTag()` |
| setExtra() | `Sentry.setExtra()` |
| setContext() | `Sentry.setContext()` |

MIGRATION.md Outdated
| setExtra() | `scope.setExtra()` |
| setContext() | `scope.setContext()` |
| configureScope() | REMOVED - Scopes are now the unit of concurrency. |
| run() | `withScope()` or `withIsolationScope()` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| run() | `withScope()` or `withIsolationScope()` |
| run() | `Sentry.withScope()` or `Sentry.withIsolationScope()` |

MIGRATION.md Outdated
| configureScope() | REMOVED - Scopes are now the unit of concurrency. |
| run() | `withScope()` or `withIsolationScope()` |
| getIntegration() | `client.getIntegration()` |
| startTransaction() | `startSpan()`, `startInactiveSpan()` or `startSpanManual()` |
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| startTransaction() | `startSpan()`, `startInactiveSpan()` or `startSpanManual()` |
| startTransaction() | `Sentry.startSpan()`, `Sentry.startInactiveSpan()` or `Sentry.startSpanManual()` |

@lforst lforst requested review from mydea and Lms24 January 10, 2024 11:37
@lforst lforst merged commit 1a7ea9b into develop Jan 10, 2024
24 checks passed
@lforst lforst deleted the lforst-hub-migration-docs branch January 10, 2024 11:54
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