Skip to content

Update applies_to Stack/Serverless/Deploy/Product render order #1727

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
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
12 changes: 12 additions & 0 deletions docs/syntax/applies.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@
:::{include} /contribute/_snippets/tag-processing.md
:::

### Badge rendering order

`applies_to` badges are displayed in a consistent order regardless of how they appear in your source files. This ensures users always see badges in a predictable hierarchy:

1. **Stack** - Elastic Stack
2. **Serverless** - Elastic Cloud Serverless offerings
3. **Deployment** - Deployment options (ECE, ECK, ECH, Self-Managed)
4. **ProductApplicability** - Specialized tools and agents (ECCTL, Curator, EDOT, APM Agents)
5. **Product (generic)** - Generic product applicability

Within the ProductApplicability category, EDOT and APM Agent items are sorted alphabetically for easy scanning.

## When and where to use `applies_to`

The `applies_to` metadata can be added at different levels in the documentation:
Expand Down Expand Up @@ -252,7 +264,7 @@

### Block

```{applies_to}

Check notice on line 267 in docs/syntax/applies.md

View workflow job for this annotation

GitHub Actions / build

The 'planned' lifecycle is deprecated and will be removed in a future release.
stack: preview 9.1
serverless: planned

Expand Down
162 changes: 81 additions & 81 deletions src/Elastic.Markdown/Myst/Components/ApplicableToComponent.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -18,47 +18,6 @@
appliesTo.Stack
)
}
@if (appliesTo.Deployment is not null)
{
if (appliesTo.Deployment.Ece is not null)
{
@RenderProduct("ECE",
"Elastic Cloud Enterprise",
VersioningSystemId.Ece,
appliesTo.Deployment.Ece
)
}

if (appliesTo.Deployment.Eck is not null)
{
@RenderProduct(
"ECK",
"Elastic Cloud on Kubernetes",
VersioningSystemId.Eck,
appliesTo.Deployment.Eck
)
}

if (appliesTo.Deployment.Ess is not null)
{
@RenderProduct(
"ECH",
"Elastic Cloud Hosted",
VersioningSystemId.Ess,
appliesTo.Deployment.Ess
)
}

if (appliesTo.Deployment.Self is not null)
{
@RenderProduct(
"Self-Managed",
"Self-managed Elastic deployments",
VersioningSystemId.Self,
appliesTo.Deployment.Self
)
}
}
@if (appliesTo.Serverless is not null)
{
if (appliesTo.Serverless.AllProjects is not null)
Expand Down Expand Up @@ -103,9 +62,46 @@
}
}
}
@if (appliesTo.Product is not null)
@if (appliesTo.Deployment is not null)
{
@RenderProduct("", "", VersioningSystemId.All, appliesTo.Product)
if (appliesTo.Deployment.Ece is not null)
{
@RenderProduct("ECE",
"Elastic Cloud Enterprise",
VersioningSystemId.Ece,
appliesTo.Deployment.Ece
)
}

if (appliesTo.Deployment.Eck is not null)
{
@RenderProduct(
"ECK",
"Elastic Cloud on Kubernetes",
VersioningSystemId.Eck,
appliesTo.Deployment.Eck
)
}

if (appliesTo.Deployment.Ess is not null)
{
@RenderProduct(
"ECH",
"Elastic Cloud Hosted",
VersioningSystemId.Ess,
appliesTo.Deployment.Ess
)
}

if (appliesTo.Deployment.Self is not null)
{
@RenderProduct(
"Self-Managed",
"Self-managed Elastic deployments",
VersioningSystemId.Self,
appliesTo.Deployment.Self
)
}
}
@if (appliesTo.ProductApplicability is not null)
{
Expand All @@ -120,101 +116,105 @@
@RenderProduct("Curator", "Curator", VersioningSystemId.Curator, pa.Curator)
}

if (pa.ApmAgentAndroid is not null)
if (pa.EdotAndroid is not null)
{
@RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
@RenderProduct("EDOT Android", "Elastic Distribution of OpenTelemetry Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
}

if (pa.ApmAgentDotnet is not null)
if (pa.EdotCfAws is not null)
{
@RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
@RenderProduct("EDOT CF AWS", "Elastic Distribution of OpenTelemetry Cloud Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
}

if (pa.ApmAgentGo is not null)
if (pa.EdotCollector is not null)
{
@RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
@RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector)
}

if (pa.ApmAgentIos is not null)
if (pa.EdotDotnet is not null)
{
@RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
@RenderProduct("EDOT .NET", "Elastic Distribution of OpenTelemetry .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
}

if (pa.ApmAgentJava is not null)
if (pa.EdotIos is not null)
{
@RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
@RenderProduct("EDOT iOS", "Elastic Distribution of OpenTelemetry iOS", VersioningSystemId.EdotIos, pa.EdotIos)
}

if (pa.ApmAgentNode is not null)
if (pa.EdotJava is not null)
{
@RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
@RenderProduct("EDOT Java", "Elastic Distribution of OpenTelemetry Java", VersioningSystemId.EdotJava, pa.EdotJava)
}

if (pa.ApmAgentPhp is not null)
if (pa.EdotNode is not null)
{
@RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
@RenderProduct("EDOT Node.js", "Elastic Distribution of OpenTelemetry Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
}

if (pa.ApmAgentPython is not null)
if (pa.EdotPhp is not null)
{
@RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
@RenderProduct("EDOT PHP", "Elastic Distribution of OpenTelemetry PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
}

if (pa.ApmAgentRuby is not null)
if (pa.EdotPython is not null)
{
@RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
@RenderProduct("EDOT Python", "Elastic Distribution of OpenTelemetry Python", VersioningSystemId.EdotPython, pa.EdotPython)
}

if (pa.ApmAgentRum is not null)
if (pa.ApmAgentAndroid is not null)
{
@RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
@RenderProduct("APM Agent Android", "Application Performance Monitoring Agent for Android", VersioningSystemId.ApmAgentAndroid, pa.ApmAgentAndroid)
}

if (pa.EdotIos is not null)
if (pa.ApmAgentDotnet is not null)
{
@RenderProduct("EDOT iOS", "Elastic Distribution of OpenTelemetry iOS", VersioningSystemId.EdotIos, pa.EdotIos)
@RenderProduct("APM Agent .NET", "Application Performance Monitoring Agent for .NET", VersioningSystemId.ApmAgentDotnet, pa.ApmAgentDotnet)
}

if (pa.EdotAndroid is not null)
if (pa.ApmAgentGo is not null)
{
@RenderProduct("EDOT Android", "Elastic Distribution of OpenTelemetry Android", VersioningSystemId.EdotAndroid, pa.EdotAndroid)
@RenderProduct("APM Agent Go", "Application Performance Monitoring Agent for Go", VersioningSystemId.ApmAgentGo, pa.ApmAgentGo)
}

if (pa.EdotDotnet is not null)
if (pa.ApmAgentIos is not null)
{
@RenderProduct("EDOT .NET", "Elastic Distribution of OpenTelemetry .NET", VersioningSystemId.EdotDotnet, pa.EdotDotnet)
@RenderProduct("APM Agent iOS", "Application Performance Monitoring Agent for iOS", VersioningSystemId.ApmAgentIos, pa.ApmAgentIos)
}

if (pa.EdotJava is not null)
if (pa.ApmAgentJava is not null)
{
@RenderProduct("EDOT Java", "Elastic Distribution of OpenTelemetry Java", VersioningSystemId.EdotJava, pa.EdotJava)
@RenderProduct("APM Agent Java", "Application Performance Monitoring Agent for Java", VersioningSystemId.ApmAgentJava, pa.ApmAgentJava)
}

if (pa.EdotNode is not null)
if (pa.ApmAgentNode is not null)
{
@RenderProduct("EDOT Node.js", "Elastic Distribution of OpenTelemetry Node.js", VersioningSystemId.EdotNode, pa.EdotNode)
@RenderProduct("APM Agent Node.js", "Application Performance Monitoring Agent for Node.js", VersioningSystemId.ApmAgentNode, pa.ApmAgentNode)
}

if (pa.EdotPhp is not null)
if (pa.ApmAgentPhp is not null)
{
@RenderProduct("EDOT PHP", "Elastic Distribution of OpenTelemetry PHP", VersioningSystemId.ApmAgentPhp, pa.EdotPhp)
@RenderProduct("APM Agent PHP", "Application Performance Monitoring Agent for PHP", VersioningSystemId.ApmAgentPhp, pa.ApmAgentPhp)
}

if (pa.EdotPython is not null)
if (pa.ApmAgentPython is not null)
{
@RenderProduct("EDOT Python", "Elastic Distribution of OpenTelemetry Python", VersioningSystemId.EdotPython, pa.EdotPython)
@RenderProduct("APM Agent Python", "Application Performance Monitoring Agent for Python", VersioningSystemId.ApmAgentPython, pa.ApmAgentPython)
}

if (pa.EdotCfAws is not null)
if (pa.ApmAgentRuby is not null)
{
@RenderProduct("EDOT CF AWS", "Elastic Distribution of OpenTelemetry Cloud Forwarder for AWS", VersioningSystemId.EdotCfAws, pa.EdotCfAws)
@RenderProduct("APM Agent Ruby", "Application Performance Monitoring Agent for Ruby", VersioningSystemId.ApmAgentRuby, pa.ApmAgentRuby)
}

if (pa.EdotCollector is not null)
if (pa.ApmAgentRum is not null)
{
@RenderProduct("EDOT Collector", "Elastic Distribution of OpenTelemetry Collector", VersioningSystemId.EdotCollector, pa.EdotCollector)
@RenderProduct("APM Agent RUM", "Application Performance Monitoring Agent for Real User Monitoring", VersioningSystemId.ApmAgentRum, pa.ApmAgentRum)
}
}
@if (appliesTo.Product is not null)
{
@RenderProduct("", "", VersioningSystemId.All, appliesTo.Product)
}

@functions {

Expand Down
29 changes: 29 additions & 0 deletions tests/authoring/Applicability/AppliesToFrontMatter.fs
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,32 @@ applies_to:
[<Fact>]
let ``does not render label`` () =
markdown |> appliesTo (Unchecked.defaultof<ApplicableTo>)

type ``parses applies_to with multiple categories in any order`` () =
static let markdown = frontMatter """
applies_to:
product: ga
deployment:
eck: ga 9.0
serverless:
security: ga 9.0.0
stack: ga 9.1
ecctl: ga 10.0
apm_agent_dotnet: ga 9.0
"""
[<Fact>]
let ``parses all categories regardless of YAML order`` () =
markdown |> appliesTo (ApplicableTo(
Stack=AppliesCollection.op_Explicit "ga 9.1",
Serverless=ServerlessProjectApplicability(
Security=AppliesCollection.op_Explicit "ga 9.0.0"
),
Deployment=DeploymentApplicability(
Eck=AppliesCollection.op_Explicit "ga 9.0"
),
ProductApplicability=ProductApplicability(
Ecctl=AppliesCollection.op_Explicit "ga 10.0",
ApmAgentDotnet=AppliesCollection.op_Explicit "ga 9.0"
),
Product=AppliesCollection.op_Explicit "ga"
))
Loading