feat(outputs.zerobus): Add plugin - #19441
Conversation
Add an output plugin that writes metrics to a Unity Catalog Delta table using the Databricks Zerobus Ingest service. The plugin offers a static schema mode that stores metric fields in a VARIANT column of a fixed table, and an opt-in table-schema mode that maps tags and fields onto the columns of the destination table as read from Unity Catalog. Signed-off-by: Zlata Stefanovic <zlata.stefanovic@databricks.com>
|
Download PR build artifacts for linux_amd64.tar.gz, darwin_arm64.tar.gz, and windows_amd64.zip. 📦 Click here to get additional PR build artifactsArtifact URLs |
|
Thank you very much for this awesome contribution @zlata-stefanovic-db! Before we go into a more detailed review, I do have a few questions and suggestions on how we can merge this...
I think that's enough for a first round... ;-) Thanks again and I'm looking forward to getting this ready and merged. |
|
Hi @srebhan thank you a lot for the fast reply!
For the first contribution I’m happy simplify, but I'd like to include some of the throughput enhancing behaviors in follow-ups, since Zerobus is a high-throughput ingestion service where that duplicate/cost issue shows up quickly. Thanks a lot again! |
|
Thanks for the quick response @zlata-stefanovic-db! Let me go through your items...
Will give it a review ASAP.
While I do understand the idea behind this mode I'm worried about the "metric" protobuf definition and the code that comes with it. For me this is not something Telegraf specific but rather a generic time-series representation required for that particular SDK. My concern is that people will want to modify this and we end up maintaining a thing that should not be there in the first place... Edit: Having read PR #19444 wouldn't it be sufficient to define the varadic table in the service and only add an option saying "add all fields to columns X" instead of defining the whole proto here?
To be honest I wish this were implemented in the SDK as it is also useful for other users.
Well Telegraf has the notion of partial writes which allow exactly this, you specify the metrics accepted and the ones which are permanently rejected and all the rest is rescheduled for the next write cycle. Isn't this what you want? |
Yes thank you, I just wanted to suggest this. We can keep the table_schema mode only in the initial PR and treat this as a follow up if you think this approach is acceptable.
Agreed. I'm going to figure out how this can be done within the SDK in the future.
Agreed as well. I’ll drop the plugin-local resume logic and rely on Telegraf’s partial-write handling. |
|
I'll convert this PR to a draft for now so I don't get confused with the other one. :-) |
Summary
Add an output plugin that writes metrics to a Unity Catalog Delta table using the
Databricks Zerobus Ingest service, which accepts records over gRPC and
commits them into Delta directly.
Metrics can already reach Zerobus through the generic
httpoutput by posting JSONrecords to its REST endpoint. A dedicated plugin uses the streaming gRPC API through
a Databricks Go SDK instead, so records are acknowledged individually, retries resume
rather than restart, and the destination table layout is handled by the plugin rather
than assembled by hand in the configuration, and at a much higher throughput.
The plugin has two schema modes:
static(the default) writes one row per metric into a fixed four-column table(
measurement,timestamp_ns,tags,fields) with the metric fields in aVARIANTcolumn, so field names and types can change without altering thedestination table.
table_schemareads the destination table's columns from Unity Catalog and mapstags and fields onto same-named columns, producing a flat, typed row. The schema is
picked up again when the table is altered, without restarting Telegraf.
Other behaviour worth calling out:
acknowledged record.
concurrent_streams(up to 100) spreads one batch across several streams forthroughput on large batches. The README explains when this is worth enabling and
that ordering is only guaranteed per stream.
Dependencies
Adds
github.com/databricks/zerobus-sdk/purego v0.1.0(Apache 2.0), a DatabricksZerobus Go SDK.
docs/LICENSE_OF_DEPENDENCIES.mdis updated accordingly.Tests
Unit tests cover default and required options, tuning validation, both schema modes,
the protobuf descriptor and
VARIANTencoding, value conversion and its rejectionrules, connection setup and teardown, batch splitting, retry resumption after partial
failure, and distribution across concurrent streams, all against a fake ingest
stream. An integration test writes to a real Databricks workspace when credentials
are provided.
Checklist
I have signed the InfluxData CLA.
Related issues
No prior issue exists for this plugin; this pull request introduces it directly.