Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions docs/src/components/AttributeCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import OtelBadge from './OtelBadge.astro';
import TypeBadge from './TypeBadge.astro';
import AttributeLink from './AttributeLink.astro';
import InfoTooltip from './InfoTooltip.astro';
import DottedName from './DottedName.astro';
import type { Attribute } from '../content.config';
import { parseAttributeId } from '../utils/category';
import { renderInlineMarkdown } from '../utils/markdown';
Expand Down Expand Up @@ -42,9 +43,9 @@ const examples = attribute.examples ?? (attribute.example !== undefined ? [attri
data-pagefind-body
>
<div class="flex flex-wrap items-start justify-between gap-3 mb-3">
<h3 class="flex items-center gap-2 text-base m-0" data-pagefind-meta="title">
<h3 class="flex flex-wrap items-center gap-2 text-base m-0" data-pagefind-meta="title">
<a href={`#${anchorId}`} class="anchor-link group/anchor flex items-center gap-1.5 no-underline">
<code class="text-base p-0 bg-transparent border-none text-accent" data-pagefind-index-attrs="data-key" data-key={attribute.key}>{attribute.key}</code>
<code class="text-base p-0 bg-transparent border-none text-accent" data-pagefind-index-attrs="data-key" data-key={attribute.key}><DottedName name={attribute.key} /></code>
<svg class="anchor-icon w-4 h-4 text-text-muted opacity-0 group-hover/anchor:opacity-100 transition-opacity" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
Expand Down Expand Up @@ -72,14 +73,14 @@ const examples = attribute.examples ?? (attribute.example !== undefined ? [attri

<div class="flex flex-col gap-2">
{attribute.apply_scrubbing.reason && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Scrubbing Reason</span>
<span class="text-text-secondary" set:html={renderInlineMarkdown(attribute.apply_scrubbing.reason)} />
</div>
)}

{examples.length > 0 && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">{attribute.examples ? 'Examples' : 'Example'}</span>
<span class="flex flex-wrap gap-1">
{examples.map((example) => (
Expand All @@ -90,24 +91,24 @@ const examples = attribute.examples ?? (attribute.example !== undefined ? [attri
)}

{attribute.enum_values && attribute.enum_values.length > 0 && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Well-defined Values</span>
<ul class="flex flex-col gap-1 m-0 list-none p-0">
{attribute.enum_values.map(({ value, brief }) => (
<li class="flex items-baseline gap-2">
<code class="text-xs">{value}</code>
{brief && <span class="text-xs text-text-secondary" set:html={renderInlineMarkdown(brief)} />}
<code class="text-xs shrink-0 max-w-full">{value}</code>
{brief && <span class="text-xs text-text-secondary min-w-0" set:html={renderInlineMarkdown(brief)} />}
</li>
))}
</ul>
</div>
)}

{attribute.alias && attribute.alias.length > 0 && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Aliases</span>
<span class="text-text-secondary">
{attribute.alias.map((a) => <span class="mr-1"><AttributeLink name={a} /></span>)}
<span class="flex flex-wrap gap-1">
{attribute.alias.map((a) => <AttributeLink name={a} />)}
</span>
</div>
)}
Expand All @@ -119,12 +120,12 @@ const examples = attribute.examples ?? (attribute.example !== undefined ? [attri
<InfoTooltip text="How this attribute is exposed in Sentry search. Query it by this name instead of the attribute key." />
</div>
<div class="flex flex-col gap-1.5">
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[84px] flex-shrink-0" title="The name to use when querying this attribute in Sentry search">Name</span>
<code class="text-xs">{attribute.search_alias.name}</code>
</div>

<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[84px] flex-shrink-0" title="The type Sentry search exposes for this attribute">Type</span>
{attribute.search_alias.type ? (
<code class="text-xs">{attribute.search_alias.type}</code>
Expand All @@ -136,7 +137,7 @@ const examples = attribute.examples ?? (attribute.example !== undefined ? [attri
</div>

{attribute.search_alias.deprecated_aliases && attribute.search_alias.deprecated_aliases.length > 0 && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[84px] flex-shrink-0" title="Deprecated names that are still accepted in search queries">Deprecated</span>
<span class="flex flex-wrap items-baseline gap-1">
{attribute.search_alias.deprecated_aliases.map((a) => (
Expand All @@ -150,7 +151,7 @@ const examples = attribute.examples ?? (attribute.example !== undefined ? [attri
)}

{attribute.has_dynamic_suffix && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Dynamic Suffix</span>
<span class="text-text-secondary">Yes - the key contains dynamic parts</span>
</div>
Expand Down
3 changes: 2 additions & 1 deletion docs/src/components/AttributeLink.astro
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
---
import { attributeUrl } from '../utils/attributeUrl';
import DottedName from './DottedName.astro';

interface Props {
name: string;
Expand All @@ -9,4 +10,4 @@ const { name } = Astro.props;
const href = attributeUrl(name, import.meta.env.BASE_URL);
---

<a href={href} class="text-accent hover:text-accent-hover"><code class="text-xs">{name}</code></a>
<a href={href} class="text-accent hover:text-accent-hover"><code class="inline-block text-xs"><DottedName name={name} /></code></a>
12 changes: 12 additions & 0 deletions docs/src/components/DottedName.astro
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
// Renders a dotted name like `gen_ai.usage.input_tokens` with a line break
// opportunity after each dot, so long names wrap at segment boundaries on
// narrow screens instead of mid-word.
interface Props {
name: string;
}

const parts = Astro.props.name.split('.');
---

{parts.map((part, i) => (i < parts.length - 1 ? <>{part}.<wbr /></> : part))}
11 changes: 6 additions & 5 deletions docs/src/components/MetricCard.astro
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import OtelBadge from './OtelBadge.astro';
import TypeBadge from './TypeBadge.astro';
import AttributeLink from './AttributeLink.astro';
import DottedName from './DottedName.astro';
import type { Metric } from '../content.config';
import { renderInlineMarkdown } from '../utils/markdown';

Expand All @@ -27,9 +28,9 @@ const requirementLabels = {
data-pagefind-body
>
<div class="flex flex-wrap items-start justify-between gap-3 mb-3">
<h3 class="flex items-center gap-2 text-base m-0" data-pagefind-meta="title">
<h3 class="flex flex-wrap items-center gap-2 text-base m-0" data-pagefind-meta="title">
<a href={`#${anchorId}`} class="anchor-link group/anchor flex items-center gap-1.5 no-underline">
<code class="text-base p-0 bg-transparent border-none text-accent">{metric.key}</code>
<code class="text-base p-0 bg-transparent border-none text-accent"><DottedName name={metric.key} /></code>
<svg class="anchor-icon w-4 h-4 text-text-muted opacity-0 group-hover/anchor:opacity-100 transition-opacity" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"/>
<path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"/>
Expand All @@ -45,18 +46,18 @@ const requirementLabels = {
<p class="text-sm text-text-secondary mb-4 leading-relaxed" set:html={renderInlineMarkdown(metric.brief)} />

<div class="flex flex-col gap-2">
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Unit</span>
<code class="text-xs">{metric.unit}</code>
</div>

<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Requirement</span>
<span class="text-text-secondary">{requirementLabels[metric.requirement_level]}</span>
</div>

{metric.attributes && metric.attributes.length > 0 && (
<div class="flex items-baseline gap-3 text-sm">
<div class="flex flex-col items-start gap-1 text-sm sm:flex-row sm:items-baseline sm:gap-3">
<span class="text-text-muted min-w-[100px] flex-shrink-0">Attributes</span>
<span class="flex flex-wrap gap-1">
{metric.attributes.map((attribute) => <AttributeLink name={attribute} />)}
Expand Down
6 changes: 4 additions & 2 deletions docs/src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@
}

body {
@apply font-sans text-base leading-relaxed text-text-primary bg-bg-primary min-h-screen antialiased;
@apply font-sans text-base leading-relaxed text-text-primary bg-bg-primary min-h-screen antialiased wrap-break-word;
}

h1,
Expand Down Expand Up @@ -219,8 +219,10 @@
@apply text-accent transition-colors duration-fast;
}

/* Attribute keys and example values are long unbroken tokens. Let them wrap
anywhere so they can't push their container past the viewport on mobile. */
code {
@apply font-mono text-[0.9em] px-2 py-1 bg-bg-elevated rounded-sm border border-border;
@apply font-mono text-[0.9em] px-2 py-1 bg-bg-elevated rounded-sm border border-border wrap-anywhere;
Comment thread
cursor[bot] marked this conversation as resolved.
Resolved
}

pre {
Expand Down
Loading