pinpoint-apm/pinpoint · warning

hostName is empty

Error message

hostName is empty

What it means

TelegrafMetricController.saveSystemMetric rejects a telegraf metrics batch when no hostname can be extracted from any of the collected TelegrafMetric entries. Each metric carries a hostGroupName and a set of tags; the controller derives hostName from the first metric's tags, and if every entry lacks it the batch is unusable because Pinpoint's system-metric storage is keyed by (hostGroupName, hostName). It returns HTTP 400 with the body 'hostName is empty' rather than throwing.

Source

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

            @RequestHeader(value = "hostGroupName") String hostGroupName,
            @RequestBody TelegrafMetrics telegrafMetrics, BindingResult bindingResult
    ) throws BindException {
        if (bindingResult.hasErrors()) {
            SimpleErrorMessage simpleErrorMessage = new SimpleErrorMessage(bindingResult);
            logger.warn("metric binding error. header=hostGroupName:{} errorCount:{} {}", hostGroupName, bindingResult.getErrorCount(), simpleErrorMessage);
            throw new BindException(bindingResult);
        }

        if (!isValidGroupName(hostGroupName)) {
            logger.warn("invalid hostGroupName='{}'", hostGroupName);
            return ResponseEntity.badRequest().body("invalid hostGroupName='" + hostGroupName + "'");
        }

        String hostName = getHost(telegrafMetrics);
        if (StringUtils.isEmpty(hostName)) {
            // hostname null check
            logger.info("hostName is empty. hostGroupName={}", hostGroupName);
            return ResponseEntity.badRequest().body("hostName is empty");
        }

        if (!isValidHostName(hostName)) {
            logger.warn("invalid hostName='{}', hostGroupName='{}'", hostName, hostGroupName);
        }

        if (logger.isDebugEnabled()) {
            logger.debug("hostGroupName:{} host:{} size:{}", hostGroupName, hostName, telegrafMetrics.size());
        }

        String tenantId = tenantProvider.getTenantId();

        Metrics systemMetric = toMetrics(tenantId, hostGroupName, hostName, telegrafMetrics);

        updateMetadata(systemMetric);
        systemMetricService.insert(systemMetric);

        return ResponseEntity.ok(null);

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Ensure the Telegraf agent sets the hostname tag (verify '[agent] hostname = "..."' and omit_hostname = false in telegraf.conf).
  2. Check the pinot-kafka/metric pipeline or any relays for tag-stripping filters and re-add 'hostname'.
  3. If posting manually, include a non-empty hostname tag on every metric entry.
  4. Log the full request payload when this 400 occurs to confirm which tag key the collector expects and match it exactly (case-sensitive).

Example fix

// before (telegraf.conf)
[agent]
  omit_hostname = true

// after
[agent]
  hostname = "app-server-01"
  omit_hostname = false
Defensive patterns

Strategy: validation

Validate before calling

// client-side, before POSTing to the collector
boolean hasHost = metrics.stream()
    .allMatch(m -> m.getTags() != null && StringUtils.isNotBlank(m.getTags().get("hostname")));
if (!hasHost || metrics.isEmpty()) {
    throw new IllegalArgumentException("telegraf batch must include a non-empty hostname tag");
}

Prevention

When it happens

Trigger: POSTing telegraf metrics to the system-metric collect endpoint where getHost(telegrafMetrics) returns null/empty — i.e., the batch is empty, or none of the metrics' tag maps contain the hostname tag (typically 'hostname' as sent by Telegraf's output).

Common situations: Telegraf agent configured without the default 'host' tag, a custom tag_filter stripping the hostname tag, or a proxy/relay re-serializing the payload and dropping tags; also misconfigured clients posting hand-built JSON without per-metric tags.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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