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 optional opentelemetry file export tracing #723

Merged
merged 37 commits into from
Dec 6, 2023
Merged

Conversation

joshwlewis
Copy link
Member

@joshwlewis joshwlewis commented Nov 8, 2023

This is an alternative implementation of #705.

This PR adds opt-in functionality (with the trace feature) that writes OpenTelemetry File Export tracing information during build and compile. The tracing data includes buildpack attributes (like buildpack id, name), spans for build and detect, events for build-success, detect-pass, detect-fail, and also sets errors and span status in the case of errors.

GUS-W-14348835.

@joshwlewis joshwlewis requested a review from a team as a code owner November 8, 2023 19:05
libcnb/src/runtime.rs Outdated Show resolved Hide resolved
@edmorley
Copy link
Member

edmorley commented Nov 8, 2023

@joshwlewis It looks like there were new versions of the opentelemetry crates released in the last couple of days:
https://github.com/open-telemetry/opentelemetry-rust/releases/tag/v0.21.0

Maybe worth picking those new versions up now?
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry/CHANGELOG.md
https://github.com/open-telemetry/opentelemetry-rust/blob/main/opentelemetry-stdout/CHANGELOG.md

@joshwlewis
Copy link
Member Author

It looks like there were new versions of the opentelemetry crates released in the last couple of days

@edmorley thanks. Brought them in with 54f8fe4.

Copy link
Member

@Malax Malax left a comment

Choose a reason for hiding this comment

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

I only have one remaining comment. I think the proposed changes aren't too controversial so I'm approving already with the expectation that we resolve the comment before merging. :)

libcnb/src/tracing.rs Outdated Show resolved Hide resolved
libcnb/src/tracing.rs Outdated Show resolved Hide resolved
libcnb/src/tracing.rs Show resolved Hide resolved
libcnb/src/tracing.rs Outdated Show resolved Hide resolved
libcnb/src/tracing.rs Outdated Show resolved Hide resolved
libcnb/src/tracing.rs Outdated Show resolved Hide resolved
libcnb/src/tracing.rs Outdated Show resolved Hide resolved
libcnb/src/tracing.rs Show resolved Hide resolved
@edmorley edmorley added enhancement New feature or request libcnb labels Nov 16, 2023
edmorley added a commit that referenced this pull request Nov 17, 2023
As of the Cargo included in Rust 1.74, lints can now be configured
in `Cargo.toml` across whole crates/workspaces:
https://blog.rust-lang.org/2023/11/16/Rust-1.74.0.html
https://doc.rust-lang.org/stable/cargo/reference/manifest.html#the-lints-section
https://doc.rust-lang.org/stable/cargo/reference/workspaces.html#the-lints-table

This reduces the boilerplate, and chance that we forget to enable
lints in some targets. The only thing we need to remember is to
add the `[lints] workspace = true` to any new crates in the future.

Making this switch exposed a few places where lints weren't enabled
and issues had been missed, eg:
#746

Since this feature requires Rust 1.74, the MSRV has also been bumped.
(Though we will have had to do so soon anyway to be able to start
using `Result::inspect_err`, which is due in Rust 1.76, xref:
#723 (comment))

GUS-W-14511805.
Copy link
Member

@edmorley edmorley left a comment

Choose a reason for hiding this comment

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

This is great - thank you so much for working on this! I can't wait to start using this in the CNBs themselves :-)

@joshwlewis joshwlewis merged commit 487d6f7 into main Dec 6, 2023
4 checks passed
@joshwlewis joshwlewis deleted the otel-tracing-2 branch December 6, 2023 17:35
edmorley added a commit to heroku/buildpacks-procfile that referenced this pull request Feb 23, 2024
This enables `libcnb`'s `trace` feature, which means traces, spans, and
events are written to OpenTelemetry export files on disk in the ephemeral
build container, which can then be read by the Heroku build system or
when debugging locally with Pack (so long as a suitable `--volume` mount
has been configured).

See:
heroku/libcnb.rs#723

GUS-W-15108954.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libcnb
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants