bazelbuild / bazel

a fast, scalable, multi-language and extensible build system
https://bazel.build
Apache License 2.0
22.65k stars 3.97k forks source link

Integrate with OpenTelemetry #19158

Open tbaing opened 10 months ago

tbaing commented 10 months ago

Description of the feature request:

We're interested in having Bazel integrate with OpenTelemetry, with the idea that we'd like each build graph action to open a new span that links to the parent span for the overall Bazel invocation. This way, when our code invokes Bazel (inside an OTel span) and Bazel makes many actions that may invoke OTel-compatible tools we create, we'd be able to link the spans from those child tools to the specific Bazel action that spawned them rather than the overall Bazel process.

We recognize that the JSON profiles and the BEP provide two other ways to get (some of) this information, and that that might make implementing this third alternative somewhat unappealing. But Open Telemetry would let us link the processes Bazel invokes into the overall graph in a way that I don't believe those other two mechanisms can support, so we think it could still provide value despite the similarity to those other features.

Which category does this issue belong to?

No response

What underlying problem are you trying to solve with this feature?

We want to be able to capture OpenTelemetry traces across our full build, where Bazel will be invoked by scripts above it and will invoke scripts below it, to understand more details about our build's performance than are provided by Bazel's JSON profiling data alone.

Which operating system are you running Bazel on?

No response

What is the output of bazel info release?

No response

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse master; git rev-parse HEAD ?

No response

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

ahumesky commented 10 months ago

This doesn't look specifically related to Android -- perhaps this is team-OSS or team-Performance

meisterT commented 9 months ago

cc @fweikert

goedelsoup-clari commented 2 weeks ago

@tbaing, would the goal at this point be to align with the opentelemetry CI/CD initiative?

tbaing commented 2 weeks ago

My immediate goal was to be able to invoke Bazel within a broader process that's instrumented via OpenTelemetry and have the Bazel actions captured within that OpenTelemetry profile so we don't need to manually integrate what Bazel produces into our OpenTelemetry profile. But of course implementing this could benefit other use cases beyond the one that prompted me to propose this.