Add transaction and span outcome gherkin feature file#402
Add transaction and span outcome gherkin feature file#402estolfo merged 10 commits intoelastic:masterfrom
Conversation
💚 Build Succeeded
Expand to view the summary
Build stats
Trends 🧪Steps errors
Expand to view the steps failures
|
|
Thanks @estolfo for adding this shared spec. I feel that we might get better adoption for shared specs by keeping them as short and as concise as possible. |
|
@SylvainJuge Sure, simpler is always better 😃 |
|
Hi @estolfo , I finally managed to make progress on this. What I meant by using Here is the full file I'm using to test the Java agent implementation.
Also, the usage of tags like |
|
One notable thing that might require a bit of discussion is that we think that having For example, that would cover |
eyalkoren
left a comment
There was a problem hiding this comment.
I like the general guideline for transactions:
For other protocols, we can default to the following behavior:
- `failure` when an error is reported
- `success` otherwise
I wonder why this cannot be applied generically to spans as well? I understand the higher importance of setting an outcome to exit spans (which I think should be listed as explicit list of span types, so that all agents are aligned), but from the spec I am not sure what happens with all other spans - maybe they are irrelevant because there is no use for their outcome? If this is the case, the spec should say that. Ideally, whenever I end a span, I should look in the spec and know what I need to do. For example, one of these two options:
- If we decide that span outcome is only relevant for exit spans, list the span types that are considered exit spans. Any exit span should never have an
unknownoutcome and any non-exit span should always haveunknownoutcome. - If we decide that span outcome is relevant for non-exit span, can we decide that no built-in span may have an
unknownoutcome? Meaning - it either rely on some specific criteria (like HTTP code or DB response) or based on reported error for this span.
In addition, I added some questions about the gRPC outcomes based on the spec. These are not suggestions for change, only points I thought worth a second look.
| Scenario: span with error | ||
| Given an agent | ||
| And an active span | ||
| And span terminates with an error | ||
| Then span outcome is 'failure' | ||
|
|
||
| Scenario: span without error | ||
| Given an agent | ||
| And an active span | ||
| And span terminates without error | ||
| Then span outcome is 'success' |
There was a problem hiding this comment.
This looks good to me for any type of span, but the written spec allows unknown (or even null), with a note about the importance of exit spans. Does this depend on the span type?
There was a problem hiding this comment.
I think that's a good question here:
- the exit spans are the ones that call a third party in the map, for those we MUST have an outcome in 99% of cases
- we can provide a list of span types that are exit spans (
db,messaging, ...)
However, adding the type here would mean to either duplicate those statements for each type or use a scenario outline (with examples) to test for those, and to me applying this rule also works with other types of spans:
- we might have non-exit spans that may trigger errors (like the ones captured through annotations in Java): for those reporting exceptions and mark the span as an error would also make sense, even if not an exit span.
- we have some spans (like inferred spans) which will never have a known outcome, and for those it might make sense to always have
unknown.
Here we only test for the cases for which the outcome is known from the presence/absence of error, but it does not mean that we can't have unknown outcomes.
|
Also, there is one minor thing that we might change in future specs, the In Java, unlike in Ruby, we don't test the whole agent as doing this would require proper packaging and would move those tests in the As a result, we have different instructions to setup the agent for each set of features we want to test (currently API token/secret auth & outcome), and we can't have a common implementation for |
|
Updated with changes after initial review by @eyalkoren :
|
eyalkoren
left a comment
There was a problem hiding this comment.
Thanks for the clarifications on the spans outcome spec ❤️
LGTM.
Co-authored-by: eyalkoren <41850454+eyalkoren@users.noreply.github.com>
Co-authored-by: Emily S <emily.s@elastic.co>
|
@axw Given your knowledge of gRPC, do you have any opinion on the mapping proposal here ? I remember the Go agent current implementation maps gRPC |
I think that was a mistake, and should be treated as a bug in the Go agent. The mapping here makes sense to me. |
I thought some ambiguities in the spec prose could be cleared up by some Gherkin specs.
I've implemented them in the ruby agent in this pull request.
Few notable changes:
UNKNOWNshould be treated as afailurebecause it's an error or unknown type, but still an errorfailureif an error has been reported,successotherwise, this of course should apply with lower priority than the protocol-specific mappings. This allows to cover most other types of spans/transactions without any extra effort:dbspans,messagingspans & transactions, ...