-
Notifications
You must be signed in to change notification settings - Fork 33
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
O11Y-1665: Stub out remaining interface methods in opentelemetry-dart #43
O11Y-1665: Stub out remaining interface methods in opentelemetry-dart #43
Conversation
Merge Requirements Met ✅Request Rosie to automerge this pull request by including @Workiva/release-management-p in a comment. General InformationTicket(s): Code Review(s): #43 Reviewers: changliu-wk, michaelyeager-wf, keruitan-wk, blakeroberts-wk Additional InformationWatchlist Notifications: None
Note: This is a shortened report. Click here to view Rosie's full evaluation. |
Security InsightsNo security relevant content was detected by automated scans. Action Items
Questions or Comments? Reach out on Slack: #support-infosec. |
Public API ChangesRecommendation: @@ line 3: package:opentelemetry/src/api/exporters/span_exporter.dart @@
abstract class SpanExporter
+ void forceFlush()
// Adding abstract members breaks all subclasses.
@@ line 4: package:opentelemetry/src/sdk/trace/samplers/always_on_sampler.dart @@
class AlwaysOnSampler implements Sampler
- SamplingResult shouldSample(Context context, TraceId traceId, String spanName, bool spanIsRemote, List<Attribute> spanAttributes)
+ SamplingResult shouldSample(Context context, TraceId traceId, String spanName, SpanKind spanKind, bool spanIsRemote, List<Attribute> spanAttributes, List<SpanLink> spanLinks)
// `type` of `spanIsRemote` has changed.
// Changing a parameter signature is a major change.
@@ line 11: package:opentelemetry/src/api/trace/span.dart @@
abstract class Span
- String get name
+ String name
// Added setter for `name`.
// Adding a field is a minor change.
+ void addEvent(String name, Int64 timestamp, {List<Attribute> attributes})
// Adding abstract members breaks all subclasses.
+ SpanKind get kind
// Adding abstract members breaks all subclasses.
@@ line 2: package:opentelemetry/src/api/trace/trace_state.dart @@
abstract class TraceState
+ void remove(String key)
// Adding abstract members breaks all subclasses.
@@ line 5: package:opentelemetry/src/api/trace/sampler.dart @@
abstract class Sampler
- SamplingResult shouldSample(Context context, TraceId traceId, String spanName, bool spanIsRemote, List<Attribute> spanAttributes)
+ SamplingResult shouldSample(Context context, TraceId traceId, String spanName, SpanKind spanKind, bool spanIsRemote, List<Attribute> spanAttributes, List<SpanLink> spanLinks)
// `type` of `spanIsRemote` has changed.
// Changing a parameter signature is a major change.
Click to see 11 more API Changes
@@ line 4: package:opentelemetry/src/sdk/trace/samplers/parent_based_sampler.dart @@
class ParentBasedSampler implements Sampler
- SamplingResult shouldSample(Context context, TraceId traceId, String spanName, bool spanIsRemote, List<Attribute> spanAttributes)
+ SamplingResult shouldSample(Context context, TraceId traceId, String spanName, SpanKind spanKind, bool spanIsRemote, List<Attribute> spanAttributes, List<SpanLink> spanLinks)
// `type` of `spanIsRemote` has changed.
// Changing a parameter signature is a major change.
@@ line 4: package:opentelemetry/src/sdk/trace/samplers/always_off_sampler.dart @@
class AlwaysOffSampler implements Sampler
- SamplingResult shouldSample(Context context, TraceId traceId, String spanName, bool spanIsRemote, List<Attribute> spanAttributes)
+ SamplingResult shouldSample(Context context, TraceId traceId, String spanName, SpanKind spanKind, bool spanIsRemote, List<Attribute> spanAttributes, List<SpanLink> links)
// `type` of `spanIsRemote` has changed.
// Changing a parameter signature is a major change.
@@ line 7: package:opentelemetry/src/api/trace/tracer.dart @@
abstract class Tracer
- Span startSpan(String name, {Context context, List<Attribute> attributes})
+ Span startSpan(String name, {Context context, SpanKind kind, List<Attribute> attributes, List<SpanLink> links, Int64 startTime})
// `startSpan` is abstract.
// Changing the signature of an abstract member breaks all subclasses.
@@ line 5: package:opentelemetry/src/api/trace/span.dart @@
+ enum SpanKind { server, client, producer, consumer, internal }
// Adding an enum is a minor change. @@ line 12: package:opentelemetry/src/api/trace/nonrecording_span.dart @@
class NonRecordingSpan implements Span
- String get name
+ String name
// Added setter for `name`.
// Adding a field is a minor change.
+ void addEvent(String name, Int64 timestamp, {List<Attribute> attributes})
// Adding a method is a minor change.
+ SpanKind get kind
// Adding a field is a minor change.
@@ line 11: package:opentelemetry/src/sdk/trace/exporters/collector_exporter.dart @@
class CollectorExporter implements SpanExporter
+ void forceFlush()
// Adding a method is a minor change.
@@ line 6: package:opentelemetry/src/sdk/trace/trace_state.dart @@
class TraceState implements TraceState
+ void remove(String key)
// Adding a method is a minor change.
@@ line 7: package:opentelemetry/src/sdk/trace/span.dart @@
class Span implements Span
- Span Span(String name, SpanContext _spanContext, SpanId _parentSpanId, List<SpanProcessor> _processors, Resource _resource, InstrumentationLibrary _instrumentationLibrary, {List<Attribute> attributes, SpanLimits spanlimits})
+ Span Span(String name, SpanContext _spanContext, SpanId _parentSpanId, List<SpanProcessor> _processors, Resource _resource, InstrumentationLibrary _instrumentationLibrary, {SpanKind kind, List<Attribute> attributes, List<SpanLink> links, SpanLimits spanlimits, Int64 startTime})
// `kind` was added.
// Adding an optional parameter is a minor change.
+ void addEvent(String name, Int64 timestamp, {List<Attribute> attributes})
// Adding a method is a minor change.
+ SpanKind get kind
// Adding a field is a minor change.
@@ line 5: package:opentelemetry/src/sdk/trace/exporters/console_exporter.dart @@
class ConsoleExporter implements SpanExporter
+ void forceFlush()
// Adding a method is a minor change.
@@ line 5: package:opentelemetry/src/sdk/trace/tracer.dart @@
class Tracer implements Tracer
- Span startSpan(String name, {Context context, List<Attribute> attributes})
+ Span startSpan(String name, {Context context, SpanKind kind, List<Attribute> attributes, List<SpanLink> links, Int64 startTime})
// `kind` was added.
// Adding an optional parameter is a minor change.
@@ line 3: package:opentelemetry/src/api/trace/span_link.dart @@
+ class SpanLink
// Adding a class is a minor change.
Showing results for 53d3e2f
Last edited UTC Apr 14 at 20:47:32 |
bool spanIsRemote, // ignore: avoid_positional_boolean_parameters | ||
api.Attributes spanAttributes); | ||
api.Attributes spanAttributes, | ||
List<api.SpanLink> spanLinks); |
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.
should we make the args to this named parameters?
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 don't think so. The spec calls out that these parameters are required: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#shouldsample
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.
We also have all of the spec-"required" parameters in the signature now. If we're looking to avoid breaking API, I'd be in favor of using named parameters for additional parameters.
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.
these parameters are required
Well, excepting spanIsRemote
, which isn't in the spec at all. I suspect that SpanKind
is intended to fulfill that role. Should we then make spanIsRemote
a named parameter for the possibility that it's removed once we do the work to actually start using SpanKind
for things? It's hard to say.
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.
Perhaps remove spanIsRemote?
615027e
to
aa5e2bb
Compare
|
The
👍 |
api.Span can't do it. |
- Implement kind getters for Span classes.
- Add API to delete items from TraceState.
- Modified types in API for SpanLink.
- Exposing API to set Span name.
- Correcting merge conflicts with the master branch. - Type corrections in sampler unit tests.
80f223e
to
eb7182f
Compare
NonRecordingSpan should not be overridable. |
This is done by creating a
Our usages of this class are limited to:
Neither of these operations can yield anything other than a |
- Correcting types in API for adding events.
Confirmed traces are properly created and forwarded to New Relic. QA +1 |
@Workiva/release-management-p |
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.
+1 from RM
Notes
A review of the classes specified in the ticket revealed the following missing API:
SpanExporter
did not include aforceFlush
method.Span
:SpanKind
.Event
to aSpan
.Span
.Tracer
:SpanKind
when creating aSpan
.Span
.Span
.Sampler
:SpanKind
when deciding whether to sample.This PR stubs out or otherwise makes available the API outlined above. Other work will be required to make use of this API and to fully implement its features.
Reviewers
@Workiva/product-new-relic