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

Update the spec with the new metrics for 3.0 #536

Merged
merged 2 commits into from May 20, 2020

Conversation

Azquelt
Copy link
Member

@Azquelt Azquelt commented Apr 23, 2020

Includes spec and TCKs.

We can still make tweaks to the spec if required.

Fixes #401
Fixes #499

@Azquelt Azquelt force-pushed the ft-30-metrics branch 2 times, most recently from 134b56c to 573fbd8 Compare April 29, 2020 17:05
@Azquelt
Copy link
Member Author

Azquelt commented Apr 29, 2020

I've now added new TCKs, though I don't have an implementation to run the TCKs against yet.

Mostly I've just adapted the existing tests to use the new metrics, though the new retry metrics resulted in several new test cases.

@Azquelt Azquelt force-pushed the ft-30-metrics branch 2 times, most recently from 4b1babf to dad075b Compare May 4, 2020 16:19
@Azquelt
Copy link
Member Author

Azquelt commented May 4, 2020

I've now made a few fixes and got my implementation running against these tests.

@Azquelt Azquelt marked this pull request as ready for review May 4, 2020 17:01
| Tags
a| * `method` - the fully qualified method name
* `result` = `[valueReturned\|exceptionThrown]` - whether the invocation returned a value or threw an exception
* `fallbackUsed` = `[true\|false\|none]` - `true` if fallback was used, `false` if a fallback is configured but was not used, `none` if a fallback is not configured
Copy link
Member

Choose a reason for hiding this comment

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

Had a further thought on this:
fallbackUsed with the choice of true|false|none is odd. How about fallbackStatus - true|false|none

Copy link
Member

Choose a reason for hiding this comment

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

I reviewed the whole section and I think it is better to change none to notApplicable

fallbackUsed =[ true|false|notApplicable]

Copy link
Contributor

Choose a reason for hiding this comment

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

A fallback that is not applicable is a fallback that has been defined, but configured to not apply for particular situation. It's an interesting case that we don't cover, but it's distinct from fallback that is not defined (which is what none means now).

What we have now is, essentially: fallback=[applied|notApplied|notDefined].

We could expand that to fallback=[applied|notAppliedBecauseNotNeeded|notAppliedBecauseOfConfiguration|notDefined]. Whether we need to distinguish the two cases of why fallback wasn't applied, I don't know.

Copy link
Member Author

@Azquelt Azquelt May 15, 2020

Choose a reason for hiding this comment

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

We already know whether it was not applied because it wasn't needed or was not applied because the exception didn't match the configuration by the value of result

We currently have

  • result = valueReturned, fallbackUsed = false - method returned successfully, fallback was not needed
  • result = valueReturned, fallbackUsed = true - method threw an exception, fallback was invoked and returned a value
  • result = exceptionThrown, fallbackUsed = false - method threw an exception, but fallback was not invoked because fallback configuration didn't include the thrown exception
  • result = exceptionThrown, fallbackUsed = true - method threw an exception, fallback was invoked and also threw an exception

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, good point, thanks!

Copy link
Contributor

@Ladicek Ladicek May 18, 2020

Choose a reason for hiding this comment

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

I propose we stay with none. We use some excessively long names elsewhere, and I'm not really a big fan of that.

EDIT: alternatively, I propose we go with long names here as well, and use something like fallback=[applied|notApplied|notDefined] :-)

Copy link
Member

Choose a reason for hiding this comment

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

I like the long names you specified @Ladicek , as it is self explainary 👍 .

Copy link
Member Author

Choose a reason for hiding this comment

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

notEnabled - does not mean the annotation does not exist. It could not the exception does not enable the fallback.

I don't think we ever use the word "enabled" to talk about applyOn or skipOn, so I don't think it would be reasonable to think that it relates to that. We do use "enabled" to talk about enabling and disabling an annotation via config.

EDIT: alternatively, I propose we go with long names here as well, and use something like fallback=[applied|notApplied|notDefined] :-)

I still don't really like notSpecified or notDefined as it sounds to me too much like a value which should exist is missing, but I can live with it. fallback=notDefined is at least better than fallbackUsed=notDefined.

