: unknown attribute "${key}". Check ${CONVENTIONS_URL}attributes/`
+ );
+ }
+ return {key, notes, attribute};
+ });
+
+ return (
+
+
+
+ | Attribute |
+ Type |
+ Description |
+ Example |
+
+
+
+ {rows.map(({key, notes, attribute}) => (
+
+
+
+ {key}
+
+ |
+ {attribute.type} |
+
+
+ |
+
+ {attribute.example !== undefined && (
+ {formatExample(attribute.example)}
+ )}
+ |
+
+ ))}
+
+
+ );
+}
+
+function describe(attribute: AttributeMetadata, notes?: string) {
+ const {deprecation} = attribute;
+ const deprecated = deprecation
+ ? `**Deprecated**${deprecation.replacement ? `, use \`${deprecation.replacement}\` instead` : ''}.`
+ : undefined;
+ return [deprecated, attribute.brief, notes].filter(Boolean).join(' ');
+}
+
+function InlineMarkdown({source}: {source: string}) {
+ // Unwrap the single paragraph so table rows keep a compact, aligned layout.
+ const html = micromark(source)
+ .replace(/^/, '')
+ .replace(/<\/p>$/, '');
+ // Content comes from the pinned conventions package and our own MDX, not user input.
+ return ;
+}
+
+// Mirrors attributeUrl() in sentry-conventions/docs/src/utils/attributeUrl.ts.
+export function conventionsUrl(key: string) {
+ const category = key.includes('.') ? key.split('.')[0] : 'general';
+ const slug = key.replace(/\./g, '-').replace(/[<>]/g, '');
+ return `${CONVENTIONS_URL}attributes/${category}/#${slug}`;
+}
+
+function formatExample(example: AttributeValue) {
+ return typeof example === 'string' ? `"${example}"` : JSON.stringify(example);
+}
diff --git a/src/mdxComponents.ts b/src/mdxComponents.ts
index 13d823b180d63..27d17c1f72fe1 100644
--- a/src/mdxComponents.ts
+++ b/src/mdxComponents.ts
@@ -12,6 +12,7 @@ import {CommunitySupportedPlatforms} from './components/communitySupportedPlatfo
import {ConfigKey} from './components/configKey';
import {ConfigValue} from './components/configValue';
import {ContentSeparator} from './components/contentSeparator';
+import {ConventionAttributes} from './components/conventionAttributes';
import {CopyableCard} from './components/copyableCard';
import {CreateGitHubAppForm} from './components/createGitHubAppForm';
import {DefinitionList} from './components/definitionList';
@@ -82,6 +83,7 @@ export function mdxComponents(
CliChecksumTable,
CommunitySupportedPlatforms,
ContentSeparator,
+ ConventionAttributes,
DevDocsCardGrid,
PlatformFilter,
CodeBlock,
From d021e0c3dbff60110ef2a39495b3f6c76c77c980 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johannes=20Daxb=C3=B6ck?=
Date: Thu, 5 Nov 2026 14:13:12 +0100
Subject: [PATCH 2/5] ref(develop-docs): Simplify ConventionAttributes
component
Keep the table close to the Markdown tables it replaces. Drop the per-key
links, the deprecated prefix, and the InlineMarkdown wrapper, and shorten
the unknown-attribute error. Add one link under each table to the
attribute category page in Sentry Conventions instead.
Co-Authored-By: Claude Opus 5.5
---
.../conventionAttributes/index.spec.tsx | 31 +----
src/components/conventionAttributes/index.tsx | 120 +++++++-----------
2 files changed, 52 insertions(+), 99 deletions(-)
diff --git a/src/components/conventionAttributes/index.spec.tsx b/src/components/conventionAttributes/index.spec.tsx
index d17402a031272..ae1da6bb7c4af 100644
--- a/src/components/conventionAttributes/index.spec.tsx
+++ b/src/components/conventionAttributes/index.spec.tsx
@@ -3,13 +3,13 @@ import React from 'react';
import {renderToStaticMarkup} from 'react-dom/server';
import {describe, expect, it, vi} from 'vitest';
-import {ConventionAttributes, conventionsUrl} from './index';
+import {ConventionAttributes} from './index';
// Vitest compiles JSX with the classic runtime here (tsconfig `jsx: preserve`).
vi.stubGlobal('React', React);
describe('ConventionAttributes', () => {
- it('renders type and description from the conventions package', () => {
+ it('renders attributes from the conventions package with a category link', () => {
const html = renderToStaticMarkup(
);
@@ -17,6 +17,9 @@ describe('ConventionAttributes', () => {
expect(html).toContain('gen_ai.tool.name');
expect(html).toContain(ATTRIBUTE_METADATA['gen_ai.tool.name'].type);
expect(html).toContain(ATTRIBUTE_METADATA['gen_ai.tool.name'].brief);
+ expect(html).toContain(
+ 'href="https://getsentry.github.io/sentry-conventions/attributes/gen_ai/"'
+ );
});
it('appends page-specific notes to the description', () => {
@@ -29,33 +32,9 @@ describe('ConventionAttributes', () => {
expect(html).toContain('[2]');
});
- it('marks deprecated attributes with their replacement', () => {
- const html = renderToStaticMarkup();
-
- expect(html).toContain('Deprecated');
- expect(html).toContain('server.address');
- });
-
it('throws on unknown attributes so the build fails', () => {
expect(() =>
renderToStaticMarkup()
).toThrow('unknown attribute "gen_ai.not.a.thing"');
});
});
-
-describe('conventionsUrl', () => {
- it('links to the category page anchor', () => {
- expect(conventionsUrl('gen_ai.usage.input_tokens')).toBe(
- 'https://getsentry.github.io/sentry-conventions/attributes/gen_ai/#gen_ai-usage-input_tokens'
- );
- });
-
- it('handles keys without a namespace and dynamic suffixes', () => {
- expect(conventionsUrl('environment')).toBe(
- 'https://getsentry.github.io/sentry-conventions/attributes/general/#environment'
- );
- expect(conventionsUrl('http.request.header.')).toBe(
- 'https://getsentry.github.io/sentry-conventions/attributes/http/#http-request-header-key'
- );
- });
-});
diff --git a/src/components/conventionAttributes/index.tsx b/src/components/conventionAttributes/index.tsx
index 5416f5e3544f8..2b82f8cd35472 100644
--- a/src/components/conventionAttributes/index.tsx
+++ b/src/components/conventionAttributes/index.tsx
@@ -4,100 +4,74 @@ import {
type AttributeValue,
} from '@sentry/conventions/attributes';
import {micromark} from 'micromark';
-
-const CONVENTIONS_URL = 'https://getsentry.github.io/sentry-conventions/';
-
-type AttributeRow =
- | string
- | {
- key: string;
- /** Markdown appended to the conventions description, such as footnote references. */
- notes?: string;
- };
+import {Fragment} from 'react';
type Props = {
- attributes: AttributeRow[];
+ attributes: (string | {key: string; notes?: string})[];
};
const metadata: Record = ATTRIBUTE_METADATA;
/**
- * Renders attribute details straight from `@sentry/conventions`, so pages don't copy
- * types, descriptions, and examples that then drift from the source of truth.
- *
- * Page-specific context, such as footnotes, stays in the MDX and is passed per row.
+ * Renders attribute details from `@sentry/conventions`, so pages don't copy
+ * types, descriptions, and examples that drift from the source of truth.
*/
export function ConventionAttributes({attributes}: Props) {
const rows = attributes.map(row => {
const {key, notes} = typeof row === 'string' ? {key: row} : row;
const attribute = metadata[key];
if (!attribute) {
- // Fail the build so typos and removed attributes don't ship as empty rows.
- throw new Error(
- `: unknown attribute "${key}". Check ${CONVENTIONS_URL}attributes/`
- );
+ throw new Error(`: unknown attribute "${key}"`);
}
- return {key, notes, attribute};
+ const description = micromark([attribute.brief, notes].filter(Boolean).join(' '))
+ .replace(/^/, '')
+ .replace(/<\/p>$/, '');
+ return {key, attribute, description};
});
+ const firstKey = rows[0].key;
+ const category = firstKey.includes('.') ? firstKey.split('.')[0] : 'general';
return (
-
-
-
- | Attribute |
- Type |
- Description |
- Example |
-
-
-
- {rows.map(({key, notes, attribute}) => (
-
-
-
- {key}
-
- |
- {attribute.type} |
-
-
- |
-
- {attribute.example !== undefined && (
- {formatExample(attribute.example)}
- )}
- |
+
+
+
+
+ | Attribute |
+ Type |
+ Description |
+ Example |
- ))}
-
-
+
+
+ {rows.map(({key, attribute, description}) => (
+
+
+ {key}
+ |
+ {attribute.type} |
+ |
+
+ {attribute.example !== undefined && (
+ {formatExample(attribute.example)}
+ )}
+ |
+
+ ))}
+
+
+
+ See all{' '}
+
+ {category} attributes in Sentry Conventions
+
+ .
+
+
);
}
-function describe(attribute: AttributeMetadata, notes?: string) {
- const {deprecation} = attribute;
- const deprecated = deprecation
- ? `**Deprecated**${deprecation.replacement ? `, use \`${deprecation.replacement}\` instead` : ''}.`
- : undefined;
- return [deprecated, attribute.brief, notes].filter(Boolean).join(' ');
-}
-
-function InlineMarkdown({source}: {source: string}) {
- // Unwrap the single paragraph so table rows keep a compact, aligned layout.
- const html = micromark(source)
- .replace(/^/, '')
- .replace(/<\/p>$/, '');
- // Content comes from the pinned conventions package and our own MDX, not user input.
- return ;
-}
-
-// Mirrors attributeUrl() in sentry-conventions/docs/src/utils/attributeUrl.ts.
-export function conventionsUrl(key: string) {
- const category = key.includes('.') ? key.split('.')[0] : 'general';
- const slug = key.replace(/\./g, '-').replace(/[<>]/g, '');
- return `${CONVENTIONS_URL}attributes/${category}/#${slug}`;
-}
-
function formatExample(example: AttributeValue) {
return typeof example === 'string' ? `"${example}"` : JSON.stringify(example);
}
From 418cb56985559a27ee26866ddc0371f596da6b64 Mon Sep 17 00:00:00 2001
From: "sentry-junior[bot]"
<264270552+sentry-junior[bot]@users.noreply.github.com>
Date: Fri, 6 Nov 2026 08:51:43 +0000
Subject: [PATCH 3/5] feat(develop-docs): Render attribute notes from
sentry-conventions
Replace the hand-written notes prop with the additionalContext notes from
@sentry/conventions. Notes render as a numbered list under the table, and
attributes that share a note link to the same number, so pages no longer
maintain footnotes for attributes the component renders.
---
.../conventionAttributes/index.spec.tsx | 21 ++++++--
src/components/conventionAttributes/index.tsx | 53 +++++++++++++++----
2 files changed, 59 insertions(+), 15 deletions(-)
diff --git a/src/components/conventionAttributes/index.spec.tsx b/src/components/conventionAttributes/index.spec.tsx
index ae1da6bb7c4af..4c335d3fc89e0 100644
--- a/src/components/conventionAttributes/index.spec.tsx
+++ b/src/components/conventionAttributes/index.spec.tsx
@@ -22,14 +22,25 @@ describe('ConventionAttributes', () => {
);
});
- it('appends page-specific notes to the description', () => {
+ it('renders additional context as numbered notes, shared notes once', () => {
+ const keys = ['gen_ai.usage.input_tokens', 'gen_ai.usage.output_tokens'];
+ const html = renderToStaticMarkup();
+ const notes = [
+ ...new Set(keys.flatMap(key => ATTRIBUTE_METADATA[key].additionalContext ?? [])),
+ ];
+
+ expect(notes.length).toBeGreaterThan(0);
+ expect(html.match(/
{
const html = renderToStaticMarkup(
-
+
);
- expect(html).toContain('[2]');
+ expect(html).not.toContain('');
});
it('throws on unknown attributes so the build fails', () => {
diff --git a/src/components/conventionAttributes/index.tsx b/src/components/conventionAttributes/index.tsx
index 2b82f8cd35472..ed7cfa25ce218 100644
--- a/src/components/conventionAttributes/index.tsx
+++ b/src/components/conventionAttributes/index.tsx
@@ -7,29 +7,33 @@ import {micromark} from 'micromark';
import {Fragment} from 'react';
type Props = {
- attributes: (string | {key: string; notes?: string})[];
+ attributes: string[];
};
const metadata: Record = ATTRIBUTE_METADATA;
/**
* Renders attribute details from `@sentry/conventions`, so pages don't copy
- * types, descriptions, and examples that drift from the source of truth.
+ * types, descriptions, examples, and notes that drift from the source of truth.
+ * Each attribute's `additionalContext` becomes a numbered note under the table.
+ * Attributes that share a note point to the same number.
*/
export function ConventionAttributes({attributes}: Props) {
- const rows = attributes.map(row => {
- const {key, notes} = typeof row === 'string' ? {key: row} : row;
+ const notes: string[] = [];
+ const rows = attributes.map(key => {
const attribute = metadata[key];
if (!attribute) {
throw new Error(`: unknown attribute "${key}"`);
}
- const description = micromark([attribute.brief, notes].filter(Boolean).join(' '))
- .replace(/^/, '')
- .replace(/<\/p>$/, '');
- return {key, attribute, description};
+ const noteNumbers = (attribute.additionalContext ?? []).map(note => {
+ const index = notes.indexOf(note);
+ return index === -1 ? notes.push(note) : index + 1;
+ });
+ return {key, attribute, noteNumbers};
});
const firstKey = rows[0].key;
const category = firstKey.includes('.') ? firstKey.split('.')[0] : 'general';
+ const noteId = (n: number) => `${firstKey.replace(/\./g, '-')}-note-${n}`;
return (
@@ -43,13 +47,25 @@ export function ConventionAttributes({attributes}: Props) {
- {rows.map(({key, attribute, description}) => (
+ {rows.map(({key, attribute, noteNumbers}) => (
{key}
|
{attribute.type} |
- |
+
+
+ {noteNumbers.map(n => (
+
+ {' '}
+
+ [{n}]
+
+
+ ))}
+ |
{attribute.example !== undefined && (
{formatExample(attribute.example)}
@@ -59,6 +75,17 @@ export function ConventionAttributes({attributes}: Props) {
))}
|
+ {notes.length > 0 && (
+
+ {notes.map((note, i) => (
+
+ ))}
+
+ )}
See all{' '}
/, '')
+ .replace(/<\/p>$/, '');
+}
+
function formatExample(example: AttributeValue) {
return typeof example === 'string' ? `"${example}"` : JSON.stringify(example);
}
From 23302c901e5b83bfb229b41f98051f4678144ab7 Mon Sep 17 00:00:00 2001
From: "sentry-junior[bot]"
<264270552+sentry-junior[bot]@users.noreply.github.com>
Date: Fri, 6 Nov 2026 08:52:51 +0000
Subject: [PATCH 4/5] ref(develop-docs): Render attribute note markers as
superscript
---
src/components/conventionAttributes/index.spec.tsx | 4 +++-
src/components/conventionAttributes/index.tsx | 9 +++------
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/src/components/conventionAttributes/index.spec.tsx b/src/components/conventionAttributes/index.spec.tsx
index 4c335d3fc89e0..4e86ef4125b64 100644
--- a/src/components/conventionAttributes/index.spec.tsx
+++ b/src/components/conventionAttributes/index.spec.tsx
@@ -31,7 +31,9 @@ describe('ConventionAttributes', () => {
expect(notes.length).toBeGreaterThan(0);
expect(html.match(/- [1]'
+ );
expect(html).toContain('id="gen_ai-usage-input_tokens-note-1"');
});
diff --git a/src/components/conventionAttributes/index.tsx b/src/components/conventionAttributes/index.tsx
index ed7cfa25ce218..d3c2f60ddb196 100644
--- a/src/components/conventionAttributes/index.tsx
+++ b/src/components/conventionAttributes/index.tsx
@@ -58,12 +58,9 @@ export function ConventionAttributes({attributes}: Props) {
dangerouslySetInnerHTML={{__html: inlineMarkdown(attribute.brief)}}
/>
{noteNumbers.map(n => (
-
- {' '}
-
- [{n}]
-
-
+
+ [{n}]
+
))}
From f5522cbeb612c25d558fdaf8df1c536433d19d36 Mon Sep 17 00:00:00 2001
From: "sentry-junior[bot]"
<264270552+sentry-junior[bot]@users.noreply.github.com>
Date: Fri, 6 Nov 2026 09:05:08 +0000
Subject: [PATCH 5/5] fix(develop-docs): Quote stringified JSON examples in
ConventionAttributes
String examples were wrapped in raw double quotes, so JSON strings such as
gen_ai.tool.call.arguments rendered as broken nested quotes. Single-quote
strings that contain double quotes, matching the Markdown tables, and use
JSON.stringify for everything else.
---
src/components/conventionAttributes/index.spec.tsx | 10 ++++++++++
src/components/conventionAttributes/index.tsx | 7 ++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/components/conventionAttributes/index.spec.tsx b/src/components/conventionAttributes/index.spec.tsx
index 4e86ef4125b64..e2a9f6d933399 100644
--- a/src/components/conventionAttributes/index.spec.tsx
+++ b/src/components/conventionAttributes/index.spec.tsx
@@ -45,6 +45,16 @@ describe('ConventionAttributes', () => {
expect(html).not.toContain('');
});
+ it('single-quotes string examples that contain double quotes', () => {
+ const html = renderToStaticMarkup(
+
+ );
+ const example = String(ATTRIBUTE_METADATA['gen_ai.tool.call.arguments'].example);
+
+ expect(example).toContain('"');
+ expect(html).toContain(`'${example.replace(/"/g, '"')}'`);
+ });
+
it('throws on unknown attributes so the build fails', () => {
expect(() =>
renderToStaticMarkup()
diff --git a/src/components/conventionAttributes/index.tsx b/src/components/conventionAttributes/index.tsx
index d3c2f60ddb196..c88e76da4c3cd 100644
--- a/src/components/conventionAttributes/index.tsx
+++ b/src/components/conventionAttributes/index.tsx
@@ -102,6 +102,11 @@ function inlineMarkdown(text: string) {
.replace(/<\/p>$/, '');
}
+// Single-quote strings that contain double quotes, such as stringified JSON,
+// so they read as `'{"max":10}'` instead of escaped JSON.
function formatExample(example: AttributeValue) {
- return typeof example === 'string' ? `"${example}"` : JSON.stringify(example);
+ if (typeof example === 'string' && example.includes('"') && !example.includes("'")) {
+ return `'${example}'`;
+ }
+ return JSON.stringify(example);
}
|