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

Allow for easier network metrics enablement #1013

Merged
merged 4 commits into from
Jul 15, 2024

Conversation

grcevski
Copy link
Contributor

@grcevski grcevski commented Jul 12, 2024

Enabling network metrics could be confusing if the documentation isn't always properly read. Essentially we had an internal default of enabled metrics features "application,network", however to actually enable network metrics collection we had to explicitly turn on network monitoring. This duality created some friction. For example, we'd fail to enable properly network metrics with these configuration options:

  BEYLA_OTEL_METRIC_FEATURES: "application"
  BEYLA_NETWORK_METRICS: "true"
  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:...

If we read what the configuration says:

  1. We want to have metric features "application".
  2. We want to enable network metrics collection.

A properly working configuration would've been:

  BEYLA_OTEL_METRIC_FEATURES: "application,network"
  BEYLA_NETWORK_METRICS: "true"
  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:...

So kind of double enabling network metrics.

At the same time, the following configuration doesn't enable network metrics:

  BEYLA_OTEL_METRIC_FEATURES: "application,network"
  OTEL_EXPORTER_OTLP_METRICS_ENDPOINT:...

Since we are missing the flag to enable network metrics, even though we've specified in the features we want network metrics.

I think the correct way to enable any metric collection feature is to list it explicitly in the features section, e.g. "application,network" should enable both, no further option should be required.

This PR resolves this, but to keep backwards compatibility I kept the explicit enablement of the network metrics via BEYLA_NETWORK_METRICS: "true", which is equivalent to adding the "network" keyword in the features section for both OTel and Prometheus export.

@codecov-commenter
Copy link

codecov-commenter commented Jul 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.23%. Comparing base (f68fdb2) to head (fd29228).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1013      +/-   ##
==========================================
+ Coverage   80.18%   80.23%   +0.04%     
==========================================
  Files         137      137              
  Lines       10932    10942      +10     
==========================================
+ Hits         8766     8779      +13     
+ Misses       1685     1683       -2     
+ Partials      481      480       -1     
Flag Coverage Δ
integration-test 55.13% <100.00%> (+0.05%) ⬆️
k8s-integration-test 57.66% <100.00%> (-0.02%) ⬇️
oats-test 37.34% <60.00%> (+0.02%) ⬆️
unittests 50.06% <100.00%> (+0.02%) ⬆️

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.

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.

Good suggestion!

Comment on lines 52 to +57
| -------- | ----------------------- | ------- | ------- |
| `enable` | `BEYLA_NETWORK_METRICS` | boolean | `false` |

Enables network metrics reporting in Beyla.
Explicitly enables network metrics reporting in Beyla. You can also enable network metrics reporting
by adding `network` to the list of `features` for [otel_metrics_export]({{< relref "../configure/options.md#otel-metrics-exporter" >}}))
or [prometheus_export]({{< relref "../configure/options.md#prometheus-http-endpoint" >}})).
Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to keep this only for backwards-compatibility purposes, I'd even delete it from the documentation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I should follow-up with a PR to remove the docs and also remove it from examples and the chart. Perhaps we do this work for 2.0?

@grcevski grcevski merged commit b3b01db into grafana:main Jul 15, 2024
8 checks passed
@grcevski grcevski deleted the metric_options branch July 15, 2024 14:31
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.

3 participants