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

Duplicated entries in Alerts & Reports execution log #29857

Open
3 tasks done
sfirke opened this issue Aug 5, 2024 · 1 comment
Open
3 tasks done

Duplicated entries in Alerts & Reports execution log #29857

sfirke opened this issue Aug 5, 2024 · 1 comment
Assignees
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature

Comments

@sfirke
Copy link
Member

sfirke commented Aug 5, 2024

Bug description

Each triggering of an alert or report appears in the log twice. Once with its actual runtime and result, once with a runtime of 00:00:00 or 00:00:01. Is there a bad join or does some event need to be filtered out?

How to reproduce the bug

Create an alert or report, let it run, look at the execution log.

Screenshots/recordings

image

Superset version

4.0.2

Python version

I don't know

Node version

I don't know

Browser

Not applicable

Additional context

In case it matters, all reports and alerts are being delivered by email, not Slack.

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
@dosubot dosubot bot added the alert-reports Namespace | Anything related to the Alert & Reports feature label Aug 5, 2024
@Siddharth-Latthe-07
Copy link

possible solutions steps:-

  1. Check the Log Creation Process
  2. Examine the Database Queries:- Review the queries that retrieve the log entries for display. Ensure there are no issues like joins or unions that could be causing duplicate entries.
  3. Sample snippet:-
def log_execution(alert_id, runtime, result):
    # This function should only be called once per execution
    # Ensure there's no duplicate call to this function
    log_entry = {
        'alert_id': alert_id,
        'runtime': runtime,
        'result': result,
    }
    save_log_entry_to_database(log_entry)

# This function might be called at different stages of execution
# Ensure it’s not causing duplicate log entries
def execute_alert(alert):
    start_time = get_current_time()
    log_execution(alert.id, start_time, "Started")

    result = perform_alert_execution(alert)

    end_time = get_current_time()
    log_execution(alert.id, end_time, result)

Follow the same for checking the queries
Hope this helps, Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
alert-reports Namespace | Anything related to the Alert & Reports feature
Projects
None yet
Development

No branches or pull requests

3 participants