Skip to content

Add support for logging to InfluxDB#290

Open
michelemin wants to merge 2 commits into
mainfrom
influxdb
Open

Add support for logging to InfluxDB#290
michelemin wants to merge 2 commits into
mainfrom
influxdb

Conversation

@michelemin

Copy link
Copy Markdown
Collaborator

Summary

Add InfluxDB as a supported logging backend and wire data generators to emit simple timeseries metrics through the existing logging pipeline.

Changes

  • add influxdb logger configuration and implementation
  • make the logging pipeline async so backends can await network sends
  • start a Tokio runtime inside the logging thread to support async logger execution
  • emit *_dg_processed timeseries points from data generators with the number of processed logs
  • update call sites and logger trait implementations to match the new async interface
  • clean up a few webhook logger comments

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds an InfluxDB logging backend to Plaid’s existing logging pipeline and updates data generators to emit simple processed-count timeseries metrics through that pipeline.

Changes:

  • Added a new influxdb logger module and extended logging configuration/error handling to support it.
  • Changed the logger trait and dispatch loop to use async send_log calls, with a Tokio runtime started inside the logging thread.
  • Updated data generators and example tailers to pass the logger through and emit *_dg_processed metrics.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
runtime/plaid/src/logging/webhook.rs Updated webhook logger trait implementation to async and cleaned webhook-specific comments.
runtime/plaid/src/logging/stdout.rs Updated stdout logger trait implementation to async.
runtime/plaid/src/logging/splunk.rs Updated Splunk logger trait implementation to async.
runtime/plaid/src/logging/mod.rs Wired in InfluxDB config/error types, made the logging loop async, and added runtime startup / Influx dispatch.
runtime/plaid/src/logging/influxdb.rs New InfluxDB backend implementation for timeseries log delivery.
runtime/plaid/src/data/mod.rs Passed the logger into DG processing and emitted *_dg_processed timeseries points.
runtime/plaid/examples/tailers/github.rs Updated example call site for the new get_and_process_dg_logs signature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runtime/plaid/src/logging/influxdb.rs Outdated
Comment on lines +73 to +89
let line = format!(
"{},{} {} {}",
table,
tags.map(|t| t
.into_iter()
.map(|(k, v)| format!("{}={}", k, v))
.collect::<Vec<_>>()
.join(","))
.unwrap_or_default(),
fields
.into_iter()
.map(|(k, v)| format!("{}={}", k, v))
.collect::<Vec<_>>()
.join(","),
timestamp.map(|t| t.to_string()).unwrap_or_default()
);

Comment on lines +120 to +123
.send_line_protocol(
&measurement,
None,
[("value", value.to_string().as_str())].into(),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is wrong given that it..does compile. I believe the .into() fixes it

Comment on lines +290 to +292
if let Some(logger) = &influxdb_logger {
if let Err(_) = logger.send_log(&log).await {
error!("Could not send logs to InfluxDB");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants