-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat: telemetry coroutine extensions #864
Conversation
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
} catch (ex: Exception) { | ||
if (ex !is CancellationException) { | ||
span.setStatus(SpanStatus.ERROR) | ||
} | ||
span.recordException(ex, true) | ||
throw ex | ||
} finally { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: When getting a CancellationException
, we'll skip setting the span status to ERROR
but we'll still call recordException
which will set the error
attribute to true
. Is this correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 What should we do with a CancellationException
? Should it result in any of the normal exception related attributes being set on a span? Should it record different attributes? Nothing at all?
I went looking for guidance but didn't find anything. I could see doing something like:
when (ex) {
is CancellationException -> span.setAttribute("cancelled", true)
else -> {
span.setStatus(SpanStatus.ERROR)
span.recordException(ex, true)
}
}
Or just ignoring cancellation exceptions w.r.t span attributes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose it depends on if we intend to complete canceled spans or not. Assuming we do intend to complete them, then I think marking something is important (your cancelled = true
attribute is a good idea) but definitely not the exception...that's an implementation detail of the language/coroutines, not an indication of unexpected behavior in the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll fix this in next PR
* feat: identity API upstream changes (#864) * track upstream codegen changes (#879) * track upstream IdentityProvider and Attributes changes (#881) * add base class for credentials config (#883) BREAKING CHANGE: `CredentialsProvider` method name and signature changed. `signer` property removed from service client config in favor of `authSchemes` override.
Issue #
N/A
Description of changes
This PR expands the telemetry API with coroutine extensions that the actual generated SDK clients and runtime will mostly use.
ContextManager
interface. This is used to bridge the gap between the external calling code/observability backend and the SDK notion of context which relies on coroutine context for API boundary propagation.Context
,TelemetryProvider
, etc.Example Instrumentation
The following is a strawman example of what instrumenting an operation might look like. This will likely change and/or get abstracted to be less verbose/more reusable.
This leaves some open questions on how we want
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.