8000 Apply inclusion/exclusion selection for OTEL resource attributes by marctc · Pull Request #1818 · grafana/beyla · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Apply inclusion/exclusion selection for OTEL resource attributes #1818

8000 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
merged 7 commits into from
Apr 16, 2025

Conversation

marctc
Copy link
Contributor
@marctc marctc commented Apr 11, 2025

Current attributes > select logic for include/exclude attributes only work for metric attributes. Therefore when using OpenTelemetry, is not filtering those attributes that are resource attributes (ending in target_info metric) leading to confusion for some users.

This fixes #1802

@marctc marctc requested a review from a team as a code owner April 11, 2025 11:05
@marctc marctc requested review from Copilot, mariomac and grcevski and removed request for a team April 11, 2025 11:20
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

pkg/export/otel/common.go:136

  • Replacing dots with underscores for normalization may lead to unintended matches if attribute keys already contain underscores. Please confirm this transformation is intended.
normalizedAttrName := strings.ReplaceAll(attrName, ".", "_")

pkg/export/otel/metrics_net.go:74

  • [nitpick] Consider unifying the naming conventions for the prefix patterns used for network attributes to ensure consistency across the code base.
return getFilteredAttributesByPrefix(baseAttrs, attrSelector, extraAttrs, []string{"network.", "beyla.network"})

Copy link
codecov bot commented Apr 11, 2025

Codecov Report

Attention: Patch coverage is 93.33333% with 6 lines in your changes missing coverage. Please review.

Project coverage is 74.25%. Comparing base (8f11289) to head (b9c0da2).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
pkg/export/otel/common.go 94.33% 2 Missing and 1 partial ⚠️
pkg/export/otel/metrics_net.go 76.92% 2 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1818      +/-   ##
==========================================
+ Coverage   73.80%   74.25%   +0.45%     
==========================================
  Files         177      177              
  Lines       19126    19194      +68     
==========================================
+ Hits        14116    14253     +137     
+ Misses       4279     4211      -68     
+ Partials      731      730       -1     
Flag Coverage Δ
integration-test 57.26% <85.55%> (-0.05%) ⬇️
k8s-integration-test 55.60% <83.33%> (+0.73%) ⬆️
oats-test 35.46% <7.77%> (-0.08%) ⬇️
unittests 46.12% <90.00%> (+0.10%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines 836 to 843
httpMetrics := []string{"http.server", "http.client"}
rpcMetrics := []string{"rpc.server", "rpc.client"}
dbMetrics := []string{"db.client"}
messagingMetrics := []string{"messaging."}

metricTypes := append(httpMetrics, rpcMetrics...)
metricTypes = append(metricTypes, dbMetrics...)
metricTypes = append(metricTypes, messagingMetrics...)
Copy link
Contributor

Choose a reason for hiding this comment

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

as this seems to be always the same value, can't we just create a global variable?

var metricTypes := []string{
   "http.server", "http.client", "rpc.server", "rpc.client" .... etc etc

@marctc marctc requested a review from mariomac April 14, 2025 08:37
Copy link
Contributor
@mariomac mariomac left a comment

Choose a reason for hiding this comment

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

I think the attribute selection logic could be integrated in the attr_defs.go and attr_selector.go to avoid maintaining two selection systems.

But I'm fine merging it and later applying some improvements.

@marctc marctc requested a review from grafsean as a code owner April 16, 2025 12:34
@marctc
Copy link
Contributor Author
marctc commented Apr 16, 2025

I think the attribute selection logic could be integrated in the attr_defs.go and attr_selector.go to avoid maintaining two selection systems.

But I'm fine merging it and later applying some improvements.

i couldn't find an elegant way to do it 🤷

@marctc marctc merged commit 6567a95 into main Apr 16, 2025
13 checks passed
@marctc marctc deleted the otel_filtering_logic branch April 16, 2025 13:55
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.

Unable to exclude metrics atrribute for OTEL
2 participants
0