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

fix: change SpanContext.traceFlags to mandatory #818

Merged

Conversation

Flarna
Copy link
Member

@Flarna Flarna commented Feb 26, 2020

Which problem is this PR solving?

According to spec SpanContext represents the W3C tracestate which includes traceId, spanId and traceFlags.

As a side effect a new LinkContext types was added as links don't have traceFlags according to spec.

Short description of the changes

Adapt type definitons to match spec.

@codecov-io
Copy link

codecov-io commented Feb 26, 2020

Codecov Report

Merging #818 into master will decrease coverage by 1.45%.
The diff coverage is 96.66%.

@@            Coverage Diff             @@
##           master     #818      +/-   ##
==========================================
- Coverage   94.14%   92.68%   -1.46%     
==========================================
  Files         253      244       -9     
  Lines       11000    10774     -226     
  Branches     1046     1025      -21     
==========================================
- Hits        10356     9986     -370     
- Misses        644      788     +144
Impacted Files Coverage Δ
packages/opentelemetry-api/test/api/api.test.ts 96.66% <ø> (ø) ⬆️
...emetry-exporter-stackdriver-trace/src/transform.ts 100% <ø> (ø) ⬆️
packages/opentelemetry-api/src/trace/NoopSpan.ts 100% <ø> (ø) ⬆️
...ry-tracing/test/export/SimpleSpanProcessor.test.ts 100% <ø> (ø) ⬆️
...ackages/opentelemetry-shim-opentracing/src/shim.ts 84.25% <ø> (ø) ⬆️
.../opentelemetry-core/src/trace/spancontext-utils.ts 100% <ø> (ø) ⬆️
...ntelemetry-core/test/trace/NoRecordingSpan.test.ts 71.42% <ø> (-28.58%) ⬇️
...ry-api/test/noop-implementations/noop-span.test.ts 100% <ø> (+54.16%) ⬆️
...lemetry-core/test/trace/ProbabilitySampler.test.ts 61.7% <0%> (-38.3%) ⬇️
...s/opentelemetry-core/test/context/B3Format.test.ts 47% <100%> (-53%) ⬇️
... and 79 more

According to spec SpanContext represents the W3C tracestate which
includes traceId, spanId and traceFlags.

As a side effect a new LinkContext types was added as links don't
have traceFlags according to spec.
@Flarna
Copy link
Member Author

Flarna commented Feb 28, 2020

One point is maybe worth to consider:
Should I change interface SpanContext to extend LinkContext to ensure traceId/spanId are equal defined and it's guranteed that a SpanContext fits into APIs requiring a LinkContext?

@dyladan
Copy link
Member

dyladan commented Feb 28, 2020

One point is maybe worth to consider:
Should I change interface SpanContext to extend LinkContext to ensure traceId/spanId are equal defined and it's guranteed that a SpanContext fits into APIs requiring a LinkContext?

I actually think if anything it would be the opposite. Link context is defined in terms of span context and not the other way around. I think it might be more useful to define it as type LinkContext = Pick<SpanContext, "traceId" | "spanId">

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

Copy link
Member

@obecny obecny left a comment

Choose a reason for hiding this comment

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

lgtm

@Flarna
Copy link
Member Author

Flarna commented Mar 5, 2020

Seems CI failed once again unrelated in HttpPlugin Integration tests.

I noticed also following warning in log which may indicate that something should be adapted in http plugin: (node:2917) [DEP0066] DeprecationWarning: OutgoingMessage.prototype._headers is deprecated

@dyladan
Copy link
Member

dyladan commented Mar 6, 2020

I'm on my phone right now so I can't do it but I think this is ready to merge whenever

@OlivierAlbertini OlivierAlbertini added enhancement New feature or request Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.) labels Mar 6, 2020
@mayurkale22 mayurkale22 merged commit 3c41f56 into open-telemetry:master Mar 6, 2020
@Flarna Flarna deleted the traceflag-nonoptional branch March 6, 2020 16:51
dyladan added a commit to dyladan/opentelemetry-js that referenced this pull request Sep 9, 2022
* fix: change SpanContext.traceFlags to mandatory

According to spec SpanContext represents the W3C tracestate which
includes traceId, spanId and traceFlags.

As a side effect a new LinkContext types was added as links don't
have traceFlags according to spec.

* chore: review findings, rename TraceFlags.UNSAMPLED to NONE

* fix: build

* fix: tests

* fix: correct merge

Co-authored-by: Daniel Dyla <[email protected]>
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
* fix: change SpanContext.traceFlags to mandatory

According to spec SpanContext represents the W3C tracestate which
includes traceId, spanId and traceFlags.

As a side effect a new LinkContext types was added as links don't
have traceFlags according to spec.

* chore: review findings, rename TraceFlags.UNSAMPLED to NONE

* fix: build

* fix: tests

* fix: correct merge

Co-authored-by: Daniel Dyla <[email protected]>
pichlermarc pushed a commit to dynatrace-oss-contrib/opentelemetry-js that referenced this pull request Dec 15, 2023
…pen-telemetry#818)

* fix hasOwnProperty check

* Revert "fix hasOwnProperty check"

This reverts commit 671021cb6e9732ef14ef50f69feabaa3d49d61a4.

* fix(opentelemetry/instrumentation-redis) hasOwnProperty check fixes duplicate call check

in my project this code was called a second time based on importing. However in the case it was called again the check would fail. By switching to hasOwnProperty it fixes this issue.

* adding tests and changing stream check to not crash

* fix(opentelemetry/instrumentation-redis) changing has stream check

This reverts commit 5a04acc4b9ce47713c0fc5eec18cdd5ad52ab70d.

* style: fix lint

Co-authored-by: Jonathan Campos <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Merge:LGTM This PR is ready to be merged by a Maintainer (has enough valid approvals, successful build, etc.)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants