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

enhancement(sinks): Allow Encoding config to only/except list fields #1915

Merged
merged 45 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
689d4ac
Initial EncodingConfig
Hoverbear Feb 24, 2020
6cf4cae
Improve EncodingConfig
Hoverbear Feb 24, 2020
caec215
Update other sinks
Hoverbear Feb 24, 2020
d645f98
Cleanup
Hoverbear Feb 24, 2020
75491c4
Fixup splunk
Hoverbear Feb 24, 2020
855f6e8
Fix kinesis
Hoverbear Feb 24, 2020
9c5da70
wip checkpoint
Hoverbear Feb 25, 2020
55a4741
Additional implementations
Hoverbear Feb 25, 2020
5a256f6
Play with schemas a bit more
Hoverbear Feb 25, 2020
a536c4a
Merge branch 'master' into encoding-config
Hoverbear Feb 25, 2020
9d9ad4c
Support timestamp_format
Hoverbear Feb 25, 2020
3fafb90
Merge branch 'master' into encoding-config
Hoverbear Feb 26, 2020
b1407ca
Merge branch 'master' into encoding-config
Hoverbear Feb 26, 2020
d79871d
Update schema
Hoverbear Feb 26, 2020
fd0b308
Merge branch 'master' into encoding-config
Hoverbear Feb 26, 2020
599572f
Conquer the schema dragons
Hoverbear Feb 26, 2020
4e70216
Fix benches
Hoverbear Feb 26, 2020
8d5717d
Correct all defaults
Hoverbear Feb 27, 2020
09e1be5
Final touchups
Hoverbear Feb 27, 2020
495f571
Fixup clickhouse
Hoverbear Feb 27, 2020
4913fe5
Abstract EncodingConfiguration
Hoverbear Feb 27, 2020
853883f
fmt
Hoverbear Feb 27, 2020
903a525
Fix a newline
Hoverbear Feb 27, 2020
de5f1a8
Fix integration tests
Hoverbear Feb 27, 2020
c6dde21
Improve generate
Hoverbear Feb 27, 2020
cb550c1
fmt
Hoverbear Mar 2, 2020
6e9db9d
Reflect defaults
Hoverbear Mar 2, 2020
879c59a
Fix benches
Hoverbear Mar 2, 2020
d12faeb
Remove random folder
Hoverbear Mar 2, 2020
b85b7b1
Merge branch 'master' into encoding-config
Hoverbear Mar 2, 2020
17b2d21
Fix feature tests
Hoverbear Mar 2, 2020
6bc1956
Fix firehose tests
Hoverbear Mar 3, 2020
9b4b501
Fix broken tests
Hoverbear Mar 3, 2020
cd8350d
Fix kafka encoding default
Hoverbear Mar 3, 2020
3364a44
Test tweaks
Hoverbear Mar 3, 2020
2320020
format -> codec
Hoverbear Mar 3, 2020
bb56ae2
Merge branch 'master' into encoding-config
Hoverbear Mar 3, 2020
5c1769d
remove annoying attributes
LucioFranco Mar 4, 2020
00da854
Change defaults
Hoverbear Mar 4, 2020
3bfb77d
Move validate into deser
Hoverbear Mar 4, 2020
a6cb1e2
Fixup a test
Hoverbear Mar 4, 2020
402e8b3
Merge branch 'master' into encoding-config
Hoverbear Mar 4, 2020
ccb502c
Fixup InnerWithDefaults
Hoverbear Mar 4, 2020
55346a5
remove Inner impls
Hoverbear Mar 4, 2020
81a49d8
Rejigger encodings to use into better
Hoverbear Mar 5, 2020
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
53 changes: 53 additions & 0 deletions .meta/_partials/_encoding.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[<%= namespace %>.encoding]
type = "table"
common = true
description = """\
Configures the encoding specific sink behavior.\
"""

[<%= namespace %>.encoding.children.format]
type = "string"
common = true
<% if default %>
required = false
default = <%= default.to_toml %>
examples = <%= encodings.to_toml %>
<% else %>
required = true
examples = <%= encodings.to_toml %>
<% end %>
description = """\
The encoding format used to serialize the events before outputting.\
"""

[<%= namespace %>.encoding.children.format.enum]
<%- if encodings.include?("text") -%>text = "Each event is encoded into text via the `message` key and the payload is new line delimited."<%- end -%>
<%- if encodings.include?("json") -%>json = "Each event is encoded into JSON and the payload is represented as a JSON array."<%- end -%>
<%- if encodings.include?("ndjson") -%>ndjson = "Each event is encoded into JSON and the payload is new line delimited."<%- end -%>
<%- if encodings.include?("default") -%>default = "Each event is encoded according to the default for this sink."<%- end -%>

[<%= namespace %>.encoding.children.only_fields]
type = "[string]"
required = false
examples = [["timestamp", "message", "host"]]
description = """\
Limit the sink to only encoding the specified labels.\
"""

