vectordotdev / vectordotdev/vector
New `gcp_big_query` sink
Nobody has claimed this yet.
- #1951 by @bruceg — closed without merging
- Dominant language
- Rust
- Stars
- 22.6k
- Forks
- 2.3k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 146
Description
GCP Big Query is a powerful service for analyzing large amounts of structured data. If used correctly, it can be a cost-effective storage for log data. I would like to see Vector support this service as a sink, but it'll require careful planning due to the many different ways Big Query can be used.
Context
Big Query is flexible and we should consider the following features for our Big Query sink:
- Storing JSON data in a single column. Users can use Big Query's JSON functions.
- This type of querying is slower for obvious reasons (fetching more data, parsing, etc).
- This type of querying is more expensive because each query must fetch and scan the entire JSON payload as opposed to individual columns.
- Mapping structured data to individual Big Query table columns.
- Automatic schema maintenance.
- Streaming inserts vs batching inserts.
- Streaming inserts have a cost ($0.010 per 200 MB).
- Note the variety of methods to batch insert. This can be done through the API directly or through other GCP services (cloud storage, stackdriver, etc).
This, of course, is not inclusive of all factors we should consider for Big Query, but it helps to demonstrate the variety of options.
Starting simple
v1 of this sink should solve the simplest implementation:
- Use the streaming inserts API and stream records 1 by 1 (no batching).
- Assume we are writing to a table with 2 columns:
timestampandjson_event.- The
timestampcolumn should map to our own internaltimestampcolumn. - The
json_eventcolumn should contain a JSON encoded representation of our event. - Both of these column names should be configurable (defaulting to the global
log_schema.timestamp_key). It is worth thinking about a generic column mapping configuration scheme so that users could map other custom fields to Big Query columns.
- The
- Include documentation on how to create a properly structured table. Ideally this table would be partitioned by the
timestampday.
Long Term
We might consider the following features for long-term development:
- Support for using the batching API since it does not incur a cost.
- Dynamic schema maintenance. Although, I think this might be better solved with a transform or something separate.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the streaming inserts API and the v1 checklist, especially the configurable timestamp and json_event column mappings. Done means a working one-record-at-a-time sink, support for the two-column table shape, and documentation for creating a timestamp-partitioned table.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gcp
- Domain
- cloud, data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100