Skip to content

Instantly share code, notes, and snippets.

@tdarwin
Created May 24, 2024 17:02
Show Gist options
  • Save tdarwin/b62f5677869ee7f718b11d0e7e903c3b to your computer and use it in GitHub Desktop.
Save tdarwin/b62f5677869ee7f718b11d0e7e903c3b to your computer and use it in GitHub Desktop.
starter-refinery-rules
RulesVersion: 2
Samplers:
__default__:
RulesBasedSampler:
Rules:
- Name: Keep 500 status codes
SampleRate: 1
Conditions:
- Fields:
- http.status_code
- http.response.status_code
Operator: '>='
Value: 500
Datatype: int
- Name: Keep Type 2 GRPC Status Codes
SampleRate: 1
Conditions:
- Field: status_code
Operator: ">="
Value: 2
Datatype: int
- Name: Keep where error field exists
SampleRate: 1
Conditions:
- Field: error
Operator: exists
- Name: drop healthchecks
Drop: true
Scope: span
Conditions:
- Field: root.http.route
Operator: starts-with
Value: /healthz
- Fields:
- http.status_code
- http.response.status_code
Operator: "="
Value: 200
Datatype: int
- Name: Keep long duration traces
SampleRate: 1
Scope: span
Conditions:
- Field: trace.parent_id
Operator: not-exists
- Field: duration_ms
Operator: ">="
Value: 5000
Datatype: int
- Name: Dynamically Sample 200s through 400s
Conditions:
- Fields:
- http.status_code
- http.response.status_code
Operator: ">="
Value: 200
Datatype: int
Sampler:
EMADynamicSampler:
GoalSampleRate: 10 # This is a sample rate itself
FieldList:
- service.name
- http.route
- http.method
- Name: Dynamically Sample Non-HTTP Request
Conditions:
- Field: status_code
Operator: "<"
Value: 2
Datatype: int
Sampler:
EMADynamicSampler:
GoalSampleRate: 10 # This is a sample rate itself
FieldList:
- service.name
- grpc.method
- grpc.service
- Name: Catchall rule
Sampler:
EMAThroughputSampler:
GoalThroughputPerSec: 500 # This is spans per second for the entire cluster
UseClusterSize: true # Ensures GoalThroughputPerSec is for the full refinery cluster and not per node
FieldList:
- service.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment