Skip to content

Commit

Permalink
Clarify google managed prometheus troubleshooting guide (#34986)
Browse files Browse the repository at this point in the history
Adding all resource attributers as metric labels can produce more
problems than it solves if, for example, resource attributes are too
long.

Fixes
GoogleCloudPlatform/opentelemetry-operations-go#887

Instead, recommend adding a set of common known identifying attributes.
  • Loading branch information
dashpole authored Sep 4, 2024
1 parent e393e02 commit a0ea89c
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 2 deletions.
12 changes: 10 additions & 2 deletions exporter/googlemanagedprometheusexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -280,13 +280,21 @@ logic from OpenTelemetry resource to Google Cloud's `prometheus_target`
monitored resouce didn't preserve a resource attribute that was needed to
distinguish timeseries. This can be mitigated by adding resource
attributes as metric labels using `resource_filters` configuration in the
exporter:
exporter. The following example adds common identifying resource attributes.
You may need to expand this list with other resource attributes to fix
duplicate timeseries errors:

```yaml
googlemanagedprometheus:
metric:
resource_filters:
regex: ".*"
- prefix: "cloud"
- prefix: "k8s"
- prefix: "faas"
- regex: "container.id"
- regex: "process.pid"
- regex: "host.name"
- regex: "host.id"
```

If you need to troubleshoot errors further, start by filtering down to a single
Expand Down
24 changes: 24 additions & 0 deletions exporter/googlemanagedprometheusexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"testing"
"time"

"github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector"
"github.com/GoogleCloudPlatform/opentelemetry-operations-go/exporter/collector/googlemanagedprometheus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -54,6 +55,29 @@ func TestLoadConfig(t *testing.T) {
},
},
Prefix: "my-metric-domain.com",
ResourceFilters: []collector.ResourceFilter{
{
Prefix: "cloud",
},
{
Prefix: "k8s",
},
{
Prefix: "faas",
},
{
Regex: "container.id",
},
{
Regex: "process.pid",
},
{
Regex: "host.name",
},
{
Regex: "host.id",
},
},
},
},
QueueSettings: exporterhelper.QueueSettings{
Expand Down
8 changes: 8 additions & 0 deletions exporter/googlemanagedprometheusexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ exporters:
extra_metrics_config:
enable_target_info: false
enable_scope_info: false
resource_filters:
- prefix: "cloud"
- prefix: "k8s"
- prefix: "faas"
- regex: "container.id"
- regex: "process.pid"
- regex: "host.name"
- regex: "host.id"


service:
Expand Down

0 comments on commit a0ea89c

Please sign in to comment.