• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

elastic / cloudbeat / 16270040091
76%

Build:
DEFAULT BRANCH: main
Ran 14 Jul 2025 02:59PM UTC
Jobs 1
Files 229
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Jul 2025 02:45PM UTC coverage: 76.129% (-0.06%) from 76.193%
16270040091

push

github

web-flow
Add OpenTelemetry (#3430)

### Summary of your changes
This pull request introduces OpenTelemetry (OTel) for observability, enabling tracing and metrics collection in cloudbeat.

The key changes are:
*   **New Observability Package:** A new package `internal/infra/observability` has been added to encapsulate all OpenTelemetry-related logic. This package is responsible for:
    *   Initializing and configuring the OTel tracer and meter providers.
    *   Setting up the OTLP exporter to send telemetry data to Elastic's APM server over gRPC.
    *   Providing helper functions to create spans and instrument code.
    *   Adding OTel instrumentation to AWS SDK calls.
*   **Instrumentation of Core Components:**
    *   The **Posture** flavor now initializes OpenTelemetry at startup and gracefully shuts it down on exit. This needs to happen for CNVM and Asset Inventory as well but it's left as a future item.
    *   The **Resource Fetching Manager** is instrumented to create spans for each fetching cycle and for each individual fetcher. This will help in tracking the performance and status of resource fetching.
    *   The **AWS Organization Benchmark** is updated to create spans for the AWS account discovery process. This required changes in the function signatures of the resource fetching `Registry`.
*   **Context Propagation:** The `context.Context` is now used to propagate trace information across different parts of the application.
*   **Enhanced Logging:** The logging infrastructure has been updated to include `trace.id` and `span.id` in the logs, allowing for easy correlation between logs and traces. More work is needed to fully utilize this across the codebase.

### Screenshot/Data

On AWS multi-account onboarding, the `otelaws` has an edge case where there's no span name when the ec2imds service cannot be reached:
```
Region 'us-east-1' selected after failure to retrieve aws regions: operation error ec2imds: GetInstanceIdentityDocument, canceled, co... (continued)

165 of 224 new or added lines in 9 files covered. (73.66%)

2 existing lines in 1 file now uncovered.

9478 of 12450 relevant lines covered (76.13%)

16.6 hits per line

New Missed Lines in Diff

Lines Coverage ∆ File
2
93.94
-1.41% internal/resources/fetching/manager/manager.go
2
96.83
-3.17% internal/resources/fetching/registry/registry.go
7
53.33
internal/infra/observability/aws.go
8
0.0
0.0% internal/flavors/posture.go
9
67.86
internal/infra/observability/context.go
31
74.38
internal/infra/observability/otel.go

Uncovered Existing Lines

Lines Coverage ∆ File
2
84.89
0.0% internal/resources/providers/gcplib/inventory/provider.go
Jobs
ID Job ID Ran Files Coverage
1 16270040091.1 14 Jul 2025 02:59PM UTC 229
76.13
GitHub Action Run
Source Files on build 16270040091
  • Tree
  • List 229
  • Changed 7
  • Source Changed 0
  • Coverage Changed 7
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 98cb9162 on github
  • Prev Build on main (#16265841539)
  • Next Build on main (#16296457520)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc