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

O11Y-1665: Stub out remaining interface methods in opentelemetry-dart #43

Merged
merged 7 commits into from
Apr 15, 2022

Conversation

michaelyeager-wf
Copy link
Contributor

Notes

A review of the classes specified in the ticket revealed the following missing API:

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

@rmconsole-wf
Copy link

rmconsole-wf commented Apr 4, 2022

Merge Requirements Met ✅

Request Rosie to automerge this pull request by including @Workiva/release-management-p in a comment.

General Information

Ticket(s):

Code Review(s): #43
Release Image Tags:

Reviewers: changliu-wk, michaelyeager-wf, keruitan-wk, blakeroberts-wk

Additional Information

Watchlist Notifications: None
Pull Requests included in release:

	When this pull is merged I will add it to the following release:
	Current version: opentelemetry-dart 0.4.2
	Version after merge: opentelemetry-dart 0.5.0
	Release Ticket(s): O11Y-1717

	This pull is considered a release pull
	The options defined for this repo will be carried out


Note: This is a shortened report. Click here to view Rosie's full evaluation.
Last updated on Friday, April 15 02:01 PM CST

@aviary3-wk
Copy link

Security Insights

No security relevant content was detected by automated scans.

Action Items

  • Review PR for security impact; comment "security review required" if needed or unsure
  • Verify aviary.yaml coverage of security relevant code

Questions or Comments? Reach out on Slack: #support-infosec.

@semveraudit-wf
Copy link

semveraudit-wf commented Apr 4, 2022

Public API Changes

Recommendation: ‼️ Major version bump (fyi @Workiva/semver-audit-group )

@@ 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

Powered by semver-audit-service. Please report any problems by filing an issue.
Reported by the dart semver audit client 2.2.2
Browse public API.

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);
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps remove spanIsRemote?

@changliu-wk
Copy link
Contributor

changliu-wk commented Apr 13, 2022

  1. Should have a API in Span named updateName()
  2. TraceState.dart should have API to delete a key/value pair.

@michaelyeager-wf
Copy link
Contributor Author

Should have a API in Span named updateName()

The name property has an exposed setter, so this can be accomplished by mySpan.name = "New Name";.

TraceState.dart should have API to delete a key/value pair.

👍

@changliu-wk
Copy link
Contributor

changliu-wk commented Apr 13, 2022

The name property has an exposed setter, so this can be accomplished by mySpan.name = "New Name";.

api.Span can't do it.

@changliu-wk
Copy link
Contributor

NonRecordingSpan should not be overridable.

@michaelyeager-wf
Copy link
Contributor Author

The API MUST provide an operation for wrapping a SpanContext with an object implementing the Span interface.

This is done by creating a NonRecordingSpan using the SpanContext in question. For example, https://github.com/Workiva/opentelemetry-dart/blob/master/lib/src/sdk/trace/propagation/w3c_trace_context_propagator.dart#L56

NonRecordingSpan should not be overridable.

Our usages of this class are limited to:

  • Wrapping incoming context, as with the propagator in the example above.
  • Created when starting a span with a NoopTracer.

Neither of these operations can yield anything other than a NonRecordingSpan. Could you be more specific as to where use of NonRecordingSpan can be overridden by a consumer? Is there a place we have missed?

changliu-wk
changliu-wk previously approved these changes Apr 14, 2022
 - Correcting types in API for adding events.
@michaelyeager-wf
Copy link
Contributor Author

Confirmed traces are properly created and forwarded to New Relic.

QA +1

@michaelyeager-wf
Copy link
Contributor Author

@Workiva/release-management-p

Copy link

@rmconsole-wf rmconsole-wf left a comment

Choose a reason for hiding this comment

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

+1 from RM

@rmconsole2-wf rmconsole2-wf merged commit b72a4b6 into Workiva:master Apr 15, 2022
@rmconsole2-wf rmconsole2-wf deleted the myeager-wf/O11Y-1665 branch April 15, 2022 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants