Skip to content
Merged
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
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ update-file-format:
done

.PHONY: fix-language-implementations
fix-language-implementations:
fix-language-implementations: compile-schema
npm run-script fix-language-implementations || exit 1; \

.PHONY: generate-markdown
Expand Down
43 changes: 41 additions & 2 deletions examples/kitchen-sink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,47 @@ tracer_provider:
ratio: 0.01
local_parent_sampled:
composite/development:
probability:
ratio: 0.001
# Configure sampler to be rule_based.
rule_based:
# The rules for the sampler, matched in order. Each rule can have multiple match conditions - the sampler will be applied if all match.
# If no conditions are specified, the rule matches all spans that reach it. If no rules match, the span is not sampled.
rules:
- attribute_values:
key: http.route
values:
- /healthz
- /livez
# Configure sampler when matched.
sampler:
# Configure sampler to be always_off if matched.
always_off:
# Configure a sampling rule matching http.path attribute patterns.
- attribute_patterns:
key: http.path
included:
- /internal/*
excluded:
- /internal/special/*
# Configure sampler when matched.
sampler:
# Configure sampler to be always_on if matched.
always_on:
# Configure a sampling rule matching root spans with CLIENT span kind.
- parent:
- none
span_kinds:
- client
sampler:
# Configure sampler to be probability if matched.
probability:
ratio: 0.05
- sampler:
probability:
# Configure ratio.
# If omitted or null, 1.0 is used.
ratio: 0.001
# Configure local_parent_not_sampled sampler.
# If omitted or null, always_off is used.
local_parent_not_sampled:
always_off:
tracer_configurator/development:
Expand Down
136 changes: 136 additions & 0 deletions opentelemetry_configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,114 @@
}
}
},
"ExperimentalComposableRuleBasedSampler": {
"type": [
"object",
"null"
],
"additionalProperties": false,
"properties": {
"rules": {
"type": [
"array",
"null"
],
"items": {
"$ref": "#/$defs/ExperimentalComposableRuleBasedSamplerRule"
},
"description": "The rules for the sampler, matched in order. If no rules match, the span is not sampled.\nIf omitted or null, no span is sampled.\n"
}
}
},
"ExperimentalComposableRuleBasedSamplerRule": {
"type": "object",
"description": "A rule for ExperimentalComposableRuleBasedSampler. A rule can have multiple match conditions - the sampler will be applied if all match. \nIf no conditions are specified, the rule matches all spans that reach it.\n",
"additionalProperties": false,
"properties": {
"attribute_values": {
"$ref": "#/$defs/ExperimentalComposableRuleBasedSamplerRuleAttributeValues",
"description": "Values to match against a single attribute. Non-string attributes are matched using their string representation:\nfor example, a value of \"404\" would match the http.response.status_code 404. For array attributes, if any\nitem matches, it is considered a match.\nIf omitted, ignore.\n"
},
"attribute_patterns": {
"$ref": "#/$defs/ExperimentalComposableRuleBasedSamplerRuleAttributePatterns",
"description": "Patterns to match against a single attribute. Non-string attributes are matched using their string representation:\nfor example, a pattern of \"4*\" would match any http.response.status_code in 400-499. For array attributes, if any\nitem matches, it is considered a match.\nIf omitted, ignore.\n"
},
"span_kinds": {
"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/SpanKind"
},
"description": "The span kinds to match. If the span's kind matches any of these, it matches.\nIf omitted, ignore.\n"
},
"parent": {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found that a useful predicate for rule based sampling is no_local_parent, which nicely identifies service head spans. This, of course, in addition to is_trace_root. I realize that the proposed parent rule is expressive enough, but it is more verbose.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with keeping the parent enum since then we don't have to worry about "what if both are set" type of situations. I guess in terms of verbosity, parent: LOCAL is similar to no_local_parent: true? Possibly helped by removing the SAMPLED state from the enum, let me know if it looks fine now

"type": "array",
"minItems": 1,
"items": {
"$ref": "#/$defs/ExperimentalSpanParent"
},
"description": "The parent span types to match.\nIf omitted, ignore.\n"
},
"sampler": {
"$ref": "#/$defs/ExperimentalComposableSampler",
"description": "The sampler to use for matching spans.\nProperty is required and must be non-null.\n"
}
},
"required": [
"sampler"
]
},
"ExperimentalComposableRuleBasedSamplerRuleAttributePatterns": {
"type": "object",
"additionalProperties": false,
"properties": {
"key": {
"type": "string",
"description": "The attribute key to match against.\nProperty is required and must be non-null.\n"
},
"included": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"description": "Configure list of value patterns to include.\nValues are evaluated to match as follows:\n * If the value exactly matches.\n * If the value matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nIf omitted, all values are included.\n"
},
"excluded": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"description": "Configure list of value patterns to exclude. Applies after .included (i.e. excluded has higher priority than included).\nValues are evaluated to match as follows:\n * If the value exactly matches.\n * If the value matches the wildcard pattern, where '?' matches any single character and '*' matches any number of characters including none.\nIf omitted, .included attributes are included.\n"
}
},
"required": [
"key"
]
},
"ExperimentalComposableRuleBasedSamplerRuleAttributeValues": {
"type": "object",
"additionalProperties": false,
"properties": {
"key": {
"type": "string",
"description": "The attribute key to match against.\nProperty is required and must be non-null.\n"
},
"values": {
"type": "array",
"minItems": 1,
"items": {
"type": "string"
},
"description": "The attribute values to match against. If the attribute's value matches any of these, it matches.\nProperty is required and must be non-null.\n"
}
},
"required": [
"key",
"values"
]
},
"ExperimentalComposableSampler": {
"type": "object",
"additionalProperties": {
Expand All @@ -543,6 +651,10 @@
"probability": {
"$ref": "#/$defs/ExperimentalComposableProbabilitySampler",
"description": "Configure sampler to be probability.\nIf omitted, ignore.\n"
},
"rule_based": {
"$ref": "#/$defs/ExperimentalComposableRuleBasedSampler",
"description": "Configure sampler to be rule_based.\nIf omitted, ignore.\n"
}
}
},
Expand Down Expand Up @@ -1055,6 +1167,17 @@
],
"additionalProperties": false
},
"ExperimentalSpanParent": {
"type": [
"string",
"null"
],
"enum": [
"none",
"remote",
"local"
]
},
"ExperimentalTracerConfig": {
"type": [
"object"
Expand Down Expand Up @@ -2028,6 +2151,19 @@
}
}
},
"SpanKind": {
"type": [
"string",
"null"
],
"enum": [
"internal",
"server",
"client",
"producer",
"consumer"
]
},
"SpanLimits": {
"type": "object",
"additionalProperties": false,
Expand Down
Loading
Loading