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

feat: config for custom batch span processor #229

Merged
merged 3 commits into from
May 24, 2024
Merged

Conversation

tim-mwangi
Copy link
Collaborator

Description

We need to be able to pick whether we use out customer bsp https://github.com/hypertrace/goagent/tree/main/instrumentation/opentelemetry/batchspanprocessor or use the stock one in the opentelemetry go repo.

Testing

Unit and local tests

Checklist:

  • [✅ ] My changes generate no new warnings
  • [✅ ] Any dependent changes have been merged and published in downstream modules

Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 87.50000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 58.37%. Comparing base (eab5d40) to head (d4e5aa2).

Files Patch % Lines
instrumentation/opentelemetry/init.go 85.71% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #229      +/-   ##
==========================================
+ Coverage   57.80%   58.37%   +0.57%     
==========================================
  Files          69       69              
  Lines        2737     2746       +9     
==========================================
+ Hits         1582     1603      +21     
+ Misses       1085     1074      -11     
+ Partials       70       69       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@tim-mwangi
Copy link
Collaborator Author

Oh I missed some places eg. RegisterServiceWithSpanProcessorWrapper(). Will fix.

@tim-mwangi tim-mwangi marked this pull request as ready for review May 23, 2024 21:36

exporter, err := exporterFactory()
if err != nil {
log.Fatal(err)
}

sp := modbsp.CreateBatchSpanProcessor(
cfg.GetTelemetry() != nil && cfg.GetTelemetry().GetMetricsEnabled().GetValue(), // metrics enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to understand this more, why was this conditional to run BatchSpanProcesor until now? What I am trying to understand is what would happen if customBsp is false and metrics are enabled? Will non-modified batchSpanProcessor work?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The only reason for the custom BatchSpanProcessor(BSP) is to be able to collect span metrics - received, dropped and unsampled - as they hit the exporter. So if metrics is disabled, there's no need for it.
As if this PR if custom BSP is false and metrics are enabled, we use the stock BSP. I think this behavior will remain even in the recover from panic PR. And I'm thinking I will remove the metrics enabled requirement in that PR so that we can recover even if metrics are disabled and panic happens when exporting the traces.

@tim-mwangi tim-mwangi merged commit d232486 into main May 24, 2024
6 of 7 checks passed
@tim-mwangi tim-mwangi deleted the custom-bsp-config branch May 24, 2024 17:03
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.

3 participants