You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "sam-hieken (via GitHub)" <gi...@apache.org> on 2024/10/13 23:46:25 UTC

[I] "Advanced" Date Time in Time Range Filter is Incorrect [superset]

sam-hieken opened a new issue, #30592:
URL: https://github.com/apache/superset/issues/30592

   ### Bug description
   
   Specifying "Last <n> minutes" in the "Advanced" section of time range filters on dashboards will sometimes think it's a time from the day before. 
   
   ### Screenshots/recordings
   
   For some clarity, the following test was performed on 2024-10-13T19:38:00-0400, give or take a few seconds. As should be obvious by the -0400, I'm in EDT/EST zone. 
   
   ## Last Hour:
   <img width="588" alt="Screenshot 2024-10-13 at 7 38 31 PM" src="https://github.com/user-attachments/assets/c3369531-8fbe-4013-9c41-cadd5ddee76a">
   
   ## Last 2 Minutes:
   <img width="590" alt="Screenshot 2024-10-13 at 7 38 48 PM" src="https://github.com/user-attachments/assets/f58e21c0-83b0-4f48-a11a-725bb584d45d">
   
   Obviously "Last 2 minutes" is way off - the timestamp is nowhere close, and the date shown is yesterday. Every dashboard with a time range filter I've tried this on has the same issue, and it happens in both the Start and End inputs.
   
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   3.9
   
   ### Node version
   
   16
   
   ### Browser
   
   Firefox
   
   ### Additional context
   
   _No response_
   
   ### Checklist
   
   - [X] I have searched Superset docs and Slack and didn't find a solution to my problem.
   - [X] I have searched the GitHub issue tracker and didn't find a similar bug report.
   - [X] 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.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "sam-hieken (via GitHub)" <gi...@apache.org>.
