diff --git a/ecosystem-explorer/src/features/java-agent/components/attribute-table.tsx b/ecosystem-explorer/src/features/java-agent/components/attribute-table.tsx index 079cac2d..bc33b274 100644 --- a/ecosystem-explorer/src/features/java-agent/components/attribute-table.tsx +++ b/ecosystem-explorer/src/features/java-agent/components/attribute-table.tsx @@ -13,52 +13,82 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { useState } from "react"; import type { Attribute } from "@/types/javaagent"; +import { ChevronDown } from "lucide-react"; interface AttributeTableProps { attributes: Attribute[]; + expandVersion?: number; + collapseVersion?: number; } -export function AttributeTable({ attributes }: AttributeTableProps) { +export function AttributeTable({ attributes, expandVersion = 0, collapseVersion = 0 }: AttributeTableProps) { + const [isOpen, setIsOpen] = useState(false); + const [prevExpand, setPrevExpand] = useState(expandVersion); + const [prevCollapse, setPrevCollapse] = useState(collapseVersion); + + if (expandVersion > prevExpand) { + setPrevExpand(expandVersion); + setIsOpen(true); + } + + if (collapseVersion > prevCollapse) { + setPrevCollapse(collapseVersion); + setIsOpen(false); + } + if (attributes.length === 0) { return null; } return ( -
- - - - - - - - - {attributes.map((attr, index) => ( - - - +
setIsOpen((e.target as HTMLDetailsElement).open)} + className="group border-border/30 bg-card/50 overflow-hidden rounded-lg border open:bg-transparent" + > + + + View {attributes.length} Attribute{attributes.length === 1 ? "" : "s"} + + + +
+
- Key - - Type -
{attr.name} - - {attr.type} - -
+ + + + - ))} - -
+ Key + + Type +
-
+ + + {attributes.map((attr, index) => ( + + {attr.name} + + + {attr.type} + + + + ))} + + + + ); } diff --git a/ecosystem-explorer/src/features/java-agent/components/telemetry-section.tsx b/ecosystem-explorer/src/features/java-agent/components/telemetry-section.tsx index 39dcda8c..a2fa3d1e 100644 --- a/ecosystem-explorer/src/features/java-agent/components/telemetry-section.tsx +++ b/ecosystem-explorer/src/features/java-agent/components/telemetry-section.tsx @@ -22,9 +22,15 @@ import type { Telemetry } from "@/types/javaagent"; interface TelemetrySectionProps { telemetry: Telemetry[]; + expandVersion?: number; + collapseVersion?: number; } -export function TelemetrySection({ telemetry }: TelemetrySectionProps) { +export function TelemetrySection({ + telemetry, + expandVersion = 0, + collapseVersion = 0 +}: TelemetrySectionProps) { const [selectedWhen, setSelectedWhen] = useState(telemetry[0]?.when ?? "default"); // Validate selected value and fall back to first option if invalid @@ -90,11 +96,12 @@ export function TelemetrySection({ telemetry }: TelemetrySectionProps) { {/* Attributes section */} {metric.attributes && metric.attributes.length > 0 && ( -
-

- Attributes -

- +
+
)}
@@ -128,11 +135,12 @@ export function TelemetrySection({ telemetry }: TelemetrySectionProps) { {/* Attributes section */} {span.attributes && span.attributes.length > 0 && ( -
-

- Attributes -

- +
+
)}
diff --git a/ecosystem-explorer/src/features/java-agent/instrumentation-detail-page.tsx b/ecosystem-explorer/src/features/java-agent/instrumentation-detail-page.tsx index fd92b887..468c4d07 100644 --- a/ecosystem-explorer/src/features/java-agent/instrumentation-detail-page.tsx +++ b/ecosystem-explorer/src/features/java-agent/instrumentation-detail-page.tsx @@ -25,6 +25,8 @@ import { AlertCircle, Loader2, HelpCircle, + ChevronsDown, + ChevronsUp, } from "lucide-react"; import { BackButton } from "@/components/ui/back-button"; @@ -39,6 +41,8 @@ import { getSemanticConventionInfo, getFeatureInfo, } from "./utils/format"; +import { getBadgeInfo } from "./utils/badge-info"; +import { TelemetryBadges } from "./components/instrumentation-badges"; import { TelemetrySection } from "./components/telemetry-section"; import { TelemetryComparisonSection } from "./components/telemetry-comparison/telemetry-comparison-section"; import { VersionSelector } from "./components/version-selector"; @@ -76,6 +80,8 @@ export function InstrumentationDetailPage() { const navigate = useNavigate(); const [showComparison, setShowComparison] = useState(false); const [activeTab, setActiveTab] = useState("details"); + const [expandVersion, setExpandVersion] = useState(0); + const [collapseVersion, setCollapseVersion] = useState(0); const { data: versionsData, loading: versionsLoading } = useVersions(); @@ -156,6 +162,7 @@ export function InstrumentationDetailPage() { const displayName = getInstrumentationDisplayName(instrumentation); const showRawName = instrumentation.display_name && instrumentation.display_name !== instrumentation.name; + const badgeInfo = getBadgeInfo(instrumentation); return ( @@ -217,6 +224,7 @@ export function InstrumentationDetailPage() { ? "Disabled by Default" : "Enabled by Default"} + @@ -275,6 +283,80 @@ export function InstrumentationDetailPage() {
+ {/* Value Proposition Summary */} + {(badgeInfo.hasMetrics || badgeInfo.hasSpans) && ( +
+ Telemetry Overview +
+ {badgeInfo.hasSpans && ( + +
+
+
+ )} + + {badgeInfo.hasMetrics && ( + +
+
+
+ )} +
+
+ )} {((instrumentation.features && instrumentation.features.length > 0) || (instrumentation.semantic_conventions && instrumentation.semantic_conventions.length > 0)) && ( @@ -494,7 +576,7 @@ export function InstrumentationDetailPage() { {instrumentation.telemetry && instrumentation.telemetry.length > 0 ? (
-
+
+ + {!showComparison && instrumentation.telemetry && instrumentation.telemetry.length > 0 && ( +
+ +
+ +
+ )}
{!showComparison ? ( - + ) : ( versionsData && (