mirror of
https://github.com/hanzoai/sentinel.git
synced 2026-09-29 22:34:33 +00:00
FSL-1.0-Apache-2.0 grants us the code, not the name. "Sentry" is Functional Software's trademark, so every place the running app says it to a user -- page titles, onboarding, empty states, toasts, settings copy, the self-hosted footer -- now says Sentinel. Attribution is the other half of the deal and stays untouched: upstream copyright headers, LICENSE, NOTICE. So does anything where the mark is a fact rather than a brand -- @sentry/* packages, sentry-cli, the wizard and bundler plugins, docs.sentry.io, the whole gettingStartedDocs tree. Renaming those would leave instructions that no longer work. Nothing structural moved. No import, identifier, route path, feature flag, API field or test id changed; the diff is 312 lines in and 312 out. Colocated specs were updated in lockstep with the copy they assert. Marketing and community links point at hanzo.ai, only where a real page exists to point at. Co-authored-by: Hanzo Dev <[email protected]>
141 lines
4.7 KiB
TypeScript
141 lines
4.7 KiB
TypeScript
import {Fragment, memo, useCallback} from 'react';
|
|
import styled from '@emotion/styled';
|
|
import * as Sentry from '@sentry/react';
|
|
|
|
import emptyStateImg from 'sentry-images/spot/custom-metrics-empty-state.svg';
|
|
|
|
import {Button} from 'sentry/components/button';
|
|
import FeatureBadge from 'sentry/components/featureBadge';
|
|
import FloatingFeedbackWidget from 'sentry/components/feedback/widget/floatingFeedbackWidget';
|
|
import * as Layout from 'sentry/components/layouts/thirds';
|
|
import OnboardingPanel from 'sentry/components/onboardingPanel';
|
|
import {DatePageFilter} from 'sentry/components/organizations/datePageFilter';
|
|
import {EnvironmentPageFilter} from 'sentry/components/organizations/environmentPageFilter';
|
|
import PageFilterBar from 'sentry/components/organizations/pageFilterBar';
|
|
import {ProjectPageFilter} from 'sentry/components/organizations/projectPageFilter';
|
|
import {PageHeadingQuestionTooltip} from 'sentry/components/pageHeadingQuestionTooltip';
|
|
import {t} from 'sentry/locale';
|
|
import {space} from 'sentry/styles/space';
|
|
import {trackAnalytics} from 'sentry/utils/analytics';
|
|
import {METRICS_DOCS_URL} from 'sentry/utils/metrics/constants';
|
|
import useOrganization from 'sentry/utils/useOrganization';
|
|
import {useDDMContext} from 'sentry/views/ddm/context';
|
|
import {useMetricsOnboardingSidebar} from 'sentry/views/ddm/ddmOnboarding/useMetricsOnboardingSidebar';
|
|
import {PageHeaderActions} from 'sentry/views/ddm/pageHeaderActions';
|
|
import {Queries} from 'sentry/views/ddm/queries';
|
|
import {MetricScratchpad} from 'sentry/views/ddm/scratchpad';
|
|
import {WidgetDetails} from 'sentry/views/ddm/widgetDetails';
|
|
|
|
export const DDMLayout = memo(() => {
|
|
const organization = useOrganization();
|
|
const {hasMetrics} = useDDMContext();
|
|
const {activateSidebar} = useMetricsOnboardingSidebar();
|
|
|
|
const addCustomMetric = useCallback(
|
|
(referrer: 'header' | 'onboarding_panel') => {
|
|
Sentry.metrics.increment('ddm.add_custom_metric', 1, {
|
|
tags: {
|
|
referrer,
|
|
},
|
|
});
|
|
trackAnalytics('ddm.open-onboarding', {
|
|
organization,
|
|
source: referrer,
|
|
});
|
|
activateSidebar();
|
|
},
|
|
[activateSidebar, organization]
|
|
);
|
|
|
|
return (
|
|
<Fragment>
|
|
<Layout.Header>
|
|
<Layout.HeaderContent>
|
|
<Layout.Title>
|
|
{t('Metrics')}
|
|
<PageHeadingQuestionTooltip
|
|
docsUrl={METRICS_DOCS_URL}
|
|
title={t(
|
|
'Metrics help you track and visualize the data points you care about, making it easier to monitor your application health and identify issues.'
|
|
)}
|
|
/>
|
|
<FeatureBadge type="alpha" />
|
|
</Layout.Title>
|
|
</Layout.HeaderContent>
|
|
<Layout.HeaderActions>
|
|
<PageHeaderActions
|
|
showCustomMetricButton={hasMetrics}
|
|
addCustomMetric={() => addCustomMetric('header')}
|
|
/>
|
|
</Layout.HeaderActions>
|
|
</Layout.Header>
|
|
<Layout.Body>
|
|
<FloatingFeedbackWidget />
|
|
<Layout.Main fullWidth>
|
|
<PaddedContainer>
|
|
<PageFilterBar condensed>
|
|
<ProjectPageFilter />
|
|
<EnvironmentPageFilter />
|
|
<DatePageFilter />
|
|
</PageFilterBar>
|
|
</PaddedContainer>
|
|
{hasMetrics ? (
|
|
<Fragment>
|
|
<Queries />
|
|
<MetricScratchpad />
|
|
<WidgetDetails />
|
|
</Fragment>
|
|
) : (
|
|
<OnboardingPanel image={<EmptyStateImage src={emptyStateImg} />}>
|
|
<h3>{t('Get started with custom metrics')}</h3>
|
|
<p>
|
|
{t(
|
|
"Send your own metrics to Sentinel to track your system's behaviour and profit from the same powerful features as you do with errors, like alerting and dashboards."
|
|
)}
|
|
</p>
|
|
<Button
|
|
priority="primary"
|
|
onClick={() => addCustomMetric('onboarding_panel')}
|
|
>
|
|
{t('Add Custom Metric')}
|
|
</Button>
|
|
</OnboardingPanel>
|
|
)}
|
|
</Layout.Main>
|
|
</Layout.Body>
|
|
</Fragment>
|
|
);
|
|
});
|
|
|
|
const PaddedContainer = styled('div')`
|
|
margin-bottom: ${space(2)};
|
|
display: flex;
|
|
justify-content: space-between;
|
|
flex-wrap: wrap;
|
|
gap: ${space(1)};
|
|
`;
|
|
|
|
const EmptyStateImage = styled('img')`
|
|
@media (min-width: ${p => p.theme.breakpoints.small}) {
|
|
user-select: none;
|
|
position: absolute;
|
|
top: 0;
|
|
bottom: 0;
|
|
width: 220px;
|
|
margin-top: auto;
|
|
margin-bottom: auto;
|
|
transform: translateX(-50%);
|
|
left: 50%;
|
|
}
|
|
|
|
@media (min-width: ${p => p.theme.breakpoints.large}) {
|
|
transform: translateX(-60%);
|
|
width: 280px;
|
|
}
|
|
|
|
@media (min-width: ${p => p.theme.breakpoints.xlarge}) {
|
|
transform: translateX(-75%);
|
|
width: 320px;
|
|
}
|
|
`;
|