{"record":{"id":"50b1fcee9196745a","repo":"pinpoint-apm/pinpoint","slug":"host-tag-not-found","errorCode":null,"errorMessage":"host tag not found","messagePattern":"host tag not found","errorType":"exception","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/collector/controller/TelegrafMetricController.java","lineNumber":153,"sourceCode":"\n        return new Metrics(tenantId, hostGroupName, hostName, metricList);\n    }\n\n    @NonNull\n    private List<DoubleMetric> toDoubleMetric(List<TelegrafMetric> metrics) {\n        List<DoubleMetric> result = new ArrayList<>();\n        for (TelegrafMetric metric : metrics) {\n            result.addAll(toMetric(metric));\n        }\n        return result;\n    }\n\n    List<DoubleMetric> toMetric(TelegrafMetric tMetric) {\n        List<Tag> tTags = tMetric.getTags();\n\n        final Tag hostTag = getHost(tTags);\n        if (hostTag == null) {\n            throw new RuntimeException(\"host tag not found\");\n        }\n\n        List<Tag> tag = filterTag(tTags, ignoreTags);\n\n        final long timestamp = TimeUnit.SECONDS.toMillis(tMetric.getTimestamp());\n\n        List<TelegrafMetric.Field> fields = tMetric.getFields();\n\n        List<DoubleMetric> list = new ArrayList<>(fields.size());\n        for (TelegrafMetric.Field field : fields) {\n            DoubleMetric doubleMetric = new DoubleMetric(tMetric.getName(), hostTag.getValue(), field.name(), field.value(), tag, timestamp);\n            list.add(doubleMetric);\n        }\n        return list;\n    }\n\n    private Tag getHost(List<Tag> tTags) {\n        for (Tag tag : tTags) {","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/metric-module/metric/src/main/java/com/navercorp/pinpoint/metric/collector/controller/TelegrafMetricController.java#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["In the telegraf agent config set omit_hostname = false (default) so every metric carries a host tag.","Check telegraf [tags] and any tagdrop/tagexclude rules and re-enable the 'host' tag.","Add host explicitly in telegraf global tags: [tags] host = \"my-hostname\".","On the collector side, wrap toMetric to skip/log metrics missing the host tag instead of failing the whole batch."],"exampleFix":"// before\n# telegraf.conf\n[agent]\n  omit_hostname = true\n\n// after\n# telegraf.conf\n[agent]\n  omit_hostname = false","handlingStrategy":"validation","validationCode":"boolean hasHost = tMetric.getTags().stream()\n    .anyMatch(t -> \"host\".equals(t.getName()));\nif (!hasHost) {\n    // skip or reject metric before sending to collector\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    metrics = controller.toMetric(tMetric);\n} catch (RuntimeException e) {\n    log.warn(\"Skipping telegraf metric without host tag: {}\", tMetric.getName());\n}","preventionTips":["Keep telegraf's omit_hostname = false default.","Audit telegraf tagdrop/tagexclude rules after config changes.","Pin the 'host' tag explicitly in telegraf's [tags] section.","Add an ingestion-side integration test for tag-less metrics."],"tags":["telegraf","metrics","missing-tag","ingestion"],"backgroundTag":"missing-required-argument","analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}