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

influxdbexporter does not support empty tag values from hostmetrics process scraper #21474

Closed
padraic-padraic opened this issue May 3, 2023 · 8 comments · Fixed by #21526 or #26036
Closed
Assignees

Comments

@padraic-padraic
Copy link

Component(s)

exporter/influxdb, receiver/hostmetrics

What happened?

Description

For v0.75.0 and up, I can no-longer combine the process scraper from the hostmetrics receiver with the influxdb exporter.

Trying to do so results in the following error message when converting from OTLP to InfluxDB Line Protocol, whether I use telegraf-prometheus-v1 or telegraf-prometheus-v2 as the metrics_schema:

otel_contrib | 2023-05-03T11:53:17.416Z error exporterhelper/queued_retry.go:401 Exporting failed. The error is not retryable. Dropping data. {"kind": "exporter", "data_type": "metrics", "name": "influxdb", "error": "Permanent error: failed to convert OTLP metric to line protocol: failed to write point for sum: Permanent error: failed to encode point: encoding point 68: invalid tag value process.command=\"\"", "dropped_items": 1269}

As mentioned in other issues (e.g. #20435), sometimes the process scraper is not able to collect all the attributes of a given process. However, rather than dropping the affected series, the error causes the influxdbexporter to drop all the collected data.

I've attempted a workaround using the filter and attributes procesor, but haven't been able to get something working.

The issue occurs only on v.075.0 and up: the attached config will work for 0.74.0. Could the issue be related to the changes made to pkg/ottl or to the processscraper in the 0.75.0 release?

Steps to Reproduce

Run the otel-collector with the attached config

Expected Result

Metrics are exported to InfluxDB

Actual Result

Data is dropped as some metrics cannot be converted to InfluxDB line protocol.

Collector version

0.75.0

Environment information

Environment

Tested with:

  • OS: Ubuntu 18.04.6 LTS
    Arch: amd64
    Version: 0.74.0 and 0.76.1 (DEB)
  • Docker: Tags 0.74.0, 0.75.0 and 0.76.1
    Arch: amd64

OpenTelemetry Collector configuration

receivers:
  hostmetrics:
    scrapers:
      cpu:
      memory:
      filesystem:
      paging:
      process:
        metrics:
          process.cpu.time:
            enabled: false
          process.memory.utilization:
            enabled: true


processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 10
    spike_limit_percentage: 7
  batch:
    timeout: 10s

exporters:
  influxdb:
    endpoint: https:/localhost:8086
    bucket: "example_bucket"
    token: "writer:writer_password"
    org: "dummy_val"

service:
  pipelines:
    metrics:
      receivers: [hostmetrics]
      processors: [memory_limiter, batch]
      exporters: [influxdb]

Log output

No response

Additional context

No response

@padraic-padraic padraic-padraic added bug Something isn't working needs triage New item requiring triage labels May 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@wise0wl
Copy link

wise0wl commented May 3, 2023

This is a major problem and essentially makes the InfluxDB exporter unusable.

@jacobmarble
Copy link
Contributor

Thanks for the example config, that should help me reproduce the issue.

@jacobmarble
Copy link
Contributor

Please assign this issue to me.

@atoulme atoulme removed the needs triage New item requiring triage label May 3, 2023
@atoulme
Copy link
Contributor

atoulme commented May 3, 2023

Done, it's yours!

@jacobmarble
Copy link
Contributor

Since otelcol-contrib v0.75.0, the hostmetrics receiver is emitting metrics with empty string attribute values, such as device = string(""). I've confirmed that this behavior started in v0.75.0.

The InfluxDB line protocol encoder has rejected empty tag values for at least three years.

Nevertheless, the InfluxDB exporter can do better by silently dropping these attributes (which is semantically equivalent in InfluxDB). I'll prepare a PR.

@atoulme
Copy link
Contributor

atoulme commented May 5, 2023

Would you mind opening a bug for the hostmetricsreceiver to look after empty attribute values?

@padraic-padraic
Copy link
Author

Thank you very much all for the quick response!

jacobmarble added a commit to jacobmarble/opentelemetry-collector-contrib that referenced this issue Aug 30, 2023
Closes open-telemetry#22850

InfluxDB does not allow empty tag values in line protocol. This change
adds a second test to confirm that the InfluxDB exporter does not emit
empty tag values.

See open-telemetry#21526 for the original fix to handling empty attribute values. This
PR exists because I forgot I had fixed open-telemetry#21474, then tried to fix open-telemetry#22850
and now realize that open-telemetry#22850 and open-telemetry#21474 are dupes. Live and learn.
codeboten pushed a commit that referenced this issue Sep 15, 2023
**Description:** <Describe what has changed.>

InfluxDB does not allow empty tag values in line protocol. This change
adds a second test to confirm that the InfluxDB exporter does not emit
empty tag values.
    
See #21526 for the original fix to handling empty attribute values. This
PR exists because I forgot I had fixed #21474, then tried to fix #22850
and now realize that #22850 and #21474 are dupes. Live and learn.

**Link to tracking Issue:**

Closes #22850

**Testing:**

**Documentation:**
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment