Skip to content

Commit

Permalink
feat: add analyzer documentation links (#2903)
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgeepc committed Jul 11, 2023
1 parent 2bb345c commit baa93c2
Show file tree
Hide file tree
Showing 23 changed files with 172 additions and 96 deletions.
2 changes: 2 additions & 0 deletions api/linters.yaml
Expand Up @@ -105,6 +105,8 @@ components:
LinterResultPluginRule:
type: object
properties:
id:
type: string
name:
type: string
description:
Expand Down
36 changes: 36 additions & 0 deletions cli/openapi/model_linter_result_plugin_rule.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions server/http/mappings/linter.go
Expand Up @@ -41,6 +41,7 @@ func (m OpenAPI) LinterResultPluginRule(in analyzer.RuleResult) openapi.LinterRe
}

return openapi.LinterResultPluginRule{
Id: in.ID,
Passed: in.Passed,
Description: in.Description,
ErrorDescription: in.ErrorDescription,
Expand Down
48 changes: 24 additions & 24 deletions server/linter/analyzer/analyzer_metadata.go
Expand Up @@ -7,13 +7,13 @@ var (
SecurityID = "security"

// rules
EnsureSpanNamingRuleID string = "span_naming"
RequiredAttributesRuleID string = "required_attributes"
EnsureAttributeNamingRuleID string = "attribute_naming"
NotEmptyAttributesRuleID string = "not_empty_attributes"
EnforceDnsRuleID string = "enforce_dns"
EnforceHttpsProtocolRuleID string = "enforce_https_protocol"
EnsuresNoApiKeyLeakRuleID string = "ensures_no_api_key_leak"
EnsureSpanNamingRuleID string = "span-naming"
RequiredAttributesRuleID string = "required-attributes"
EnsureAttributeNamingRuleID string = "attribute-naming"
NotEmptyAttributesRuleID string = "no-empty-attributes"
EnforceDnsRuleID string = "prefer-dns"
EnforceHttpsProtocolRuleID string = "secure-https-protocol"
EnsuresNoApiKeyLeakRuleID string = "no-api-key-leak"

ErrorLevelWarning string = "warning"
ErrorLevelError string = "error"
Expand All @@ -37,7 +37,7 @@ var (
StandardsPlugin = LinterPlugin{
ID: StandardsID,
Name: "OTel Semantic Conventions",
Description: "Enforce standards for spans and attributes",
Description: "Enforce trace standards following OTel Semantic Conventions",
Enabled: true,
Rules: []LinterRule{
EnsureSpanNamingRule,
Expand All @@ -49,8 +49,8 @@ var (

EnsureSpanNamingRule = LinterRule{
ID: EnsureSpanNamingRuleID,
Name: "Span Name Convention",
Description: "Ensure all spans follow the naming convention",
Name: "Span Naming",
Description: "Enforce span names that identify a class of Spans",
ErrorDescription: "",
Tips: []string{},
Weight: 25,
Expand All @@ -59,8 +59,8 @@ var (

RequiredAttributesRule = LinterRule{
ID: RequiredAttributesRuleID,
Name: "Required Attributes By Span Type",
Description: "Ensure all required attributes are present",
Name: "Required Attributes",
Description: "Enforce required attributes by span type",
ErrorDescription: "This span is missing the following required attributes:",
Tips: []string{"This rule checks if all required attributes are present in spans of given type"},
Weight: 25,
Expand All @@ -70,7 +70,7 @@ var (
EnsureAttributeNamingRule = LinterRule{
ID: EnsureAttributeNamingRuleID,
Name: "Attribute Naming",
Description: "Ensure all attributes follow the naming convention",
Description: "Enforce attribute keys to follow common specifications",
ErrorDescription: "The following attributes do not follow the naming convention:",
Tips: []string{
"You should always add namespaces to your span names to ensure they will not be overwritten",
Expand All @@ -82,8 +82,8 @@ var (

NotEmptyAttributesRule = LinterRule{
ID: NotEmptyAttributesRuleID,
Name: "Not Empty Attributes",
Description: "Does not allow empty attribute values in any span",
Name: "No Empty Attributes",
Description: "Disallow empty attribute values",
ErrorDescription: "The following attributes are empty:",
Tips: []string{"Empty attributes don't provide any information about the operation and should be removed"},
Weight: 25,
Expand All @@ -93,8 +93,8 @@ var (
// common
CommonPlugin = LinterPlugin{
ID: CommonID,
Name: "Common problems",
Description: "Helps you find common problems with your application",
Name: "Common Problems",
Description: "Help you find common mistakes with your application",
Enabled: true,
Rules: []LinterRule{
EnforceDnsRule,
Expand All @@ -103,8 +103,8 @@ var (

EnforceDnsRule = LinterRule{
ID: EnforceDnsRuleID,
Name: "Enforce DNS Over IP usage",
Description: "Enforce DNS usage over IP addresses",
Name: "Prefer DNS",
Description: "Enforce usage of DNS instead of IP addresses",
ErrorDescription: "The following attributes are using IP addresses instead of DNS:",
Tips: []string{},
Weight: 100,
Expand All @@ -115,7 +115,7 @@ var (
SecurityPlugin = LinterPlugin{
ID: SecurityID,
Name: "Security",
Description: "Enforce security for spans and attributes",
Description: "Help you find security problems with your application",
Enabled: true,
Rules: []LinterRule{
EnforceHttpsProtocolRule,
Expand All @@ -125,9 +125,9 @@ var (

EnforceHttpsProtocolRule = LinterRule{
ID: EnforceHttpsProtocolRuleID,
Name: "Enforce HTTPS protocol",
Description: "Ensure all request use https",
ErrorDescription: "The following spans are using http protocol:",
Name: "Secure HTTPS Protocol",
Description: "Enforce usage of secure protocol for HTTP server spans",
ErrorDescription: "The following spans are using insecure http protocol:",
Tips: []string{},
Weight: 30,
ErrorLevel: "error",
Expand All @@ -136,7 +136,7 @@ var (
EnsuresNoApiKeyLeakRule = LinterRule{
ID: EnsuresNoApiKeyLeakRuleID,
Name: "No API Key Leak",
Description: "Ensure no API keys are leaked in http headers",
Description: "Disallow leaked API keys for HTTP spans",
ErrorDescription: "The following attributes are exposing API keys:",
Tips: []string{},
Weight: 70,
Expand Down

0 comments on commit baa93c2

Please sign in to comment.