sam-hieken commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2599003132

   Hey there @geido, just took a look at the before and after changes in the PR and it looks like that solved the issue, though unfortunately I don't have enough resources to test the changes myself. Thanks for taking a look at this!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2409367087

   <!-- Answer -->
   The issue you're experiencing with the "Last <n> minutes" time range filter might be related to timezone handling. Superset uses the `timezone-mock` library to simulate different timezones and calculate time offsets. This can sometimes lead to discrepancies if the timezone isn't correctly accounted for in the calculations <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-core/test/time-comparison/getTimeOffset.test.ts)</sup>.
   
   To address this, you might want to check if the timezone settings in your Superset configuration are correctly set to match your local timezone (EDT/EST). Additionally, ensure that both your database and Superset backend are configured to use UTC, as this can help avoid issues with temporal fields lacking explicit timezones <sup>[[2]](https://github.com/apache/superset/blob/master/docs/docs/configuration/timezones.mdx)</sup>.
   
   If the problem persists, consider reviewing the logic in the `get_since_until` function, which calculates start and end times for relative time ranges. This function uses parameters like `relative_start`, `relative_end`, and `time_shift` to determine the correct time range <sup>[[3]](https://github.com/apache/superset/blob/master/superset/common/utils/time_range_utils.py)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2598534354

   @sam-hieken curious if you had a chance to have a look at this PR https://github.com/apache/superset/pull/31867 and if you believe this fixes the problems that you are mentioning.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "sam-hieken (via GitHub)" <gi...@apache.org>.
sam-hieken commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2494720820

   Hi @yousoph, no worries, please feel free!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect [superset]

Posted by "yousoph (via GitHub)" <gi...@apache.org>.
yousoph commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2490130517

   Hi @sam-hieken ! Thanks for filing this issue! I was about to report something very similar, hope you don't mind me making some edits/additions to your original issue to include some more details and other cases where the advanced filters aren't working. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "aybanda (via GitHub)" <gi...@apache.org>.
aybanda commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2502949143

   Hey @geido can you assign this issue to me ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2491514049

   ---
   
   ### 🎉 **Preset Bounty Available: $150 USD** 🎉
   
   To claim this bounty, please carefully follow the steps below.
   
   ---
   
   #### 📋 **Steps to Participate**
   
   1. **Review Guidelines:**  
      Read through the [Preset Bounty Program Contribution Guide](https://preset.notion.site/preset-bounty-program-apache-superset) for complete details on bounty requirements.
   
   2. **Show Your Interest:**  
      Complete the [Preset Bounty Program Survey](https://docs.google.com/forms/d/e/1FAIpQLSeDsR1iWvPxFydUIXs2agsUg3kMDaAooeD4P9P1L5sI0Yu5QQ/viewform?usp=sharing) and comment this issue to express your interest.
   
   3. **Join the Slack Channel:**  
      After completing the survey, you’ll receive an invitation to the dedicated [Apache Superset Slack](https://join.slack.com/t/apache-superset/shared_invite/zt-2be0drwz8-bxPfkdz28ozzk1Iox29ufg) channel.
   
   4. **Get Assigned:**  
      To officially start, ensure a **Bounty Program Manager** has assigned you to this issue.
   
   5. **Submit Your Solution:**  
      When ready, submit your solution with the `Fixes #{issue_number}` notation in your Pull Request description.
   
   6. **Claim Your Bounty:**  
      Sign up at [GitPay.me](https://gitpay.me/) and submit your solution via: [https://gitpay.me/#/task/981](https://gitpay.me/#/task/981)
   
   ---
   
   #### 💡 **Additional Notes**
   
   - Only developers assigned by a **Bounty Program Manager** should start working on this issue to win the bounty.
   - Be sure to follow the guide closely to avoid any delays in payment. Please, allow a few days after your PR has been merged for the bounty to be released.
   
   Good luck, and happy coding! 🎉


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "sam-hieken (via GitHub)" <gi...@apache.org>.
sam-hieken commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2494736923

   @rusackas So I've found that "2 minutes ago" works as desired like @yousoph said, but "Prior 2 minutes" will actually go 2 minutes into the future:
   
   <img width="573" alt="Screenshot 2024-11-22 at 3 16 27 PM" src="https://github.com/user-attachments/assets/1bcfdf43-512c-4ebd-81b5-61064eed4f80">
   
   
   I'm not familiar with Superset's codebase, but I've narrowed down the problem to the `/api/v1/time_range` endpoint in the backend. For example, in the above image, the following request was produced to parse the plain language into a date:
   
   Endpoint: `/api/v1/time_range/?q='now : Prior 2 minutes'`
   Response: 
   ```
   {
       "result": {
           "since": "2024-11-22T15:16:19",
           "until": "2024-11-22T15:18:19",
           "timeRange": "now : Prior 2 minutes"
       }
   }
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2598529869

   @Antonio-RiveroMartnez 
   > Not saying that it's semantically correct to take today, just that it's a breaking change
   
   If we all agree this is not the correct behaviour then this is likely a bug, thus a bug fix that does not quality as a breaking change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "Niharika0104 (via GitHub)" <gi...@apache.org>.
Niharika0104 commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2562319338

   @geido is this still open I see a pr but it's closed can I work on this?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2411463002

   <!-- Answer -->
   Superset assumes timestamps are in UTC, and configuring the backend to a non-UTC timezone like EST/EDT can lead to issues. It's recommended to keep both the database and Superset backend in UTC to ensure consistency <sup>[[1]](https://github.com/apache/superset/blob/master/docs/docs/configuration/timezones.mdx)</sup>.
   
   If you've already set both to UTC and the issue persists, it might be worth checking if there are any specific configurations or overrides in your setup that could affect timezone handling. Additionally, reviewing the logic in the `get_since_until` function might help identify any discrepancies in how relative time ranges are calculated.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "aybanda (via GitHub)" <gi...@apache.org>.
aybanda commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2523616040

   Hey @geido I will be generating a PR very shortly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2596861757

   Hey all! My two cents on this:
   
   1. All Human dates should be handled either by the current library or some extra addition of better ones, but we should not be handling specific strings like "Prior" etc, otherwise maintaining this API can quickly become cumbersome. Even more, when we have already things like "ago" in our code base.
   2. This API is extensively used in Superset and thus, changes on it would be considered breaking changes, for example, right now `Last 2 Hours` is expected to take the relative start of `today`, changing this could break existing charts/dashboards


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2458396736

   I wonder if the underlying library (which I can't recall the name of) is interpreting "last two minutes" as the "last two minutes of the day" rather than the "last two minutes that occurred." In that case, it's right... and it's kind of a language/clarity failure. What happens if you say "prior two minutes" or "two minutes ago"?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect [superset]

Posted by "sam-hieken (via GitHub)" <gi...@apache.org>.
sam-hieken commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2411457235

   @dosu Changed both my database timezone and superset timezone (`DEFAULT_TIMEZONE` in `superset_config.py`) to use EST/EDT: same issue. Did the exact same thing but UTC for both Superset and my database: still the same issue. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2523084409

   Hi @aybanda how is this going?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "alexandrusoare (via GitHub)" <gi...@apache.org>.
alexandrusoare commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2575042847

   Hey @geido can I have a look at this issue?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "yousoph (via GitHub)" <gi...@apache.org>.
yousoph commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2490139894

   > I wonder if the underlying library (which I can't recall the name of) is interpreting "last two minutes" as the "last two minutes of the day" rather than the "last two minutes that occurred." In that case, it's right... and it's kind of a language/clarity failure. What happens if you say "prior two minutes" or "two minutes ago"?
   
   It seems to be using the last 2 minutes of yesterday though, which seems like a strange interpretation if that's what's happening. Plus the "last hour" uses the start of the hour before the current hour so that one isn't using yesterday. 
   
   You're right that 2 minutes ago does work as expected though so that could be a workaround for the interim 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido closed issue #30592: "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end"
URL: https://github.com/apache/superset/issues/30592


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] "Advanced" Date Time in Time Range Filter is Incorrect for "last", "this", "beginning", "start", "end" [superset]

Posted by "fzh075 (via GitHub)" <gi...@apache.org>.
fzh075 commented on issue #30592:
URL: https://github.com/apache/superset/issues/30592#issuecomment-2566282813

   I'm in line behind @Niharika0104.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org