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

Add Tracer API #85

Merged
merged 10 commits into from Jul 9, 2019
Merged

Conversation

danielkhan
Copy link
Contributor

Adds the Tracer API.
This is still work in progress as some dependencies are not yet specified but it should provide a starting point and avoid blocking other work.

@codecov-io
Copy link

codecov-io commented Jul 5, 2019

Codecov Report

Merging #85 into master will not change coverage.
The diff coverage is n/a.

@@          Coverage Diff          @@
##           master    #85   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     10    -2     
  Lines         200    152   -48     
  Branches        8      8           
=====================================
- Hits          200    152   -48
Impacted Files Coverage Δ
test/trace/tracestate.test.ts 100% <0%> (ø) ⬆️
test/trace/ProbabilitySampler.test.ts 100% <0%> (ø) ⬆️
test/resources/resource.test.ts 100% <0%> (ø) ⬆️
test/platform/id.test.ts 100% <0%> (ø) ⬆️
src/platform/node/id.ts 100% <0%> (ø) ⬆️
test/trace/NoopSpan.test.ts 100% <0%> (ø) ⬆️
src/platform/index.ts
src/platform/node/index.ts

*
* @todo: Change return type once HttpTextFormat is available
*/
getHttpTextFormat: unknown;
Copy link
Member

Choose a reason for hiding this comment

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

This and getBinaryFormat can be replaced with inject and extract which are compatible with both as explained in #74 (comment).

The problem with having fixed methods by propagators is that it becomes impossible to add new formats which may be needed by vendors.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no agreement on this as far as I can see and as long as it's in the spec I will leave it in here. I think you should post such concerns in the spec repo.

Copy link
Member

Choose a reason for hiding this comment

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

This is clearly due to a limitation in Java. The spec specifies 2 formats which would be available using inject and extract.

Copy link
Contributor

Choose a reason for hiding this comment

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

I would also prefer that because I think it would be nice to have the browser implementation of this not need code for the binary encoding if it doesn't use it (browser mostly speaks HTTP and can't do gRPC directly).

Copy link
Member

Choose a reason for hiding this comment

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

packages/opentelemetry-types/src/trace/tracer.ts Outdated Show resolved Hide resolved
*
* @todo: Move into module of its own
*/
export interface SpanOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please add an optional kind of type SpanKind, IsRecordingEvents boolean flag and parent span?

something like:

export interface SpanOptions {
    kind?: SpanKind;
    attributes?: Attributes;
    isRecordingEvents?: boolean;
    parent?: Span | SpanContext; (or childOf?: Span | SpanContext;)
    startTime?: number;
}

WDYT?

packages/opentelemetry-types/src/trace/tracer.ts Outdated Show resolved Hide resolved
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
Copy link
Member

Choose a reason for hiding this comment

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

This is not required for now, Could you please remove this file?

packages/opentelemetry-types/src/trace/tracer.ts Outdated Show resolved Hide resolved
@danielkhan
Copy link
Contributor Author

I think I've addressed everything. Please revisit.

@danielkhan danielkhan requested a review from rochdev July 8, 2019 12:42
* @todo: Move into module of its own
*/
export interface SpanOptions {
kind?: SpanKind;
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to see block comment (/** … */) for each of these properties similar to other interfaces.

/**
*
* @param name The name of the span
* @param options? SpanOptions used for span creation
Copy link
Member

Choose a reason for hiding this comment

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

MInor: I think we are using [] for optional param ex: [options].

Copy link
Member

@mayurkale22 mayurkale22 left a comment

Choose a reason for hiding this comment

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

LGTM, added a few comments. I feel this is a good start, will revisit again on to-do items.

@danielkhan
Copy link
Contributor Author

Addressed minor edits.

@danielkhan
Copy link
Contributor Author

@rochdev please re-review

* @param [options] SpanOptions used for span creation
* @returns Span The newly created span
*/
start(name: string, options?: SpanOptions): Span;
Copy link
Member

Choose a reason for hiding this comment

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

As per the specs, the name should be startSpan instead of just start.

Copy link
Member

@rochdev rochdev left a comment

Choose a reason for hiding this comment

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

LGTM. There are a few problems but they are related to the spec so I opened issues in the spec.

@danielkhan danielkhan merged commit c1b117d into open-telemetry:master Jul 9, 2019
@danielkhan danielkhan deleted the dkhan-add-tracer-api branch July 9, 2019 17:17
dyladan pushed a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
dyladan pushed a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants