-
Notifications
You must be signed in to change notification settings - Fork 1.9k
feat: Add {otel}
support
#4269
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
Merged
feat: Add {otel}
support
#4269
Changes from all commits
Commits
Show all changes
140 commits
Select commit
Hold shift + click to select a range
36b830c
Add otel promise remote
schloerke b8a9184
WIP: Add OpenTelemetry integration for reactives
schloerke 0faf1b7
Remove check errors
schloerke 7b8c9c1
Merge branch 'main' into feat/otel
schloerke 542681c
Add otel packages
schloerke 21c1ce1
Merge branch 'main' into feat/otel
schloerke bf963a1
Add r-lib/otelsdk to Remotes in DESCRIPTION
schloerke bd6d1ab
Add Open Telemetry section to pkgdown config
schloerke 7f38738
connect sync items. Need to prove promise calculations
schloerke eca760b
Update shiny-package.R
schloerke 2ca085e
Commit current state
schloerke c88bef4
Merge branch 'main' into feat/otel
schloerke 0903eee
Init otel.R
schloerke f004e54
Nerf all impl in bindOtel to use new otel methods
schloerke bb66440
Log with safe and dynamically use existing reactive locks when available
schloerke c584a00
Use new otel methods
schloerke ac14795
Disable render function observer from otel
schloerke 8c4d9d7
Set the otel span before running calling handlers for render function
schloerke 751ce6e
`devtools::document()` (GitHub Actions)
schloerke f8c2fda
Pair to the correct react lock span
schloerke 1858220
Merge branch 'feat/otel' of https://github.com/rstudio/shiny into fea…
schloerke abf7b5c
Require domain be given to with exsting ospan method
schloerke bdbfd0b
Update bind-otel.R
schloerke 3de7b7b
tweaks
schloerke 1c91cd9
Wrap execute flush with context's domain for ospan activation
schloerke 686fcf2
`devtools::document()` (GitHub Actions)
schloerke aacf00c
Update demo app to use promises.
schloerke 35eeb09
Reactivate ospan promise domains in reverse order so that the most re…
schloerke 1267d3e
Fix promise resolve to be a regular promise to get the eval in the co…
schloerke c3e90a2
Better debugging
schloerke cae54cb
Add debug message
schloerke 0583213
Try to add a span link. Leave as comment for now
schloerke e181c0a
clean up codes
schloerke 3126080
`rm` does not inherit when removing... so only check for existence wi…
schloerke e7c8f97
use single value within shiny for `otel is tracing` to avoid consiste…
schloerke 3b8abd9
Update bind-otel.R
schloerke d924ea8
Consistent label format
schloerke 8b4d49b
Comments
schloerke c202b53
Latest otel integrations. Use wrapper otel methods for consistent imp…
schloerke 222ead0
Disable languageserver styler changes
schloerke f839cf5
Update otel log to not interpolate anything
schloerke 97b9973
Use `"Reactive update"` . Need to remove "lock" from name
schloerke a4a9f7f
Update shiny.R
schloerke 4910fdb
Unify otel label display within `otel-label.R`
schloerke 7c77156
`reactive_lock` -> `reactive_update`
schloerke f8e87be
Bump dev version v1.11.1.9001
schloerke 6fd9a9c
`withOtelShiny()` -> `withOtel()`
schloerke 85809a5
Apply suggestions from code review
schloerke df6994b
Code feedback
schloerke b32ff78
Have `otel_is_tracing` allow to be dynamic
schloerke 2f12f0f
Fix new bind otel. Add docs. Move existing ospan methods closer to impl
schloerke 923a81a
Update docs for option
schloerke 877f5c7
From ospan capture from within Context flush to `run()`
schloerke ff45870
Don't make the option for the dev app bleed out
schloerke 653ef9f
Update stacks given new otel
schloerke a969167
Make stack testing more robust
schloerke e1c0310
Update pkgdown.yml
schloerke 3df8447
Update bind-otel.R
schloerke 5fa79aa
`npm run build` (GitHub Actions)
schloerke f308e53
Sync package version (GitHub Actions)
schloerke c35b254
Nerf bind options to just `"all"` and `"none"`
schloerke 0d1037f
`reactive-update` -> `reactive_update`
schloerke 4977e52
Merge branch 'feat/otel' of https://github.com/rstudio/shiny into fea…
schloerke b23fd71
Update labels and srcrefs for all otel bound objects
schloerke ec5e4e4
Start transition to otel session start/end event. Use `session.id` at…
schloerke 6c8cbc2
Remove unnecessary domain parameters
schloerke 83ab5ac
refactor(otel): split span management into focused modules
schloerke 982aad4
Require new promises package
schloerke e0ba77e
refactor(otel): migrate to promises package otel functions
schloerke 24dd639
Update reactives.R
schloerke 3580742
Update bind-otel.R
schloerke 07649ad
If a srcref is `NULL`, return `NULL`
schloerke cc56f4a
Update stacks snaps
schloerke 7ebd19c
rerun stack traces with testthat from cran, not github
schloerke 346bf38
Fix doc issue
schloerke 9117f55
Remove message about using new syntax in code
schloerke 39bdcaf
`devtools::document()` (GitHub Actions)
schloerke c284c2d
Merge branch 'feat/otel' of https://github.com/rstudio/shiny into fea…
schloerke 273c4c6
Do not namespace reactive val label
schloerke 39d6059
Allow for eventReactive to find the variable name for it's label
schloerke 7980201
Do not auto otel within eventReactive or observeEvent methods until r…
schloerke 17e6261
Update bind-otel.R
schloerke 23ffe44
debug: Add OTEL config options to with_options in barret
schloerke 2fa71cf
Similar to promises, do not have a custom tracer. Instead, capture it…
schloerke 175c5b9
tmp: Use .Renviron instead of local options
schloerke 6aaaf43
Wrap the implementation of `runApp()` in a ospan promise domain
schloerke 0d44c2b
Merge branch 'main' into feat/otel
schloerke 5e8e2ce
`devtools::document()` (GitHub Actions)
schloerke 92584b2
Merge branch 'main' into feat/otel
schloerke ca46b26
Do not export `withOtel()`
schloerke f7bc93c
Use fast get_tracer() from httr2
schloerke 6797cbe
Delete withOtel.Rd
schloerke 12a8e44
Make anon label short
schloerke 52c8033
Make the default otel level "all"; Reduce internal options
schloerke 05bedd8
Move helper function outside of R folder into tests folder; Add encom…
schloerke 3828152
Use new `promises::local_ospan_promise_domain()`
schloerke bdd7569
Clearer fatal / error log title
schloerke c3f414b
Update helper-barret.R
schloerke 7f275bd
Updates from otelsdk and promises
schloerke c16d85b
Speed enhancement for `otel_is_tracing_enabled()`
schloerke bbe8166
Update `otel_log_safe()` -> `otel_log()` with cached logger
schloerke d7be0e7
Improve default labeling for reactiveVal and reactiveValues
schloerke 537f034
Use flags on reactive objects, rather than wrapping and re-writing th…
schloerke 2b0d2c8
Use safety net of tryCatch
schloerke 745adc0
Do not export internal s3 method: bindOtel()
schloerke ed6b424
Use a reactiveVal instead of reactiveValues for internal calculations…
schloerke 1f0d2c0
Better anonymous labels for otel
schloerke f4d6c94
Updates
schloerke 8d8d89f
Update .Renviron
schloerke 3933121
Fix bad subset
schloerke d1d60ba
FIx always false check
schloerke 54c7fbd
Refactor Session start and session end ospans / logs
schloerke b632e4b
Refactor otel labels to support both event and cache
schloerke ac31109
Update shiny.R
schloerke 6000499
Sanitize fatal/unhandled errors (unless disabled) before sending to O…
schloerke 9cf0900
Better labels for debounce and throttle
schloerke d5d6173
Add logging for reactives that are not made the traditional way (inpu…
schloerke 792d6f4
More otel attrs and better label for eventReactive
schloerke b889057
Update helper-barret.R
schloerke 645a88f
Spelling and remove outdated pkgdown section
schloerke 875c997
Update NEWS.md
schloerke da7e334
Add ExtendedTask Support
schloerke 5bbbc39
Add extended task label functions with domain support
schloerke c07557b
Nerf `session.start` / `session.end` events. Move start attrs into `s…
schloerke 54ca7c8
Update NEWS.md
schloerke 49cc4ec
Merge branch 'main' into feat/otel
schloerke a854f08
Merge branch 'main' into feat/otel
schloerke e593061
Update NEWS.md
schloerke 1635295
Test global variable
schloerke 4d49a4d
Move label to be set during init
schloerke dc29683
Delete .Renviron
schloerke 9aff69b
Remove bad if statement
schloerke 921d717
Do not record ospans for debounce, throttle, and ExtendedTask interna…
schloerke 274f19a
Use helper method when init'ing `Context`, not a consistent followup …
schloerke 6b1aed0
Fix broken test for stack trace
schloerke 013f409
comment temp code that makes the check unhappy
schloerke 0fd3ef6
Expose different `shiny.bind.otel` option levels
schloerke 3a67d66
Rename bind-otel.R to otel-bind.R
schloerke 1ffe4a8
Add comments on why we do not use noop spans
schloerke 537483a
Clarify shiny.otel.bind option values in documentation
schloerke File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
Type: Package | ||
Package: shiny | ||
Title: Web Application Framework for R | ||
Version: 1.11.1.9000 | ||
Version: 1.11.1.9001 | ||
Authors@R: c( | ||
person("Winston", "Chang", , "[email protected]", role = "aut", | ||
comment = c(ORCID = "0000-0002-1576-2126")), | ||
|
@@ -94,7 +94,8 @@ Imports: | |
later (>= 1.0.0), | ||
lifecycle (>= 0.2.0), | ||
mime (>= 0.3), | ||
promises (>= 1.3.2), | ||
otel, | ||
promises (>= 1.3.3.9006), | ||
R6 (>= 2.0), | ||
rlang (>= 0.4.10), | ||
sourcetools, | ||
|
@@ -114,6 +115,7 @@ Suggests: | |
magrittr, | ||
markdown, | ||
mirai, | ||
otelsdk (>= 0.2.0), | ||
ragg, | ||
reactlog (>= 1.0.0), | ||
rmarkdown, | ||
|
@@ -122,6 +124,8 @@ Suggests: | |
testthat (>= 3.2.1), | ||
watcher, | ||
yaml | ||
Remotes: | ||
rstudio/promises | ||
Config/Needs/check: shinytest2 | ||
Config/testthat/edition: 3 | ||
Encoding: UTF-8 | ||
|
@@ -185,6 +189,13 @@ Collate: | |
'modal.R' | ||
'modules.R' | ||
'notifications.R' | ||
'otel-attr-srcref.R' | ||
'otel-bind.R' | ||
'otel-label.R' | ||
'otel-reactive-update.R' | ||
'otel-session.R' | ||
'otel-with.R' | ||
'otel.R' | ||
'priorityqueue.R' | ||
'progress.R' | ||
'react.R' | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
|
||
|
||
# Very similar to srcrefFromShinyCall(), | ||
# however, this works when the function does not have a srcref attr set | ||
otel_srcref_attributes <- function(srcref) { | ||
if (is.function(srcref)) { | ||
srcref <- getSrcRefs(srcref)[[1]][[1]] | ||
} | ||
|
||
if (is.null(srcref)) { | ||
return(NULL) | ||
} | ||
|
||
stopifnot(inherits(srcref, "srcref")) | ||
|
||
# Semantic conventions for code: https://opentelemetry.io/docs/specs/semconv/registry/attributes/code/ | ||
# | ||
# Inspiration from https://github.com/r-lib/testthat/pull/2087/files#diff-92de3306849d93d6f7e76c5aaa1b0c037e2d716f72848f8a1c70536e0c8a1564R123-R124 | ||
dropNulls(list( | ||
"code.filepath" = attr(srcref, "srcfile")$filename, | ||
"code.lineno" = srcref[1], | ||
"code.column" = srcref[2] | ||
)) | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.