[<%= namespace %>.encoding.children.except_fields]
type = "[string]"
required = false
examples = [["timestamp", "message", "host"]]
description = """\
Prevent the sink from encoding the specified labels.\
"""

[<%= namespace %>.encoding.children.timestamp_format]
type = "string"
required = false
default = "rfc3339"
description = "How to format event timestamps."

[<%= namespace %>.encoding.children.timestamp_format.enum]
rfc3339 = "Format as an RFC3339 string"
unix = "Format as a unix timestamp, can be parsed as a Clickhouse DateTime"
17 changes: 5 additions & 12 deletions .meta/sinks/aws_cloudwatch_logs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ write_to_description = "[Amazon Web Service's CloudWatch Logs service][urls.aws_
timeout_secs: 30
) %>

[sinks.aws_cloudwatch_logs.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.aws_cloudwatch_logs.options.encoding.enum]
json = "Each event is encoded into JSON and the payload is represented as a JSON array."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.aws_cloudwatch_logs.options",
encodings: ["json", "text"],
default: "text"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.aws_cloudwatch_logs.options.group_name]
type = "string"
Expand Down
17 changes: 5 additions & 12 deletions .meta/sinks/aws_kinesis_firehose.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ write_to_description = "[Amazon Web Service's Kinesis Data Firehose][urls.aws_ki
timeout_secs: 30
) %>

[sinks.aws_kinesis_firehose.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.aws_kinesis_firehose.options.encoding.enum]
json = "Each event is encoded into JSON and the payload is represented as a JSON array."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.aws_kinesis_firehose.options",
encodings: ["json", "text"],
default: "text"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.aws_kinesis_firehose.options.stream_name]
type = "string"
Expand Down
17 changes: 5 additions & 12 deletions .meta/sinks/aws_kinesis_streams.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,11 @@ write_to_description = "[Amazon Web Service's Kinesis Data Stream service][urls.
timeout_secs: 30
) %>

[sinks.aws_kinesis_streams.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.aws_kinesis_streams.options.encoding.enum]
json = "Each event is encoded into JSON and the payload is represented as a JSON array."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.aws_kinesis_streams.options",
encodings: ["json", "text"],
default: "text"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.aws_kinesis_streams.options.partition_key_field]
type = "string"
Expand Down
16 changes: 4 additions & 12 deletions .meta/sinks/aws_s3.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,10 @@ examples = ["my-bucket"]
required = true
description = "The S3 bucket name. Do not include a leading `s3://` or a trailing `/`."

[sinks.aws_s3.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.aws_s3.options.encoding.enum]
ndjson = "Each event is encoded into JSON and the payload is new line delimited."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.aws_s3.options",
encodings: ["ndjson", "text"], default: false
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.aws_s3.options.filename_append_uuid]
type = "bool"
Expand Down
21 changes: 5 additions & 16 deletions .meta/sinks/clickhouse.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,19 +94,8 @@ common = true
examples = ["mydatabase"]
description = "The database that contains the stable that data will be inserted into."

[sinks.clickhouse.options.encoding]
type = "table"
common = true
required = false
description = "Customize how events are encoded."

[sinks.clickhouse.options.encoding.children.timestamp_format]
type = "string"
common = true
required = false
default = "rfc3339"
description = "How to format event timestamps. Formats such as unix can be parsed as a Clickhouse DateTime, however, this loses precision as DateTimes are defined in seconds."

[sinks.clickhouse.options.encoding.children.timestamp_format.enum]
rfc3339 = "Format as an RFC3339 string"
unix = "Format as a unix timestamp, can be parsed as a Clickhouse DateTime"
<%= render("_partials/_encoding.toml",
namespace: "sinks.clickhouse.options",
encodings: ["default"],
default: "default"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>
13 changes: 1 addition & 12 deletions .meta/sinks/console.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,7 @@ write_to_description = "[standard output streams][urls.standard_streams], such a

<%= render("_partials/_component_options.toml", type: "sink", name: "console") %>

[sinks.console.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.console.options.encoding.enum]
json = "Each event is encoded into JSON."
text = "Each event is encoded into text via the `message` key."
<%= render("_partials/_encoding.toml", namespace: "sinks.console.options", encodings: ["json", "text"], default: false) %>
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved

[sinks.console.options.target]
type = "string"
Expand Down
6 changes: 6 additions & 0 deletions .meta/sinks/elasticsearch.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ write_to_description = "[Elasticsearch][urls.elasticsearch] via the [`_bulk` API
timeout_secs: 60
) %>

<%= render("_partials/_encoding.toml",
namespace: "sinks.elasticsearch.options",
encodings: ["default"],
default: "default"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.elasticsearch.options.auth]
type = "table"
common = false
Expand Down
17 changes: 5 additions & 12 deletions .meta/sinks/file.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,11 @@ write_to_description = "a file"

<%= render("_partials/_component_options.toml", type: "sink", name: "file") %>

[sinks.file.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.file.options.encoding.enum]
ndjson = "Each event is encoded into JSON and the payload is new line delimited."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.file.options",
encodings: ["text", "ndjson"],
default: false
) %>

