Skip to content

Commit

Permalink
Revert "[7.x] Add support for dynamic histogram metrics (backport #5239
Browse files Browse the repository at this point in the history
…) (#5352)"

This reverts commit d51154f.
  • Loading branch information
axw authored May 27, 2021
1 parent d51154f commit 1ace44d
Show file tree
Hide file tree
Showing 24 changed files with 36 additions and 423 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
"name": "metrics-apm.app-0.2.0-apm_error_grouping_name",
"if": "ctx.processor?.event == 'error'"
}
},
{
"pipeline": {
"name": "metrics-apm.app-0.2.0-apm_metrics_dynamic_template",
"if": "ctx.processor?.event == 'metric'"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
type: object
description: Additional experimental data sent by the agents.
dynamic: true
- name: histogram
type: histogram
- name: kubernetes.namespace
type: keyword
description: |
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
"name": "logs-apm.error-0.2.0-apm_error_grouping_name",
"if": "ctx.processor?.event == 'error'"
}
},
{
"pipeline": {
"name": "logs-apm.error-0.2.0-apm_metrics_dynamic_template",
"if": "ctx.processor?.event == 'metric'"
}
}
]
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
"name": "metrics-apm.internal-0.2.0-apm_error_grouping_name",
"if": "ctx.processor?.event == 'error'"
}
},
{
"pipeline": {
"name": "metrics-apm.internal-0.2.0-apm_metrics_dynamic_template",
"if": "ctx.processor?.event == 'metric'"
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
type: object
description: Additional experimental data sent by the agents.
dynamic: true
- name: histogram
type: histogram
- name: kubernetes.namespace
type: keyword
description: |
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
"name": "metrics-apm.profiling-0.2.0-apm_error_grouping_name",
"if": "ctx.processor?.event == 'error'"
}
},
{
"pipeline": {
"name": "metrics-apm.profiling-0.2.0-apm_metrics_dynamic_template",
"if": "ctx.processor?.event == 'metric'"
}
}
]
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@
"name": "traces-apm-0.2.0-apm_error_grouping_name",
"if": "ctx.processor?.event == 'error'"
}
},
{
"pipeline": {
"name": "traces-apm-0.2.0-apm_metrics_dynamic_template",
"if": "ctx.processor?.event == 'metric'"
}
}
]
}
1 change: 0 additions & 1 deletion apmpackage/apm/0.2.0/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,6 @@ Metrics are written to `metrics-apm.app.*`, `metrics-apm.internal.*`, and `metri
|destination.ip|IP addess of the destination. Can be one of multiple IPv4 or IPv6 addresses.|ip| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
|destination.port|Port of the destination.|long| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
|experimental|Additional experimental data sent by the agents.|object| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |
|histogram||histogram| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |
|host.architecture|The architecture of the host the event was recorded on.|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
|host.hostname|The hostname of the host the event was recorded on.|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
|host.ip|IP of the host that records the event.|ip| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
Expand Down
14 changes: 0 additions & 14 deletions docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ This file is generated! See _meta/fields.yml and scripts/generate_fields_docs.py
This document describes the fields that are exported by Apm-Server. They are
grouped in the following categories:
* <<exported-fields-apm-application-metrics>>
* <<exported-fields-apm-error>>
* <<exported-fields-apm-profile>>
* <<exported-fields-apm-sourcemap>>
Expand All @@ -31,19 +30,6 @@ grouped in the following categories:
* <<exported-fields-system>>
--
[[exported-fields-apm-application-metrics]]
== APM Application Metrics fields
APM application metrics.
*`histogram`*::
+
--
type: histogram
--
[[exported-fields-apm-error]]
== APM Error fields
Expand Down
2 changes: 1 addition & 1 deletion include/fields.go

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions ingest/pipeline/definition.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,6 @@
"name": "apm_error_grouping_name",
"if": "ctx.processor?.event == 'error'"
}
},
{
"pipeline": {
"name": "apm_metrics_dynamic_template",
"if": "ctx.processor?.event == 'metric'"
}
}
]
}
Expand Down Expand Up @@ -143,19 +137,5 @@
}
]
}
},
{
"id": "apm_metrics_dynamic_template",
"body": {
"description": "Set dynamic_templates for application metrics",
"processors": [
{
"script": {
"if": "ctx._metric_descriptions != null",
"source": "Map dynamic_templates = new HashMap();\nfor (entry in ctx._metric_descriptions.entrySet()) {\n String name = entry.getKey();\n Map description = entry.getValue();\n String metric_type = description.type;\n if (metric_type == \"histogram\") {\n dynamic_templates[name] = \"histogram\";\n }\n}\nctx._dynamic_templates = dynamic_templates;\nctx.remove(\"_metric_descriptions\");\n"
}
}
]
}
}
]
23 changes: 0 additions & 23 deletions ingest/pipeline/definition.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ apm:
- pipeline:
name: apm_error_grouping_name
if: ctx.processor?.event == 'error'
- pipeline:
name: apm_metrics_dynamic_template
if: ctx.processor?.event == 'metric'

apm_user_agent:
description: Add user agent information for APM events
Expand Down Expand Up @@ -80,23 +77,3 @@ apm_error_grouping_name:
field: error.grouping_name
copy_from: error.log.message
if: ctx.error?.log?.message != null

# TODO(axw) handle unit in metric descriptions.
# See https://github.com/elastic/elasticsearch/issues/72536
apm_metrics_dynamic_template:
description: Set dynamic_templates for application metrics
processors:
- script:
if: ctx._metric_descriptions != null
source: |
Map dynamic_templates = new HashMap();
for (entry in ctx._metric_descriptions.entrySet()) {
String name = entry.getKey();
Map description = entry.getValue();
String metric_type = description.type;
if (metric_type == "histogram") {
dynamic_templates[name] = "histogram";
}
}
ctx._dynamic_templates = dynamic_templates;
ctx.remove("_metric_descriptions");
34 changes: 0 additions & 34 deletions model/metricset.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,6 @@ var (
metricsetProcessorEntry = common.MapStr{"name": metricsetProcessorName, "event": metricsetDocType}
)

// MetricType describes the type of a metric: gauge, counter, or histogram.
type MetricType string

// Valid MetricType values.
const (
MetricTypeGauge MetricType = "gauge"
MetricTypeCounter MetricType = "counter"
MetricTypeHistogram MetricType = "histogram"
)

// Metricset describes a set of metrics and associated metadata.
type Metricset struct {
// Timestamp holds the time at which the metrics were published.
Expand Down Expand Up @@ -106,20 +96,6 @@ type Sample struct {
// Name holds the metric name.
Name string

// Type holds an optional metric type.
//
// If Type is unspecified or invalid, it will be ignored.
Type MetricType

// Unit holds an optional unit:
//
// - "percent" (value is in the range [0,1])
// - "byte"
// - a time unit: "nanos", "micros", "ms", "s", "m", "h", "d"
//
// If Unit is unspecified or invalid, it will be ignored.
Unit string

// Value holds the metric value for single-value metrics.
//
// If Counts and Values are specified, then Value will be ignored.
Expand Down Expand Up @@ -228,16 +204,6 @@ func (me *Metricset) appendBeatEvents(cfg *transform.Config, events []beat.Event

fields["processor"] = metricsetProcessorEntry

// Set a _metric_descriptions field, which holds optional metric types and units.
var metricDescriptions mapStr
for _, sample := range me.Samples {
var m mapStr
m.maybeSetString("type", string(sample.Type))
m.maybeSetString("unit", sample.Unit)
metricDescriptions.maybeSetMapStr(sample.Name, common.MapStr(m))
}
fields.maybeSetMapStr("_metric_descriptions", common.MapStr(metricDescriptions))

if cfg.DataStreams {
dataset := AppMetricsDataset
// Metrics are stored in "metrics" data streams.
Expand Down
9 changes: 0 additions & 9 deletions model/metricset/_meta/fields.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
- key: apm-application-metrics
title: "APM Application Metrics"
description: APM application metrics.
short_config: true
fields:
- name: histogram
type: histogram
dynamic_template: true

- key: apm-transaction-metrics
title: "APM Transaction Metrics"
description: >
Expand Down
48 changes: 0 additions & 48 deletions model/metricset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,54 +226,6 @@ func TestTransform(t *testing.T) {
},
Msg: "Payload with destination service.",
},
{
Metricset: &Metricset{
Timestamp: timestamp,
Metadata: metadata,
Samples: []Sample{{
Name: "latency_histogram",
Type: "histogram",
Unit: "s",
Counts: []int64{1, 2, 3},
Values: []float64{1.1, 2.2, 3.3},
}, {
Name: "just_type",
Type: "counter",
Value: 123,
}, {
Name: "just_unit",
Unit: "percent",
Value: 0.99,
}},
},
Output: []common.MapStr{
{
"data_stream.type": "metrics",
"data_stream.dataset": "apm.app.myservice",
"processor": common.MapStr{"event": "metric", "name": "metric"},
"service": common.MapStr{"name": "myservice"},
"latency_histogram": common.MapStr{
"counts": []int64{1, 2, 3},
"values": []float64{1.1, 2.2, 3.3},
},
"just_type": 123.0,
"just_unit": 0.99,
"_metric_descriptions": common.MapStr{
"latency_histogram": common.MapStr{
"type": "histogram",
"unit": "s",
},
"just_type": common.MapStr{
"type": "counter",
},
"just_unit": common.MapStr{
"unit": "percent",
},
},
},
},
Msg: "Payload with metric type and unit.",
},
}

for idx, test := range tests {
Expand Down
Loading

0 comments on commit 1ace44d

Please sign in to comment.