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

Metric LastSuccessfulResponse is updated even if API returns error #161

Open
findmyname666 opened this issue Apr 9, 2024 · 2 comments
Open

Comments

@findmyname666
Copy link

The Fastly exporter updates the metric lastSuccessfulResponse even if the Fastly API returns an error. In our case, I noticed that the Fastly token was revoked from the log messages:

level=error component=rt.fastly.com service_id=_reducted_ status_code=403 response_ts=1712674340 err="invalid authentication" msg="token may be invalid"

The metric description suggests that the metric shouldn't be updated:

"last_successful_response", Help: "Unix timestamp of the last successful response received from the real-time stats API."

I tracked it to a specific branch of the code related to retrieving origin metrics as an example:

Related questions:

  • Is this the desired behaviour?
  • If yes, should another metric be introduced?

If necessary, I can take a look at the code adjustments once we agree on the next steps.

@leklund
Copy link
Member

leklund commented Apr 17, 2024

I believe the intent of the lastSuccessfulResponse was to indicate that the http request to rt.fastly.com succeeded, regardless of the response status code. If, however, this was the intended behavior I'm not sure I see a use case where you'd want the metric to be set from a 403.

I see two options:

  1. add a label to the metric for the status code. This could retain the existing metric but allow clients to filter where status=200.
  2. only Set LastSuccessfulResponse when the response status code == 200.

@findmyname666
Copy link
Author

findmyname666 commented Apr 29, 2024

I believe the intent of the lastSuccessfulResponse was to indicate that the http request to rt.fastly.com succeeded, regardless of the response status code. If, however, this was the intended behavior I'm not sure I see a use case where you'd want the metric to be set from a 403.

I see two options:

  1. add a label to the metric for the status code. This could retain the existing metric but allow clients to filter where status=200.
  2. only Set LastSuccessfulResponse when the response status code == 200.

I agree with your proposal. Any of those would be helpful. However if we go with the first, there is still the question if the metrics lastSuccessfulResponse should report differently for 4xx and 5xx. From my point of view 4xx and 5xx aren't successful responses for a client.

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

No branches or pull requests

2 participants