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

Policy: Add custom metrics #1188

Merged
merged 3 commits into from
Jun 2, 2020
Merged

Conversation

eloycoto
Copy link
Contributor

This policy adds the avalability to add a new metric on the post_action,
so user can report back things like metric upstream headers, status code
or any other information.

FIX THREESCALE-5098

Signed-off-by: Eloy Coto eloy.coto@acalustra.com

@eloycoto eloycoto requested a review from a team as a code owner April 28, 2020 20:42
@eloycoto eloycoto force-pushed the THREESCALE-5098 branch 2 times, most recently from 4dc5c28 to 476c2ee Compare April 28, 2020 21:01

## Caveats:

Due to this needs some information from the upstream API, if the authrep with
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to use the authorize and report endpoints instead of authrep.
That way we could authorize => call upstream => report. The problem with the current approach is that it can lose many reports.

@@ -0,0 +1,73 @@
# Custom metrics policies

This policy adds the availability to add metrics after the Upstream API
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd add somewhere that every metric used in this policy needs to be created manually in the admin portal.
Some users might expect APIcast to automatically create them when needed.

@eloycoto eloycoto force-pushed the THREESCALE-5098 branch 6 times, most recently from c43f788 to a768bfa Compare May 21, 2020 20:34
@eloycoto eloycoto requested a review from davidor May 27, 2020 16:12
- This policy does not work with batching policy.
- Metrics need to be created in the admin portal before submit it.

## Request flow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice diagram! 👌
I was thinking that maybe we should clarify what's reported on each call to apisonator. For example, in the first request, the first call to authrep reports the "normal" metrics and the call to transactions.xml reports only the custom metrics. What do you think?

--- no_error_log
[error]

=== TEST 4: Rule does not left, metric is not added
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure what you mean

This policy adds the avalability to add a new metric on the post_action,
so user can report back things like metric upstream headers, status code
or any other information.

FIX THREESCALE-5098

Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
If not the post action will not run correctly

Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
When the first call happens the authrep happened before upstream API,
this fix will report the new usage out-of-band.

Signed-off-by: Eloy Coto <eloy.coto@acalustra.com>
@eloycoto eloycoto merged commit e183ad4 into 3scale:master Jun 2, 2020
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