Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clickhouse output last batch #108

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

parsa97
Copy link
Contributor

@parsa97 parsa97 commented Jul 9, 2024

When using a pcap file, the last batch of data is missed because the context closes before it is sent. To solve this, I've created a new context for ClickHouse that remains open until the last batch is sent, and then it closes after the main context is closed.

Fix issue: #32

Tested with default configuration

Before Change

Dnsmonster log

metrics: {"clickhouseFailed":{"count":0},"clickhouseSentToOutput":{"count":3657536},"clickhouseSkipped":{"count":0},"packetLossPercent":{"value":0},"packetsCaptured":{"value":3668278},"packetsDropped":{"value":0},"packetsDuplicate":{"count":0},"packetsOverRatio":{"count":0}}

Clickhouse select count(*)

select count(*) from DNS_LOG
┌─count()─┐
│ 3650000 │
└─────────┘

After Change

Dnsmonster log

metrics: {"clickhouseFailed":{"count":0},"clickhouseSentToOutput":{"count":3657536},"clickhouseSkipped":{"count":0},"packetLossPercent":{"value":0},"packetsCaptured":{"value":3668278},"packetsDropped":{"value":0},"packetsDuplicate":{"count":0},"packetsOverRatio":{"count":0}}

Clikchouse select count(*)

select count(*) from DNS_LOG;
┌─count()─┐
│ 3657536 │
└─────────┘

Copy link

netlify bot commented Jul 9, 2024

Deploy Preview for unrivaled-llama-9deaa9 canceled.

Name Link
🔨 Latest commit af6e57a
🔍 Latest deploy log https://app.netlify.com/sites/unrivaled-llama-9deaa9/deploys/668e2fb10a617000084419f2

Copy link
Owner

@mosajjal mosajjal left a comment

Choose a reason for hiding this comment

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

there shouldn't be any function accepting two different Ctx objects. one should be created from the other (cascade). if that can't happen, we need to change the code to make sure that is the case.

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.

2 participants