Skip to content

Getting Parse errors in case if docker discovery doesn't finds any suitable containers #377

Open
@tkant

Description

Un-necessary data is getting published to New Relic

Description

Getting Parse errors in case if docker discovery doesn't finds any suitable containers

As per this doc: https://docs.newrelic.com/docs/infrastructure/host-integrations/installation/container-auto-discovery-host-integrations/ An integration will be executed as many times as it finds discovery elements. If discovery doesn't find any containers, the integration won't be executed.
But we are seeing error like following on EC2s which doesn't matches even a single container with the image regex we are using:

time="2022-08-24T12:59:51Z" level=debug msg="Integration stderr (not parsed)." component=integrations.runner.Runner integration_name=nri-flex line="time=\"2022-08-24T12:59:51Z\" level=debug msg=\"http: error\" err=\"parse \\\"http://${discovery.ip}:${discovery.port}/api/7/http/requests\\\": invalid port \\\":${discovery.port}\\\" after host\"" runner_uid=d933e8cf21

Following is the snippet of configuration we are using:

---
discovery:
  docker:
    match:
      image: /cbr/
      label.metrics_scrapable: yes
integrations:
  # Following deals with /api Nginx+ endpoints
  - name: nri-flex
    config:
      name: nginxFlex
      global:
        base_url: http://${discovery.ip}:${discovery.port}/api/7

Wondering how can we say no to parse anything if there's zero matches found by discovery?

Expected Behavior

If discovery doesn't find any containers, the integration won't be executed and should ignore the ${discovery.*} placeholders

Failure Logs which are transmitted as events to New Relic

time="2022-08-24T12:59:51Z" level=debug msg="Integration stderr (not parsed)." component=integrations.runner.Runner integration_name=nri-flex line="time=\"2022-08-24T12:59:51Z\" level=debug msg=\"http: error\" err=\"parse \\\"http://${discovery.ip}:${discovery.port}/api/7/http/requests\\\": invalid port \\\":${discovery.port}\\\" after host\"" runner_uid=d933e8cf21

Steps to Reproduce

Use docker discovery in conjunction with placeholder usage, ex: ${discovery.ip}

Example:

---
discovery:
  docker:
    match:
      image: /cbr/
      label.metrics_scrapable: yes
integrations:
  # Following deals with /api Nginx+ endpoints
  - name: nri-flex
    config:
      name: nginxFlex
      global:
        base_url: http://${discovery.ip}:${discovery.port}/api/7

Your Environment

We are using nr-flex for collecting NGINX metrics, where flex is running on EC2 machines having docker containers running on top.

Metadata

Assignees

No one assigned

    Labels

    triage/pendingIssue or PR is pending for triage and prioritization.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions