Comments (13)
What is the difference between noop and invalid span?
from oteps.
There is this related (but not entirely applicable) point in the error handling guidance: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/error-handling.md#guidance
- Whenever API call returns values that is expected to be non-null value - in case of error in processing logic - SDK MUST return a "no-op" or any other "default" object that was (ideally) pre-allocated and readily available. This way API call sites will not crash on attempts to access methods and properties of a null objects.
EDIT: I think this issue may not require an OTEP, if others agree, maybe move this issue to a normal spec issue.
from oteps.
What is the difference between noop and invalid span?
IMHO, their difference is an implementation detail. It's always a span which will not be sending any data once closed.
Thank you for the error handling link. That would definitely point towards returning a noop span rather than nil. I think being able to know when those cases occur (with a warning for example) would be nice, as even though they shouldn't trigger exceptions, they should be catchable as well.
from oteps.
regarding always return a span: How and a user differentiate between a non sampled trace (which is represented by Noop/NonRecording/... spans) and no trace active at all?
This is relevant for example in propagator.inject()
which should not inject a span in case there is no trace active. But if getCurrentContext().getSpan()
always provides a span some API on the span is needed to detect in inject is needed or not.
I guess comparing spanId/traceId against all 0 all the time is a bit of an overhead.
from oteps.
What the Go SDK does is that SpanContext has an IsValid method, which returns false for noop spans.
Then propagators return early if the context is invalid.
from oteps.
IsValid is part of the spec: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/api.md#isvalid and it is unrelated to noop vs. not-noop. Instead it checks if the spancontext has a valid trace & span ID. I think that should satisfy your use case @Flarna, because a not-sampled span will have a valid span & trace ID.
from oteps.
Well for propagators it's fine but I still don't see the advantage to create a Noop instance just to return something. Or to add more APIs on span like (IsSampled(), IsDummy(), IsApiOnly(), IsOnTrace(),...).
What's wrong with null
/undefined/...
in case there is nothing? Assuming here the language in question has something like this.
It remembers me a bit on C++ std::string
which has no difference between no string and an empty string so one needs some extra flag or whatever to represent this case.
from oteps.
The difference between nil and a noop span is that a noop span will accept calling all normal methods, while nil will throw exceptions on undefined methods.
From the specifications mentioned above:
This way API call sites will not crash on attempts to access methods and properties of a null objects.
from oteps.
if you call a non existing method on a Noop it will also throw. So well, wrong usage results in undefined behavior - as one would expect.
Maybe a bit off topic but related. Should we also return a dummy baggage if non is on context? and what should DummyBaggage.getEntry() return? at least in JS this returns BaggageEntry | undefined
now.
Similar, what should context.getValue("nonExitistingKey")
return as dummy?
from oteps.
I meant undefined methods for nil, not undefined for a proper span object.
from oteps.
- SDKs MAY log a warning if an invalid/noop span was returned.
I think we should not issue a warning as it is perfectly fine that no trace is active. warning logs indicate that something is wrong so at most debug/info would should be used in my opinion.
from oteps.
Sure, debug makes sense. I've updated the issue description.
from oteps.
What I'm seeing all other SDKs do is return empty/noop baggage and metrics/tracer providers, which matches the specification statement.
Regarding values, it seems to differ between SDKs.
For example, Go's context returns nil for missing values (but Go's context comes from the standard language library), and Baggage returns an invalid member when retrieving a key which doesn't exist.
from oteps.
Related Issues (20)
- Proposal: Non-core components like Exporters should live in contrib repos HOT 12
- Proposal: Enable security vulnerability scans on OTel repos HOT 4
- Proposal: Ability to associate tracer by alias with exporter/appender/destination HOT 1
- Proposal: Reduce clock-skew issues in mobile and other client-side trace sources HOT 5
- Proposal: Supporting Real User Monitoring Events in OpenTelemetry HOT 27
- Proposal: Add Sensitive Data Labels HOT 15
- Proposal: Remote Sampling
- Proposal: "Plugable backend" Tracing Client/Query library HOT 16
- Proposal: Add support for Elastic Common Schema (ECS) in OpenTelemetry HOT 6
- Proposal: specify how opentelemetry will deal with idle metrics no longer being reported
- Add link to opentelemetry.io under About section HOT 1
- Proposal: Support ML Monitoring HOT 6
- Proposal: Dynamic configuration of metrics HOT 2
- Proposal: The OpenTelemetry Spec should allow SDKs to export all the spans regardless of their sampled flag
- Proposal: OpenTelemetry Sandbox HOT 12
- Proposal: TraceID just being hex value doesnt help with decision making at tracing backend. Is there a possibility to encode additional metadata such as timestamp, region etc. HOT 4
- Proposal: Service renaming HOT 4
- Add a "not implemented" stage to maturity levels HOT 3
- Group maturity status into experimental and stable HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oteps.