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 [MODIFIED] condition. #121

Closed
wants to merge 3 commits into from
Closed

Conversation

tjhowse
Copy link

@tjhowse tjhowse commented Jun 5, 2021

This change adds a [MODIFIED] condition that can be used to check that the resource specified by the URL changed since last retrieval. It does this by comparing the ETag header in the HTTP response.

My use-case is a heartbeat status file that should be updated every minute if the service is functioning properly.

If this is a feature that the maintainers feel would be useful please let me know and I'll finish off this PR with readme updates and tests.

I am not particularly happy with the means I am using to pass the previous ETag value through to the conditional evaluation code, but I wasn't able to see a way forward that wouldn't require substantial re-architecturing.

@tjhowse tjhowse marked this pull request as ready for review June 6, 2021 23:18
@TwiN
Copy link
Owner

TwiN commented Jun 30, 2021

Sorry for taking so long to respond, it's been a busy couple of weeks and I've been unable to commit time to thinking of a solution for this.

To be honest, I share the same opinion as you in that I'm not fan of the implementation -- and I don't blame you, as every solutions I could think of also has its shortcomings.

I cannot accept the implementation as-is, because it's too targeted to a single use case (ETag) yet uses a very generic placeholder name ([MODIFIED]).

I think that the right approach would be to:

  • Add support for header conditions (Support header conditions #4)
  • Add support for a placeholder that would let us access the previous evaluation results

The two above would enable something like this:

services:
  - name: example
    group: core
    url: "https://example.org"
    interval: 1m
    conditions:
      - "[STATUS] == 200"
      - "[HEADER].ETag != [LAST_RESULT][HEADER].ETag"

I completely understand if you don't want to undertake this task as its scope is significantly larger, but unfortunately, I cannot accept this PR as it is because the scope of the feature is far too small and I would rather trying to avoid breaking changes in the future since the two suggestions I made above was something I was planning on implementing at some point.

Regardless, thank you for the contribution! I appreciate it :)

@TwiN TwiN closed this Aug 20, 2021
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