Skip to content
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

fix(prometheusrule): set nindent to 2 #1431

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wallchristopher
Copy link

Fixes #1428

If default rules are enabled and passing in additional groups, there appears to be whitespace mismatch causing helm template to error out. Giving Error: YAML parse error on opentelemetry-collector/templates/prometheusrule.yaml: error converting YAML to JSON: yaml: line 24: did not find expected key

Setting either the nindent to 2 or moving all defualt rules by two spaces fixes the issue.

Template using test values

spec:                                                                                                                                                                                                                                                  
  groups:                                                                                                                                                                                                                                              
    - name: additionalCollectorRules                                                                                                                                                                                                                   
      rules:                                                                                                               
      - alert: ExporterQueueFull                    
        annotations:                                                                                                       
          description: Queue of exporter whatever is more than 90% full
        expr: 100 * sum by (exporter) (otelcol_exporter_queue_size) / sum by (exporter)                                    
          (otelcol_exporter_queue_capacity) > 90                                                                           
        for: 2m                                                                                                            
        labels:                                                                                                            
          severity: critical                     
  - name: collectorRules
    rules:                                             
    - alert: ReceiverDroppedSpans               
      expr: rate(otelcol_receiver_refused_spans[5m]) > 0
      for: 2m                                                                                                              
      labels:                                                                                                              
        severity: critical                
      annotations:                                                                                                         
        description: 'The {{ $labels.receiver }} receiver is dropping spans at a rate of {{ humanize $value }} per second ' 
        runbook_url: 'https://github.com/open-telemetry/opentelemetry-collector/blob/main/docs/monitoring.md#receive-failures'

Test Values

serviceMonitor:
  enabled: true

prometheusRule:
  enabled: true
  groups:
  - name: additionalCollectorRules
    rules:
    - alert: ExporterQueueFull
      expr: 100 * sum by (exporter) (otelcol_exporter_queue_size) / sum by (exporter) (otelcol_exporter_queue_capacity) > 90
      for: 2m
      labels:
        severity: critical
      annotations:
        description: Queue of exporter whatever is more than 90% full
  defaultRules:
    enabled: true

If default rules are enabled and passing in additional groups, there
appears to be whitespace missmatch causing helm template to error out.

Setting either the nindent to 2 or moving all defualt rules by two
spaces fixes the issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[collector] failing to add additional groups in prometheus rules
1 participant