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

Add a way for admins to disable/and or adjust the limits for the "Unusual activity" mail #139

Open
ChrisJohnNOAA opened this issue Mar 21, 2024 · 2 comments
Labels
enhancement good first issue This is suitable for a first time programming project.

Comments

@ChrisJohnNOAA
Copy link
Contributor

Request from Frederic Leclercq:

Add a way how to disable/and or adjust the limits for the "Unusual activity" mail.

The 25% is hard coded:
https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/erddap/LoadDatasets.java#L1253

It'd be great to have the option to tweak that percentage or turn off those emails. Whenever there's a client or bot messing up requests, we end up flooded with those emails.

@ChrisJohnNOAA ChrisJohnNOAA added enhancement good first issue This is suitable for a first time programming project. labels Mar 21, 2024
@ayushsingh01042003
Copy link
Contributor

ayushsingh01042003 commented May 12, 2024

I'd like to try and work on this.

Maybe we can add an option (something like a link within the email) that will send a request to the server to disable these emails for a certain duration.

Can I get the steps to reproduce this email if possible?

  • Where do I set the email who will get the spam?
  • Is there anything specific I need to do with the datasets.xml file?
  • Any better solution also is appreciated :)

@ChrisJohnNOAA
Copy link
Contributor Author

The email address is set in the setup.xml, for example if using the local Jetty server that is emailEverythingTo here:
https://github.com/ERDDAP/erddap/blob/main/development/jetty/config/setup.xml#L67

I think we should add a parameter to the datasets.xml that allows specifying the unusual activity threshold. Maybe something like unusualActivityFailPercent that defaults to 25 and has -1 as an option to disable the email.

The failure counter is incremented in Erddap.java: https://github.com/ERDDAP/erddap/blob/main/WEB-INF/classes/gov/noaa/pfel/erddap/Erddap.java#L747

To get the email, you should be able to just send requests to a local server that cause errors. You could set up a specific kind of request to throw an exception (temporarily to make testing easier).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good first issue This is suitable for a first time programming project.
Projects
None yet
Development

No branches or pull requests

2 participants