Skip to content

Commit

Permalink
Update throttle.cue with encoding and mode configs
Browse files Browse the repository at this point in the history
  • Loading branch information
jutley committed Sep 15, 2022
1 parent b65250d commit fbe5764
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions website/cue/reference/components/transforms/throttle.cue
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,104 @@ components: transforms: throttle: {
}

configuration: {
encoding: {
common: false
description: """
The encoding to use when throttling using the `bytes` unit. Each event will be encoded in
order to count the bytes to use for rate limiting. Be aware that this extra encoding will
create CPU overhead for each event.
This field is required if `unit` is set to `bytes`.
"""
required: true
relevant_when: "mode = `bytes`"
examples: [{codec: "text"}]
type: object: {
options: {
codec: {
description: "The encoding codec used to serialize the events before outputting."
required: true
type: string: {
examples: features.send.encoding.codec.enum
enum: {
for codec in features.send.encoding.codec.enum {
if codec == "text" {
text: "The message field from the event."
}
if codec == "logfmt" {
logfmt: "[logfmt](\(urls.logfmt)) encoded event."
}
if codec == "json" {
json: "JSON encoded event."
}
if codec == "gelf" {
gelf: "[GELF](https://docs.graylog.org/docs/gelf) encoded event."
}
if codec == "avro" {
avro: "Avro encoded event with a given schema."
}
}
}
}
}
avro: {
description: "Options for the `avro` codec."
required: true
relevant_when: "codec = `avro`"
type: object: options: {
schema: {
description: "The Avro schema declaration."
required: true
type: string: {
examples: [
"""
["{ "type": "record", "name": "log", "fields": [{ "name": "message", "type": "string" }] }"]
""",
]
}
}
}
}
except_fields: {
common: false
description: "Prevent the sink from encoding the specified fields."
required: false
type: array: {
default: null
items: type: string: {
examples: ["message", "parent.child"]
syntax: "field_path"
}
}
}
only_fields: {
common: false
description: "Makes the sink encode only the specified fields."
required: false
type: array: {
default: null
items: type: string: {
examples: ["message", "parent.child"]
syntax: "field_path"
}
}
}

timestamp_format: {
common: false
description: "How to format event timestamps."
required: false
type: string: {
default: "rfc3339"
enum: {
rfc3339: "Formats as a RFC3339 string"
unix: "Formats as a unix timestamp"
}
}
}
}
}
}
exclude: {
common: true
description: """
Expand Down Expand Up @@ -62,6 +160,18 @@ components: transforms: throttle: {
unit: null
}
}
mode: {
common: false
description: """
The mode for throttling. Either `events` or `bytes`. If left unspecified, the unit will
default to `events`. The threshold will be measured in terms of the mode.
"""
required: false
type: string: {
default: "events",
examples: ["events", "bytes"]
}
}
window_secs: {
description: """
The time frame in which the configured `threshold` is applied.
Expand Down

0 comments on commit fbe5764

Please sign in to comment.