GoogleCloudPlatform / ops-agent

Apache License 2.0
139 stars 68 forks source link

Feature Request: Allow opentelemetry transform processor config to be passed from ops-agent config to the generated opentelemetry collector config #1686

Open ryanohnemus opened 4 months ago

ryanohnemus commented 4 months ago

Describe the feature Currently only exclude_metric transforms are supported via the current documentation. There is no way to have opentelemetry transform processor config as part of the ops-agent config file (/etc/google-cloud-ops-agent/config.yaml) and have that configuration passed to the generated opentelemetry config that is used by the google-cloud-ops-agent-opentelemetry-collector service. The transform processor is supported by the google-cloud-ops-agent-opentelemetry-collector as you can edit the generated /run/google-cloud-ops-agent-opentelemetry-collector/otel.yaml, add a transform processor and restart the google-cloud-ops-agent-opentelemetry-collector and the metric transforms will work. There is also testdata in this repo that uses the metric transform processor (https://github.com/GoogleCloudPlatform/ops-agent/blob/master/confgenerator/testdata/goldens/combined-receiver_otlp/golden/linux/otel.yaml#L469), so i'm hoping this is just a small change to allow the ops-agent config to be passed to the generated opentelemetry-collector config.

Adding this feature should be enough to also close out https://github.com/GoogleCloudPlatform/ops-agent/issues/1682 as that issue seems to also be looking for a metric transform via:

metric_statements:
  - context: metric
statements:
  - extract_count_metrics(true) where name == "workload.googleapis.com/http.server.request.duration"
  - set(name, "workload.googleapis.com/http.server.request.count") where name == "workload.googleapis.com/http.server.request.duration_count"
  - set(unit, "1") where name == "workload.googleapis.com/http.server.request.count"
  - set(description, "Count of HTTP server requests.") where name == "workload.googleapis.com/http.server.request.count"
sophieyfang commented 4 months ago

If you are able to, would you mind creating a cloud support ticket with us?