[sinks.file.options.path]
type = "string"
Expand Down
15 changes: 5 additions & 10 deletions .meta/sinks/gcp_cloud_storage.toml
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,11 @@ default = "log"
required = true
description = "The filename extension to use in the object name."

[sinks.gcp_cloud_storage.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = "The encoding format used to serialize the events before outputting."

[sinks.gcp_cloud_storage.options.encoding.enum]
ndjson = "Each event is encoded into JSON and the payload is new line delimited."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.gcp_cloud_storage.options",
encodings: ["ndjson", "text"],
default: "text"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.gcp_cloud_storage.options.compression]
type = "string"
Expand Down
2 changes: 2 additions & 0 deletions .meta/sinks/gcp_pubsub.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,5 @@ common = false
required = true
examples = ["this-is-a-topic"]
description = "The topic within the project to which to publish logs."

<%= render("_partials/_encoding.toml", namespace: "sinks.gcp_pubsub.options", encodings: ["default"], default: "default") %>
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 6 additions & 0 deletions .meta/sinks/gcp_stackdriver_logging.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,9 @@ For example, Compute Engine VM instances use the labels `projectId`, \
"""

<%= render("_partials/_tls_connector_options.toml", namespace: "sinks.gcp_stackdriver_logging.options", can_enable: false, can_verify: true) %>

<%= render("_partials/_encoding.toml",
namespace: "sinks.gcp_stackdriver_logging.options",
encodings: ["default"],
default: "default"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>
18 changes: 5 additions & 13 deletions .meta/sinks/http.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,11 @@ outputting.\
none = "The payload will not be compressed."
gzip = "The payload will be compressed in [Gzip][urls.gzip] format before being sent."

[sinks.http.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.http.options.encoding.enum]
json = "Each event is encoded into JSON and the payload is represented as a JSON array."
ndjson = "Each event is encoded into JSON and the payload is new line delimited."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."
<%= render("_partials/_encoding.toml",
namespace: "sinks.http.options",
encodings: ["json", "ndjson", "text"],
default: "text"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>

[sinks.http.options.headers]
type = "table"
Expand Down
6 changes: 6 additions & 0 deletions .meta/sinks/humio_logs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,9 @@ type = "string"
examples = ["http://myhumiohost.com"]
required = false
description = "The optional host to send Humio logs to."

<%= render("_partials/_encoding.toml",
namespace: "sinks.humio_logs.options",
encodings: ["json"],
default: "json"
) %>
18 changes: 5 additions & 13 deletions .meta/sinks/kafka.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,19 +26,11 @@ A comma delimited list of host and port pairs that the Kafka client should conta
its cluster metadata.\
"""

[sinks.kafka.options.encoding]
type = "string"
category = "requests"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.kafka.options.encoding.enum]
json = "Each event is encoded into JSON and the payload is represented as a JSON array."
text = "Each event is encoded into text via the `message` key and the payload is new line delimited."

<%= render("_partials/_encoding.toml",
namespace: "sinks.kafka.options",
encodings: ["json", "text"],
default: false
) %>

[sinks.kafka.options.key_field]
type = "string"
Expand Down
6 changes: 6 additions & 0 deletions .meta/sinks/logdna.toml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,9 @@ required = false
examples = ["vector", "myapp"]
default = "vector"
description = "The default app that will be set for events that do not contain a `file` or `app` field."

<%= render("_partials/_encoding.toml",
namespace: "sinks.logdna.options",
encodings: ["default"],
default: "default"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>
16 changes: 5 additions & 11 deletions .meta/sinks/loki.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,11 @@ required = true
examples = ["http://localhost:3100", "http://127.0.0.1:8080"]
description = "The endpoint used to ship logs to."

[sinks.loki.options.encoding]
type = "string"
common = true
required = true
description = """\
The encoding format used to serialize the events before outputting.\
"""

[sinks.loki.options.encoding.enum]
json = "Each event is encoded into JSON"
text = "Each event is encoded into text via the `message` key."
<%= render("_partials/_encoding.toml",
namespace: "sinks.loki.options",
encodings: ["json", "text"],
default: "json"
) %>

[sinks.loki.options.tenant_id]
type = "string"
Expand Down
6 changes: 6 additions & 0 deletions .meta/sinks/new_relic_logs.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,9 @@ description = "The API region to send logs to."
[sinks.new_relic_logs.options.region.enum]
us = "The US region"
eu = "The EU region"

<%= render("_partials/_encoding.toml",
namespace: "sinks.new_relic_logs.options",
encodings: ["json"],
default: "json"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>
6 changes: 6 additions & 0 deletions .meta/sinks/sematext.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ type = "string"
required = true
examples = ["${SEMATEXT_TOKEN_ENV_VAR}", "some-sematext-token"]
description = "The token that will be used to write to Sematext."

<%= render("_partials/_encoding.toml",
namespace: "sinks.sematext_logs.options",
encodings: ["default"],
default: "default"
Hoverbear marked this conversation as resolved.
Show resolved Hide resolved
) %>
Loading