Skip to content
This repository has been archived by the owner on Oct 28, 2024. It is now read-only.

Propagates the log topic through to the Vector send event. #33

Merged
merged 3 commits into from
Sep 13, 2024

Conversation

kenlin-db
Copy link
Collaborator

Adds a new util method for extracting the topic name from the log file upload pattern; adds it to the vector event log (so it can be propagated to the event log table).

The new util method is tested with a new unit test:

% cargo test extract_topic_name     
   Compiling vector v0.39.0-databricks-v1 (/Users/ken.lin/vector)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 24.00s
     Running unittests src/lib.rs (target/debug/deps/vector-b8c6a62aa94e6d9a)

running 2 tests
test sinks::util::vector_event::tests::extract_topic_name_fail ... ok
test sinks::util::vector_event::tests::extract_topic_name_success ... ok


// Utility function for extracting the topic name from an archived log file path.
pub fn extract_topic_name(file_path: &str) -> String {
// Topic: If the file being uploaded matches the archived-log filepattern we can extract

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

filepattern is not a recognized word. (unrecognized-spelling)

#[test]
fn extract_topic_name_success() {
let file_path = "databricks-logs/archived-log/log-sync-internal/test-topic/date=2024-04-02/us-west-2/vector-aggregator-0/test.log";

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

databricks is not a recognized word. (unrecognized-spelling)
fn extract_topic_name_success() {
let file_path = "databricks-logs/archived-log/log-sync-internal/test-topic/date=2024-04-02/us-west-2/vector-aggregator-0/test.log";
assert_eq!(extract_topic_name(file_path), "test-topic");
let file_path_structured = "databricks-logs/archived-log/log-sync-internal/structured-log/test-topic/date=2024-04-02/us-west-2/vector-aggregator-0/test.log";

Check failure

Code scanning / check-spelling

Unrecognized Spelling Error

databricks is not a recognized word. (unrecognized-spelling)
@kenlin-db kenlin-db merged commit 302ad0f into v0.39 Sep 13, 2024
41 of 49 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants