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(sdk-trace-base): processor onStart called with a span having empty attributes #4277

Conversation

satazor
Copy link
Contributor

@satazor satazor commented Nov 9, 2023

Which problem is this PR solving?

This PR fixes issue #4188 in which the span processor on start method lacks attributes since they are set after with an accessor method (setAttributes) and not on the constructor itself.

This is a follow up of #4206. I will address any review asap as I'm need of this fix with urgency.

Fixes #4188

Short description of the changes

The PR adds constructor attributes to the span which are optional and if they are added from this layer the spanProcessor.onStart method will have context of attributes whenever it is called, this doest not break compatibility since setAttributes is still a valid public method and also the changes needed on wrappers like the Tracer are done.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • United tested over the build

Checklist:

  • Followed the style guidelines of this project
  • Unit tests have been added
  • Documentation has been updated

@satazor satazor requested a review from a team November 9, 2023 17:53
@satazor satazor changed the title fix(sdk-trace): process onStart called with a span having empty attri… fix(sdk-trace): process onStart called with a span having empty attributes Nov 9, 2023
@satazor satazor force-pushed the get-access-to-attributes-on-processor-start branch 2 times, most recently from ab75c4b to ab324f4 Compare November 9, 2023 18:11
@satazor satazor changed the title fix(sdk-trace): process onStart called with a span having empty attributes fix(sdk-trace): processor onStart called with a span having empty attributes Nov 9, 2023
Copy link

codecov bot commented Nov 10, 2023

Codecov Report

Merging #4277 (a15d748) into main (b0c0ace) will increase coverage by 0.01%.
The diff coverage is 100.00%.

❗ Current head a15d748 differs from pull request most recent head c2a3dda. Consider uploading reports for the commit c2a3dda to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4277      +/-   ##
==========================================
+ Coverage   92.30%   92.31%   +0.01%     
==========================================
  Files         330      330              
  Lines        9419     9421       +2     
  Branches     1995     1996       +1     
==========================================
+ Hits         8694     8697       +3     
+ Misses        725      724       -1     
Files Coverage Δ
packages/opentelemetry-sdk-trace-base/src/Span.ts 97.45% <100.00%> (+0.04%) ⬆️
...ackages/opentelemetry-sdk-trace-base/src/Tracer.ts 98.61% <100.00%> (-0.02%) ⬇️

... and 1 file with indirect coverage changes

@Flarna
Copy link
Member

Flarna commented Nov 10, 2023

some lint complains + a changelog entry is needed

@satazor satazor force-pushed the get-access-to-attributes-on-processor-start branch from ab324f4 to b7f9876 Compare November 10, 2023 09:36
@satazor satazor force-pushed the get-access-to-attributes-on-processor-start branch from b7f9876 to 44a3f65 Compare November 10, 2023 09:46
@satazor satazor changed the title fix(sdk-trace): processor onStart called with a span having empty attributes fix(sdk-trace-base): processor onStart called with a span having empty attributes Nov 10, 2023
@satazor
Copy link
Contributor Author

satazor commented Nov 10, 2023

@Flarna pushed linting fixes and changelog entry

@Flarna
Copy link
Member

Flarna commented Nov 10, 2023

Please avoid forced pushes after first review has been done. Individual commits ease review. I you need changes from main branch use a merge commit on your branch.
During integration to main all your commits on the branch will be squashed anyway.

Copy link

linux-foundation-easycla bot commented Nov 10, 2023

CLA Signed

The committers listed above are authorized under a signed CLA.

@satazor
Copy link
Contributor Author

satazor commented Nov 10, 2023

@Flarna sorry, my bad. I'm used to use amend and -f in other projects. Added a new commit with the improvement on the test name.

Copy link
Member

@pichlermarc pichlermarc left a comment

Choose a reason for hiding this comment

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

This looks good; thank you for taking care of this.

packages/opentelemetry-sdk-trace-base/src/Span.ts Outdated Show resolved Hide resolved
@satazor satazor force-pushed the get-access-to-attributes-on-processor-start branch from 2f298b9 to 1411439 Compare November 13, 2023 13:16
@satazor
Copy link
Contributor Author

satazor commented Nov 14, 2023

@pichlermarc @Flarna ping. Not trying to be intrusive, but this is somewhat urgent since it's requiring a workaround that involves significant overhead. Is something preventing the merge and release of this fix?

@pichlermarc
Copy link
Member

pichlermarc commented Nov 15, 2023

@pichlermarc @Flarna ping. Not trying to be intrusive, but this is somewhat urgent since it's requiring a workaround that involves significant overhead. Is something preventing the merge and release of this fix?

I'll merge this in. Keep in mind that this does not mean that it'll be released immediately. I'm trying to shoot for Nov 20

@pichlermarc pichlermarc merged commit 10f6c46 into open-telemetry:main Nov 15, 2023
17 checks passed
dyladan added a commit that referenced this pull request Nov 15, 2023
* chore: track package-lock.json (#4238)

* chore: track package-lock.json

* Pin to old versions for node 14

* Use version range

* Remove unused cached directories

* Temporarily disable other tests

* Temporarily enable only api test

* Enable only some packages

* Test only api packages

* Test trace exporters

* Fix line ordering

* Test all packages except otlp exporters

* Add trace http exporter

* Add trace proto exporter

* Test all but grpc exporters

* chore: use npm workspaces and degrade lerna to v6

* chore: get rid of lerna bootstrap

* chore: use npx

* chore: allow install scripts to setup buf

* chore: fix w3c-integration-test cache key

* chore: fix cache key

* chore: disable resource compat test

* chore: fix node_modules assumptions

* chore: fix hoisted karma issue

* chore: fix markdown linter complaints

* chore: lock @grpc/grpc-js to v1.8.21

* Break caches

* chore: remove cache

* chore: fixup inline commands

---------

Co-authored-by: Daniel Dyla <dyladan@users.noreply.github.com>

* docs: fixed link to benchmark results (#4233)

Co-authored-by: Chengzhong Wu <legendecas@gmail.com>

* chore(deps): update all patch versions (#4215)

* fix: otlp json encoding (#4220)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* fix: remove duplicate export star from version.ts (#4225)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* docs: fix sdk-node config instructions (#4249)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* feat(api): publish api esnext target (#4231)

* chore: release API 1.7.0/Core 1.18.0/Experimental 0.45.0 (#4254)

* fix(sdk-metrics): hand-roll MetricAdvice type as older API versions do not include it (#4260)

* chore: prepare release 1.18.1/0.45.1 (#4261)

* chore: no need for 'packages' in "lerna.json" (#4264)

* Benchmark tests for trace OTLP transform and BatchSpanProcessor (#4218)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* chore: type reference on zone.js (#4257)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* docs: add docker-compose to run prometheus for the experimental example (#4268)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* fix(sdk-logs): avoid map attribute set when count limit exceeded (#4195)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

* chore(deps): update dependency chromedriver to v119 [security] (#4280)

* chore(deps): update actions/setup-node action to v4 (#4236)

* fix(sdk-trace-base): processor onStart called with a span having empty attributes (#4277)

Co-authored-by: artahmetaj <artahmetaj@yahoo.com>

* Update fetch instrumentation to be runtime agnostic (#4063)

Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>

---------

Co-authored-by: Chengzhong Wu <legendecas@gmail.com>
Co-authored-by: Martin Kuba <martin@martinkuba.com>
Co-authored-by: Mend Renovate <bot@renovateapp.com>
Co-authored-by: Siim Kallas <siimkallas@gmail.com>
Co-authored-by: Marc Pichler <marc.pichler@dynatrace.com>
Co-authored-by: David Luna <david.luna@elastic.co>
Co-authored-by: Dinko Osrecki <dinko.osrecki@emarsys.com>
Co-authored-by: Trent Mick <trentm@gmail.com>
Co-authored-by: François <32224751+Lp-Francois@users.noreply.github.com>
Co-authored-by: Hyun Oh <hyunnoh01@gmail.com>
Co-authored-by: André Cruz <andremiguelcruz@msn.com>
Co-authored-by: artahmetaj <artahmetaj@yahoo.com>
Co-authored-by: drewcorlin1 <82601620+drewcorlin1@users.noreply.github.com>
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.

SpanProcess.onStart does not have access to span attributes
4 participants