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

[datadogexporter] [Breaking change] Make distributions the default histogram export option #5885

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion exporter/datadogexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,5 @@ There are a number of optional settings for configuring how to send your metrics
| `send_monotonic_counter` | Cumulative monotonic metrics are sent as deltas between successive measurements. Disable this flag to send get the raw, monotonically increasing value. | `true` |
| `delta_ttl` | Maximum number of seconds values from cumulative monotonic metrics are kept in memory. | 3600 |
| `report_quantiles` | Whether to report quantile values for summary type metrics. | `true` |
| `histograms::mode` | Mode for histograms. Valid values are `nobuckets` (no bucket metrics), `counters` (one metric per bucket) and `distributions` (send as Datadog distributions, recommended). | `nobuckets` |
| `histograms::mode` | Mode for histograms. Valid values are `nobuckets` (no bucket metrics), `counters` (one metric per bucket) and `distributions` (send as Datadog distributions, recommended). | `distributions` |
| `histograms::send_count_sum_metrics` | Whether to report sum and count for histograms as separate metrics. | `true` |
8 changes: 4 additions & 4 deletions exporter/datadogexporter/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ type MetricsConfig struct {

// HistogramConfig customizes export of OTLP Histograms.
type HistogramConfig struct {
// Mode for exporting histograms. Valid values are 'counters' or 'nobuckets'.
// Mode for exporting histograms. Valid values are 'distributions', 'counters' or 'nobuckets'.
// - 'distributions' sends histograms as Datadog distributions (recommended).
// - 'counters' sends histograms as Datadog counts, one metric per bucket.
// - 'nobuckets' sends no bucket histogram metrics. .sum and .count metrics will still be sent
// if `send_count_sum_metrics` is enabled.
// - 'distributions' sends histograms as Datadog distributions (recommended).
//
// The current default is 'nobuckets'.
// The current default is 'distributions'.
Mode string `mapstructure:"mode"`

// SendCountSum states if the export should send .sum and .count metrics for histograms.
// The current default is true.
// The current default is false.
SendCountSum bool `mapstructure:"send_count_sum_metrics"`
}

Expand Down
2 changes: 1 addition & 1 deletion exporter/datadogexporter/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func TestErrorReportBuckets(t *testing.T) {
for _, testInstance := range tests {
t.Run(testInstance.name, func(t *testing.T) {
// default config for buckets
config := Config{Metrics: MetricsConfig{HistConfig: HistogramConfig{Mode: histogramModeNoBuckets}}}
config := Config{Metrics: MetricsConfig{HistConfig: HistogramConfig{Mode: histogramModeDistributions}}}
configMap := colconfig.NewMapFromStringMap(testInstance.stringMap)
err := config.Unmarshal(configMap)

Expand Down
6 changes: 3 additions & 3 deletions exporter/datadogexporter/example/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,14 +99,14 @@ exporters:

## @param histograms - custom object - optional
## Histograms specific configuration.
## @param mode - string - optional - default: nobuckets
## @param mode - string - optional - default: distributions
## How to report histograms. Valid values are:
##
## - `distributions` to report metrics as Datadog distributions (recommended).
## - `nobuckets` to not report bucket metrics,
## - `counters` to report one metric per histogram bucket.
## - `distributions` to report metrics as Datadog distributions (recommended).
#
# mode: nobuckets
# mode: distributions

## @param send_count_sum_metrics - boolean - optional - default: true
## Whether to report sum and count as separate histogram metrics.
Expand Down
6 changes: 3 additions & 3 deletions exporter/datadogexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ func createDefaultConfig() config.Exporter {
InstrumentationLibraryMetadataAsTags: false,
},
HistConfig: ddconfig.HistogramConfig{
Mode: "nobuckets",
SendCountSum: true,
Mode: "distributions",
SendCountSum: false,
mx-psi marked this conversation as resolved.
Show resolved Hide resolved
},
},

Expand Down Expand Up @@ -115,7 +115,7 @@ func createMetricsExporter(
}

// TODO: Remove after changing the default mode.
set.Logger.Warn("Default histograms configuration will change to mode 'distributions' and no .count and .sum metrics in a future release.")
set.Logger.Info("Histograms configuration now defaults to 'distributions' mode and no .count and .sum metrics.")

ctx, cancel := context.WithCancel(ctx)
var pushMetricsFn consumerhelper.ConsumeMetricsFunc
Expand Down
20 changes: 10 additions & 10 deletions exporter/datadogexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ func TestCreateDefaultConfig(t *testing.T) {
SendMonotonic: true,
Quantiles: true,
HistConfig: ddconfig.HistogramConfig{
Mode: "nobuckets",
SendCountSum: true,
Mode: "distributions",
SendCountSum: false,
},
},

Expand Down Expand Up @@ -134,8 +134,8 @@ func TestLoadConfig(t *testing.T) {
SendMonotonic: true,
Quantiles: true,
HistConfig: ddconfig.HistogramConfig{
Mode: "nobuckets",
SendCountSum: true,
Mode: "distributions",
SendCountSum: false,
},
},

Expand Down Expand Up @@ -182,8 +182,8 @@ func TestLoadConfig(t *testing.T) {
DeltaTTL: 3600,
Quantiles: true,
HistConfig: ddconfig.HistogramConfig{
Mode: "nobuckets",
SendCountSum: true,
Mode: "distributions",
SendCountSum: false,
},
},

Expand Down Expand Up @@ -272,8 +272,8 @@ func TestLoadConfigEnvVariables(t *testing.T) {
Quantiles: false,
DeltaTTL: 3600,
HistConfig: ddconfig.HistogramConfig{
Mode: "nobuckets",
SendCountSum: true,
Mode: "distributions",
SendCountSum: false,
},
},

Expand Down Expand Up @@ -323,8 +323,8 @@ func TestLoadConfigEnvVariables(t *testing.T) {
DeltaTTL: 3600,
Quantiles: true,
HistConfig: ddconfig.HistogramConfig{
Mode: "nobuckets",
SendCountSum: true,
Mode: "distributions",
SendCountSum: false,
},
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ func (t testProvider) Hostname(context.Context) (string, error) {

func newTranslator(t *testing.T, logger *zap.Logger) *translator.Translator {
tr, err := translator.New(logger,
translator.WithCountSumMetrics(),
translator.WithHistogramMode(translator.HistogramModeNoBuckets),
translator.WithHistogramMode(translator.HistogramModeDistributions),
translator.WithNumberMode(translator.NumberModeCumulativeToDelta),
translator.WithFallbackHostnameProvider(testProvider("fallbackHostname")),
)
Expand Down
Loading