vectordotdev / vectordotdev/vector

New `cratedb` sink

Open
#633 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

domain: logs domain: sinks sink: new
Dominant language
Rust
Stars
22.6k
Forks
2.3k
Avg merge
1d 7h
Merged PRs (30d)
146

Description

CrateDB is a distributed SQL database developed and maintained by @crate. I would like to add a CrateDB sink to Vector.

I have an initial working version that is based on the existing HttpService using CrateDB's HTTP endpoint for bulk inserts.

Since I'm quite new to working with @rust-lang I would love advice and support on what to change/do better, if the integration is accepted.

There are a few issues that I don't know yet how to solve:

  • CrateDB supports arrays and objects as column values. The existing json_parser transform "flattens" nested structures like this
    {
      "message": {
        "key1": {
          "k1": "v1",
          "k2": "v2"
        },
        "key2": ["v3", "v4"]
      }
    }
    
    to
    {
      "key1.k1": "v1",
      "key1.k2": "v2",
      "key2[0]": "v3",
      "key2[1]": "v4"
    }
    
    . However, I'd like the the data sent to CrateDB to be
    {
      "key1": {
        "k1": "v1",
        "k2": "v2"
      },
      "key2": ["v3", "v4"]
    }
    
  • I'm not sure how to hook into and evaluate the response that comes back when sending requests using HttpService. CrateDB provides error codes for bulk inserts that I'd like to use for logging warnings/info messages in Vector.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the initial working version linked in the issue, then compare it with Vector's existing HttpService and json_parser. Check CrateDB's HTTP bulk-operations and bulk-errors documentation to define the expected request and response handling. Done means an accepted CrateDB sink that preserves nested arrays and objects and reports relevant bulk-insert errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, sql
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.