pinpoint-apm/pinpoint · error · RuntimeException

host tag not found

Error message

host tag not found

What it means

TelegrafMetricController.toMetric throws RuntimeException when an incoming Telegraf metric has no 'host' tag among its tags. The host dimension is mandatory for storing/deduplicating metric data in Pinpoint's metric collector, so a metric without it cannot be processed and is rejected.

Solutions

  1. In the telegraf agent config set omit_hostname = false (default) so every metric carries a host tag.
  2. Check telegraf [tags] and any tagdrop/tagexclude rules and re-enable the 'host' tag.
  3. Add host explicitly in telegraf global tags: [tags] host = "my-hostname".
  4. On the collector side, wrap toMetric to skip/log metrics missing the host tag instead of failing the whole batch.

Example fix

// before
# telegraf.conf
[agent]
  omit_hostname = true

// after
# telegraf.conf
[agent]
  omit_hostname = false
Defensive patterns

Strategy: validation

Validate before calling

boolean hasHost = tMetric.getTags().stream()
    .anyMatch(t -> "host".equals(t.getName()));
if (!hasHost) {
    // skip or reject metric before sending to collector
    return;
}

Try / catch

try {
    metrics = controller.toMetric(tMetric);
} catch (RuntimeException e) {
    log.warn("Skipping telegraf metric without host tag: {}", tMetric.getName());
}

Prevention

When it happens

Trigger: POSTing Telegraf line-protocol/JSON metrics to the telegraf ingestion endpoint where the metric's tag set lacks a 'host' tag — typically because the telegraf agent's 'hostname' tag was disabled or stripped by a tag filter in the telegraf config.

Common situations: Telegraf agent configured with omit_hostname = true; a tagpass/tagdrop rule removing 'host'; custom collectors or scripts that post metrics without the host tag; upgraded telegraf configs where the default hostname tag behavior changed.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07). Data as JSON: /api/errors/50b1fcee9196745a. Report an issue: GitHub.

Appendix: source

Thrown at metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/collector/controller/TelegrafMetricController.java:153

        return new Metrics(tenantId, hostGroupName, hostName, metricList);
    }

    @NonNull
    private List<DoubleMetric> toDoubleMetric(List<TelegrafMetric> metrics) {
        List<DoubleMetric> result = new ArrayList<>();
        for (TelegrafMetric metric : metrics) {
            result.addAll(toMetric(metric));
        }
        return result;
    }

    List<DoubleMetric> toMetric(TelegrafMetric tMetric) {
        List<Tag> tTags = tMetric.getTags();

        final Tag hostTag = getHost(tTags);
        if (hostTag == null) {
            throw new RuntimeException("host tag not found");
        }

        List<Tag> tag = filterTag(tTags, ignoreTags);

        final long timestamp = TimeUnit.SECONDS.toMillis(tMetric.getTimestamp());

        List<TelegrafMetric.Field> fields = tMetric.getFields();

        List<DoubleMetric> list = new ArrayList<>(fields.size());
        for (TelegrafMetric.Field field : fields) {
            DoubleMetric doubleMetric = new DoubleMetric(tMetric.getName(), hostTag.getValue(), field.name(), field.value(), tag, timestamp);
            list.add(doubleMetric);
        }
        return list;
    }

    private Tag getHost(List<Tag> tTags) {
        for (Tag tag : tTags) {

View on GitHub (pinned to 744c3d3075)