Copy link
Contributor

Choose a reason for hiding this comment

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

I can see how undefined could sound like "something is supposed to be here, but some programmer made a mistake somewhere and so you're seeing this placeholder" (especially for people who have seen JavaScript), but notDefined is pretty unique IMHO.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've changed it to fallback=[applied|notApplied|notDefined]

ft.timeout.calls.total{method="com.example.MyClass.doWork", timedOut="true"}
ft.timeout.calls.total{method="com.example.MyClass.doWork", timedOut="false"}
ft.timeout.executionDuration{method="com.example.MyClass.doWork"}
```

Now imagine the `doWork()` method is called and the invocation goes like this:

* On the first attempt, the invocation takes more than 1000ms and times out
* On the second attempt, something goes wrong and the method throws an `IOException`
* On the third attempt, the method returns successfully and the result of this attempt is returned to the user
Copy link
Member

Choose a reason for hiding this comment

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

Is this attempt from the Retry operation?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I'll see if I can reword this to make it clearer that it's doing retries.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've updated this example to make it explicit that it's doing retries.

@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (c) 2018 Contributors to the Eclipse Foundation
* Copyright (c) 2018-2020 Contributors to the Eclipse Foundation
Copy link
Member

Choose a reason for hiding this comment

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

2018, 2020

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do this under #545

@@ -1,6 +1,6 @@
/*
*******************************************************************************
* Copyright (c) 2018 Contributors to the Eclipse Foundation
* Copyright (c) 2018-2020 Contributors to the Eclipse Foundation
Copy link
Member

Choose a reason for hiding this comment

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

2018, 2020

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Contributors to the Eclipse Foundation
* Copyright (c) 2018-2020 Contributors to the Eclipse Foundation
Copy link
Member

Choose a reason for hiding this comment

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

2018, 2020

@Emily-Jiang
Copy link
Member

Can you also add a test scenario when configuring both failOn and skipOn on CircuitBreaker to measure the success counter for an exception excluded by CircuitBreaker?

@Azquelt
Copy link
Member Author

Azquelt commented May 15, 2020

Can you also add a test scenario when configuring both failOn and skipOn on CircuitBreaker to measure the success counter for an exception excluded by CircuitBreaker?

Yes, good spot. We test with an exception which isn't in failOn but we don't test with an exception which is in skipOn.

Update: expanded test to include skipOn

@Azquelt
Copy link
Member Author

Azquelt commented May 15, 2020

I think I've resolved all the comments on this PR, apart from the fallbackUsed tag. I'll have a further think on that.

@carlosdlr carlosdlr self-requested a review May 19, 2020 13:07
Copy link
Contributor

@carlosdlr carlosdlr left a comment

Choose a reason for hiding this comment

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

LGTM

* `ft.com.example.MyClass.doWork.timeout.callsNotTimedOut.total`
```
ft.invocations.total{method="com.example.MyClass.doWork", result="valueReturned", fallbackUsed="none"}
ft.invocations.total{method="com.example.MyClass.doWork", result="exceptionThrown", fallbackUsed="none"}
Copy link
Contributor

Choose a reason for hiding this comment

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

Old name fallbackUsed.

Copy link
Member Author

Choose a reason for hiding this comment

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

ah rats, thank you for spotting this, I completely forgot to update the example.

`ft.com.example.MyClass.doWork.invocations.failed = 0` +
No exceptions were propagated back to the caller.
```
ft.invocations.total{method="com.example.MyClass.doWork", result="valueReturned", fallbackUsed="none"} = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

Old name fallbackUsed.

@Ladicek
Copy link
Contributor

Ladicek commented May 19, 2020

Quickly skimmed through it and found a few occurences of the old fallbackUsed name, otherwise LGTM.

Signed-off-by: Andrew Rouse <anrouse@uk.ibm.com>
Signed-off-by: Andrew Rouse <anrouse@uk.ibm.com>
@Azquelt
Copy link
Member Author

Azquelt commented May 20, 2020

Squashing all the review changes

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.

move FT metrics to base scope MetricsRegistry for MP 4.0 Improve MP FT metrics using Metrics tags
4 participants