Skip to content

feat(browser-starfish): add initial ui to enable image view - #62223

Merged
DominikB2014 merged 4 commits into
masterfrom
DominikB2014/ui-resource-module-enable-images
Jan 8, 2024
Merged

DominikB2014 merged 4 commits into
masterfrom
DominikB2014/ui-resource-module-enable-images

Conversation

@DominikB2014

@DominikB2014 DominikB2014 commented Dec 21, 2023 •

Copy link
Copy Markdown
Contributor

Work for #60482

  1. Adds a basic UI to enable disable image view.
image
  1. When you select show only links the following is shown
image
  1. If you select go to settings, you go to the performance page settings.

  2. If an image has an error, we will display the grey box again

image

A couple TODOs to actually use this

  1. We don't have an image icon, going to work on that in a future PR, an SVG is probably okay here?
  2. We need to merge in feat(browser-starfish): frontend project settings #62131 and feat(browser-starfish): Add project settings endpoint for images #62025 to have the actual setting

@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Dec 21, 2023
<div style={{width: '100%', wordWrap: 'break-word'}}>
<img src={src} style={{minWidth: imageWidth, height: '200px'}} />
{showImage && !hasError ? (
<img onError={() => setHasError(true)} src={src} style={commonStyles} />

@DominikB2014 DominikB2014 Dec 22, 2023 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@AbhiPrasad Do you know if errors from images that fail to load will become issues in our sentry project? As we will expect errors here, we wouldn't want them to report them to sentry. Although something interesting here would be to collect metrics on how often images aren't available or are available, maybe with Javascript DDM??

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.

By default we don't collect errors from resource 404s. See: https://blog.sentry.io/fallbacks-for-http-404-images-in-html-and-javascript/ for more info.

Although something interesting here would be to collect metrics on how often images aren't available or are available, maybe with Javascript DDM

Yes we can totally do that. Every time an image loads we can increment a metric.

// status is either `ok` or `error` based on if the image was available or not
Sentry.metrics.increment('performance.resource.image_load', 1, { tags: { status } });

We need to put the Sentry.metrics.increment in a useEffect call because it's a side effect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

👍 I'll add this in another PR, as it won't be useful until we release.

@DominikB2014
DominikB2014 merged commit a989517 into master Jan 8, 2024
@DominikB2014
DominikB2014 deleted the DominikB2014/ui-resource-module-enable-images branch January 8, 2024 17:10
trillville pushed a commit that referenced this pull request Jan 19, 2024
Work for #60482 

1. Adds a basic UI to enable disable image view.

<img width="1264" alt="image"
src="https://github.com/getsentry/sentry/assets/44422760/a58d6ce6-7bc0-4edf-9a9f-5491fb1fac66">

2. When you select show only links the following is shown
<img width="1255" alt="image"
src="https://github.com/getsentry/sentry/assets/44422760/a804efe5-4481-4c4b-bc61-43fb72659d87">

3. If you select go to settings, you go to the performance page
settings.

4. If an image has an error, we will display the grey box again
<img width="753" alt="image"
src="https://github.com/getsentry/sentry/assets/44422760/2654013d-e9b3-4891-86c2-2ba48d6c2030">

A couple TODOs to actually use this
1. We don't have an image icon, going to work on that in a future PR, an
SVG is probably okay here?
2. We need to merge in #62131 and #62025 to have the actual setting
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 24, 2024

This branch was successfully deployed

1 active deployment
Preview — 7d8dd2a5 Deployed Dec 22, 2023 by vercel[bot]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants