Skip to content

Commit 66fcc0e

Browse files
authored
feat(explorer): display feature descriptions on instrumentation detai… (#221)
1 parent 94784d9 commit 66fcc0e

3 files changed

Lines changed: 102 additions & 11 deletions

File tree

ecosystem-explorer/src/features/java-agent/instrumentation-detail-page.tsx

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { GlowBadge } from "@/components/ui/glow-badge";
3131
import { DetailCard } from "@/components/ui/detail-card";
3232
import { SectionHeader } from "@/components/ui/section-header";
3333
import { useVersions, useInstrumentation } from "@/hooks/use-javaagent-data";
34-
import { getInstrumentationDisplayName, getSemanticConventionInfo } from "./utils/format";
34+
import { getInstrumentationDisplayName, getSemanticConventionInfo, getFeatureInfo } from "./utils/format";
3535
import { TelemetrySection } from "./components/telemetry-section";
3636

3737
function buildSourceUrl(sourcePath: string): string {
@@ -372,15 +372,27 @@ export function InstrumentationDetailPage() {
372372
<div className="space-y-3">
373373
<h3 className="text-sm font-medium text-muted-foreground">Features</h3>
374374
<ul className="space-y-2">
375-
{instrumentation.features.map((feature, index) => (
376-
<li key={index} className="flex items-start gap-2 text-sm">
377-
<Check
378-
className="mt-0.5 h-4 w-4 flex-shrink-0 text-primary"
379-
aria-hidden="true"
380-
/>
381-
<span>{feature}</span>
382-
</li>
383-
))}
375+
{instrumentation.features.map((feature, index) => {
376+
const info = getFeatureInfo(feature);
377+
return (
378+
<li key={index} className="flex items-start gap-2 text-sm">
379+
<Check
380+
className="mt-0.5 h-4 w-4 flex-shrink-0 text-primary"
381+
aria-hidden="true"
382+
/>
383+
<div>
384+
<span className="font-medium">
385+
{info ? info.label : feature}
386+
</span>
387+
{info && (
388+
<p className="mt-0.5 text-xs text-muted-foreground">
389+
{info.description}
390+
</p>
391+
)}
392+
</div>
393+
</li>
394+
);
395+
})}
384396
</ul>
385397
</div>
386398
</DetailCard>

ecosystem-explorer/src/features/java-agent/utils/format.test.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
import { describe, it, expect } from "vitest";
17-
import { getInstrumentationDisplayName, getSemanticConventionInfo } from "./format";
17+
import { getInstrumentationDisplayName, getSemanticConventionInfo, getFeatureInfo } from "./format";
1818
import type { InstrumentationData } from "@/types/javaagent";
1919

2020
describe("getInstrumentationDisplayName", () => {
@@ -124,3 +124,38 @@ describe("getSemanticConventionInfo", () => {
124124
expect(getSemanticConventionInfo("")).toBeNull();
125125
});
126126
});
127+
128+
describe("getFeatureInfo", () => {
129+
it("returns label and description for a known value", () => {
130+
const info = getFeatureInfo("LOGGING_BRIDGE");
131+
expect(info).toEqual({
132+
label: "Logging Bridge",
133+
description:
134+
"Bridges logging framework events to the OpenTelemetry Logs API, emitting log records from standard logging frameworks.",
135+
});
136+
});
137+
138+
it("returns label and description for HTTP_ROUTE", () => {
139+
const info = getFeatureInfo("HTTP_ROUTE");
140+
expect(info).toEqual({
141+
label: "HTTP Route",
142+
description: "Enriches HTTP spans with route information.",
143+
});
144+
});
145+
146+
it("returns label and description for RESOURCE_DETECTOR", () => {
147+
const info = getFeatureInfo("RESOURCE_DETECTOR");
148+
expect(info).toEqual({
149+
label: "Resource Detector",
150+
description: "Sets resource attributes based on certain conditions.",
151+
});
152+
});
153+
154+
it("returns null for an unknown value", () => {
155+
expect(getFeatureInfo("UNKNOWN_FEATURE")).toBeNull();
156+
});
157+
158+
it("returns null for an empty string", () => {
159+
expect(getFeatureInfo("")).toBeNull();
160+
});
161+
});

ecosystem-explorer/src/features/java-agent/utils/format.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,50 @@ export function getSemanticConventionInfo(value: string): SemanticConventionInfo
9191
return SEMANTIC_CONVENTION_MAP[value] ?? null;
9292
}
9393

94+
export interface FeatureInfo {
95+
label: string;
96+
description: string;
97+
}
98+
99+
const FEATURE_MAP: Record<string, FeatureInfo> = {
100+
HTTP_ROUTE: {
101+
label: "HTTP Route",
102+
description: "Enriches HTTP spans with route information.",
103+
},
104+
CONTEXT_PROPAGATION: {
105+
label: "Context Propagation",
106+
description:
107+
"Propagates context inter-process (via headers in HTTP, gRPC, and messaging) and inter-thread (executors, actors, and reactive streams).",
108+
},
109+
AUTO_INSTRUMENTATION_SHIM: {
110+
label: "Auto Instrumentation Shim",
111+
description: "Adapts or bridges instrumentation from upstream libraries or frameworks.",
112+
},
113+
CONTROLLER_SPANS: {
114+
label: "Controller Spans",
115+
description:
116+
"Generates spans for controller/handler methods in web frameworks. Disabled by default and experimental.",
117+
},
118+
VIEW_SPANS: {
119+
label: "View Spans",
120+
description:
121+
"Generates spans for view rendering such as templates or JSP. Disabled by default and experimental.",
122+
},
123+
LOGGING_BRIDGE: {
124+
label: "Logging Bridge",
125+
description:
126+
"Bridges logging framework events to the OpenTelemetry Logs API, emitting log records from standard logging frameworks.",
127+
},
128+
RESOURCE_DETECTOR: {
129+
label: "Resource Detector",
130+
description: "Sets resource attributes based on certain conditions.",
131+
},
132+
};
133+
134+
export function getFeatureInfo(value: string): FeatureInfo | null {
135+
return FEATURE_MAP[value] ?? null;
136+
}
137+
94138
export function getInstrumentationDisplayName(instrumentation: InstrumentationData): string {
95139
if (instrumentation.display_name) {
96140
return instrumentation.display_name;

0 commit comments

Comments
 (0)