Skip to content
Closed
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
29 changes: 17 additions & 12 deletions confgenerator/agentmetrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,20 +218,14 @@ func (r AgentSelfMetrics) LoggingMetricsPipelineProcessors() []otel.Component {
// Format fluentbit and otel logging metrics before aggregation.
otel.MetricsTransform(
otel.RenameMetric("fluentbit_stackdriver_retried_records_total", "fluentbit_log_entry_retry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
otel.RenameLabel("status", "response_code"),
otel.AggregateLabels("sum", "response_code"),
),
otel.DuplicateMetric("otelcol_exporter_send_failed_log_records", "otel_log_entry_retry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
otel.AddLabel("response_code", "400"),
otel.AggregateLabels("sum", "response_code"),
),
otel.RenameMetric("fluentbit_stackdriver_requests_total", "fluentbit_request_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
otel.RenameLabel("status", "response_code"),
otel.AggregateLabels("sum", "response_code"),
),
Expand All @@ -242,20 +236,14 @@ func (r AgentSelfMetrics) LoggingMetricsPipelineProcessors() []otel.Component {
otel.AggregateLabels("sum", "response_code"),
),
otel.RenameMetric("fluentbit_stackdriver_proc_records_total", "fluentbit_log_entry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
otel.RenameLabel("status", "response_code"),
otel.AggregateLabels("sum", "response_code"),
),
otel.RenameMetric("otelcol_exporter_sent_log_records", "otel_log_entry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
otel.AddLabel("response_code", "200"),
otel.AggregateLabels("sum", "response_code"),
),
otel.RenameMetric("otelcol_exporter_send_failed_log_records", "otel_log_entry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
otel.AddLabel("response_code", "400"),
otel.AggregateLabels("sum", "response_code"),
),
Expand Down Expand Up @@ -297,6 +285,23 @@ func (r AgentSelfMetrics) LoggingMetricsPipelineProcessors() []otel.Component {
// DeltaToCumulative keeps in memory information of previous delta points
// to generate a valid cumulative monotonic metric.
otel.DeltaToCumulative(),
otel.MetricStartTime(),
Copy link
Contributor

Choose a reason for hiding this comment

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

What strategy are we using to set the start times ? Is this equivalent to the Google Cloud exporter strategy ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It uses the subtract_initial_point strategy

metricstarttime/loggingmetrics_7:
  strategy: subtract_initial_point

https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/metricstarttimeprocessor/internal/subtractinitial/adjuster.go#L217-L226

This is what is done on the exporter:
https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/blob/main/exporter/collector/internal/normalization/standard_normalizer.go#L250-L257

From my understanding, they both drop the first point when the starttime is zero and cache it as a reference value for the next points.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good ! Thank you! Yes, it makes sense to use that strategy as a replacement for the exporter "standard_normalization".

// Transfrom from double -> int64 after we apply the metricstarttime processor
// This prevents us from hitting b/
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a bug tracker and summarize briefly the issue.

otel.MetricsTransform(
otel.UpdateMetric("agent/log_entry_retry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
),
otel.UpdateMetric("agent/request_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
),
otel.UpdateMetric("agent/log_entry_count",
// change data type from double -> int64
otel.ToggleScalarDataType,
),
),
// The processor "interval" outputs the last point in each 1 minute interval.
otel.Interval("1m"),
otel.MetricsTransform(otel.AddPrefix("agent.googleapis.com")),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ processors:
- otelcol_process_memory_rss
- grpc.client.attempt.duration_count
- googlecloudmonitoring/point_count
interval/loggingmetrics_7:
interval/loggingmetrics_9:
interval: 1m
metricstarttime/loggingmetrics_7:
strategy: subtract_initial_point
metricstransform/fluentbit_1:
transforms:
- action: update
Expand Down Expand Up @@ -384,13 +386,18 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/loggingmetrics_10:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/loggingmetrics_3:
transforms:
- action: update
include: fluentbit_stackdriver_retried_records_total
new_name: fluentbit_log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand All @@ -402,7 +409,6 @@ processors:
include: otelcol_exporter_send_failed_log_records
new_name: otel_log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "400"
Expand All @@ -414,7 +420,6 @@ processors:
include: fluentbit_stackdriver_requests_total
new_name: fluentbit_request_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand Down Expand Up @@ -474,7 +479,6 @@ processors:
include: fluentbit_stackdriver_proc_records_total
new_name: fluentbit_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand All @@ -486,7 +490,6 @@ processors:
include: otelcol_exporter_sent_log_records
new_name: otel_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "200"
Expand All @@ -498,7 +501,6 @@ processors:
include: otelcol_exporter_send_failed_log_records
new_name: otel_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "400"
Expand All @@ -519,9 +521,17 @@ processors:
metricstransform/loggingmetrics_8:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
include: agent/log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: update
include: agent/request_count
operations:
- action: toggle_scalar_data_type
- action: update
include: agent/log_entry_count
operations:
- action: toggle_scalar_data_type
metricstransform/otel_3:
transforms:
- action: update
Expand Down Expand Up @@ -692,8 +702,10 @@ service:
- cumulativetodelta/loggingmetrics_4
- transform/loggingmetrics_5
- deltatocumulative/loggingmetrics_6
- interval/loggingmetrics_7
- metricstarttime/loggingmetrics_7
- metricstransform/loggingmetrics_8
- interval/loggingmetrics_9
- metricstransform/loggingmetrics_10
- resourcedetection/_global_0
receivers:
- prometheus/agent_prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ processors:
- otelcol_process_memory_rss
- grpc.client.attempt.duration_count
- googlecloudmonitoring/point_count
interval/loggingmetrics_7:
interval/loggingmetrics_9:
interval: 1m
metricstarttime/loggingmetrics_7:
strategy: subtract_initial_point
metricstransform/fluentbit_1:
transforms:
- action: update
Expand Down Expand Up @@ -360,13 +362,18 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/loggingmetrics_10:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/loggingmetrics_3:
transforms:
- action: update
include: fluentbit_stackdriver_retried_records_total
new_name: fluentbit_log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand All @@ -378,7 +385,6 @@ processors:
include: otelcol_exporter_send_failed_log_records
new_name: otel_log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "400"
Expand All @@ -390,7 +396,6 @@ processors:
include: fluentbit_stackdriver_requests_total
new_name: fluentbit_request_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand Down Expand Up @@ -450,7 +455,6 @@ processors:
include: fluentbit_stackdriver_proc_records_total
new_name: fluentbit_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand All @@ -462,7 +466,6 @@ processors:
include: otelcol_exporter_sent_log_records
new_name: otel_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "200"
Expand All @@ -474,7 +477,6 @@ processors:
include: otelcol_exporter_send_failed_log_records
new_name: otel_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "400"
Expand All @@ -495,9 +497,17 @@ processors:
metricstransform/loggingmetrics_8:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
include: agent/log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: update
include: agent/request_count
operations:
- action: toggle_scalar_data_type
- action: update
include: agent/log_entry_count
operations:
- action: toggle_scalar_data_type
metricstransform/otel_3:
transforms:
- action: update
Expand Down Expand Up @@ -658,8 +668,10 @@ service:
- cumulativetodelta/loggingmetrics_4
- transform/loggingmetrics_5
- deltatocumulative/loggingmetrics_6
- interval/loggingmetrics_7
- metricstarttime/loggingmetrics_7
- metricstransform/loggingmetrics_8
- interval/loggingmetrics_9
- metricstransform/loggingmetrics_10
- resourcedetection/_global_0
receivers:
- prometheus/agent_prometheus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,10 @@ processors:
- otelcol_process_memory_rss
- grpc.client.attempt.duration_count
- googlecloudmonitoring/point_count
interval/loggingmetrics_7:
interval/loggingmetrics_9:
interval: 1m
metricstarttime/loggingmetrics_7:
strategy: subtract_initial_point
metricstransform/fluentbit_1:
transforms:
- action: update
Expand Down Expand Up @@ -367,13 +369,18 @@ processors:
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/loggingmetrics_10:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
metricstransform/loggingmetrics_3:
transforms:
- action: update
include: fluentbit_stackdriver_retried_records_total
new_name: fluentbit_log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand All @@ -385,7 +392,6 @@ processors:
include: otelcol_exporter_send_failed_log_records
new_name: otel_log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "400"
Expand All @@ -397,7 +403,6 @@ processors:
include: fluentbit_stackdriver_requests_total
new_name: fluentbit_request_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand Down Expand Up @@ -457,7 +462,6 @@ processors:
include: fluentbit_stackdriver_proc_records_total
new_name: fluentbit_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: update_label
label: status
new_label: response_code
Expand All @@ -469,7 +473,6 @@ processors:
include: otelcol_exporter_sent_log_records
new_name: otel_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "200"
Expand All @@ -481,7 +484,6 @@ processors:
include: otelcol_exporter_send_failed_log_records
new_name: otel_log_entry_count
operations:
- action: toggle_scalar_data_type
- action: add_label
new_label: response_code
new_value: "400"
Expand All @@ -502,9 +504,17 @@ processors:
metricstransform/loggingmetrics_8:
transforms:
- action: update
include: ^(.*)$$
match_type: regexp
new_name: agent.googleapis.com/$${1}
include: agent/log_entry_retry_count
operations:
- action: toggle_scalar_data_type
- action: update
include: agent/request_count
operations:
- action: toggle_scalar_data_type
- action: update
include: agent/log_entry_count
operations:
- action: toggle_scalar_data_type
metricstransform/otel_3:
transforms:
- action: update
Expand Down Expand Up @@ -668,8 +678,10 @@ service:
- cumulativetodelta/loggingmetrics_4
- transform/loggingmetrics_5
- deltatocumulative/loggingmetrics_6
- interval/loggingmetrics_7
- metricstarttime/loggingmetrics_7
- metricstransform/loggingmetrics_8
- interval/loggingmetrics_9
- metricstransform/loggingmetrics_10
- resourcedetection/_global_0
receivers:
- prometheus/agent_prometheus
Expand Down
Loading
Loading