-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support disabling unit and metric suffixes and move config into GMP m…
…odule.
- Loading branch information
Showing
10 changed files
with
123 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright 2023 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package googlemanagedprometheus | ||
|
||
// Config provides configuration options specific to the GMP translation. | ||
// It is meant to be embedded in the googlemanagedprometheus configuration. | ||
type Config struct { | ||
// AddMetricSuffixes controls whether suffixes are added to metric names. Defaults to true. | ||
AddMetricSuffixes bool `mapstructure:"add_metric_suffixes"` | ||
// ExtraMetricsConfig configures the target_info and otel_scope_info metrics. | ||
ExtraMetricsConfig ExtraMetricsConfig `mapstructure:"extra_metrics_config"` | ||
} | ||
|
||
// ExtraMetricsConfig controls the inclusion of additional metrics. | ||
type ExtraMetricsConfig struct { | ||
// Add `target_info` metric based on the resource. On by default. | ||
EnableTargetInfo bool `mapstructure:"enable_target_info"` | ||
// Add `otel_scope_info` metric and `scope_name`/`scope_version` attributes to all other metrics. On by default. | ||
EnableScopeInfo bool `mapstructure:"enable_scope_info"` | ||
} | ||
|
||
func DefaultConfig() Config { | ||
return Config{ | ||
AddMetricSuffixes: true, | ||
ExtraMetricsConfig: ExtraMetricsConfig{ | ||
EnableTargetInfo: true, | ||
EnableScopeInfo: true, | ||
}, | ||
} | ||
} | ||
|
||
// Validate checks if the exporter configuration is valid. | ||
func (cfg *Config) Validate() error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.