-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 user to pass in metrics namespace #5758
Conversation
Codecov Report
@@ Coverage Diff @@
## main #5758 +/- ##
==========================================
- Coverage 91.78% 91.62% -0.16%
==========================================
Files 192 192
Lines 11394 11429 +35
==========================================
+ Hits 10458 10472 +14
- Misses 742 763 +21
Partials 194 194
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@open-telemetry/collector-approvers the issue was not triaged but the feature seems reasonable to me. Any thoughts on whether we want this accepted?
CHANGELOG.md
Outdated
@@ -14,6 +14,7 @@ | |||
|
|||
- `ocb` now exits with an error if it fails to load the build configuration. (#5731) | |||
- Deprecate `HTTPClientSettings.ToClientWithHost` (#5737) | |||
- Add a new field `namespace` in `service.telemetry.metrics.namespace` to allow user to customize metric namespace (#5692) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Add a new field `namespace` in `service.telemetry.metrics.namespace` to allow user to customize metric namespace (#5692) | |
- Add a new field `service.telemetry.metrics.namespace` to allow users to customize the collector's metric namespace (#5692) |
service/telemetry/config.go
Outdated
@@ -102,4 +102,7 @@ type MetricsConfig struct { | |||
|
|||
// Address is the [address]:port that metrics exposition should be bound to. | |||
Address string `mapstructure:"address"` | |||
|
|||
// NameSpace indicates the telemetry namespace the service will set. | |||
NameSpace string `mapstructure:"namespace"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd recommends going with Namespace
instead, since it is a single word.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sounds good. will update
service/telemetry.go
Outdated
namespace := defaultNameSpace | ||
if cfg.Metrics.NameSpace != "" { | ||
namespace = cfg.Metrics.NameSpace | ||
} | ||
opts := prometheus.Options{ | ||
Namespace: "otelcol", | ||
Namespace: namespace, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will only change the namespace when using OpenCensus metrics. For users that enable the useOtelForInternalMetricsfeatureGateID
feature gate and use OTEL metrics, is the namespace not relevant? Or does initOpenTelemetry
also need to be made aware of the namespace?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there isn't a namespace set in the opentelemetry metrics(through useOtelForInternalMetricsfeatureGateID
). I think there are still a lot of designs around that with the beta milestone so I will keep it as it is.
Issue description is bit confusing. Can you please reply to #5692 (comment) |
@dmitryax @TylerHelmuth any other comments or good to merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks @splunkericl!
service/telemetry/config.go
Outdated
@@ -102,4 +102,7 @@ type MetricsConfig struct { | |||
|
|||
// Address is the [address]:port that metrics exposition should be bound to. | |||
Address string `mapstructure:"address"` | |||
|
|||
// Namespace indicates the telemetry namespace the service will set. If nil, a default value is assigned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description is not very clear. As an otel collector user, I don't understand it without looking into the code. Please mention that it changes namespace of exposed OTel collector's metrics and that default namespace is otelcol
. It maybe good to also show an example of how the metrics will look like if the namespace is changed for a generic metric like otelcol_process_uptime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that is fair. Will add it to be more explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added in the new version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only supported in opencensus (based on my knowledge), are we sure that we want to add this as another blocker to adopt opentelemetry?
This PR was marked stale due to lack of activity. It will be closed in 14 days. |
Closed as inactive. Feel free to reopen if this PR is still being worked on. |
Description:
Adding a configuration that allows user to configure their metrics namespace
Link to tracking Issue:
#5692
Testing:
Added a unit test to verify namespace can be customized
Documentation:
Added godoc on the new
namespace
field