{"record":{"id":"e2946933339b9d85","repo":"apache/druid","slug":"metric-s-not-whitelisted","errorCode":null,"errorMessage":"Metric [%s] not whitelisted.","messagePattern":"Metric \\[(.+?)\\] not whitelisted\\.","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"extensions-contrib/influx-extensions/src/main/java/org/apache/druid/data/input/influx/InfluxLineProtocolReader.java","lineNumber":114,"sourceCode":"    InfluxLineProtocolLexer lexer = new InfluxLineProtocolLexer(charStream);\n    TokenStream tokenStream = new CommonTokenStream(lexer);\n    InfluxLineProtocolParser parser = new InfluxLineProtocolParser(tokenStream);\n\n    List<InfluxLineProtocolParser.LineContext> lines = parser.lines().line();\n    if (parser.getNumberOfSyntaxErrors() != 0) {\n      throw new ParseException(input, \"Unable to parse line.\");\n    }\n    if (lines.size() != 1) {\n      throw new ParseException(input, \"Multiple lines present; unable to parse more than one per record.\");\n    }\n\n    Map<String, Object> out = new LinkedHashMap<>();\n\n    InfluxLineProtocolParser.LineContext line = lines.get(0);\n    String measurement = parseIdentifier(line.identifier());\n\n    if (!checkWhitelist(measurement)) {\n      throw new ParseException(input, \"Metric [%s] not whitelisted.\", measurement);\n    }\n\n    out.put(MEASUREMENT_KEY, measurement);\n    if (line.tag_set() != null) {\n      line.tag_set().tag_pair().forEach(t -> parseTag(t, out));\n    }\n\n    line.field_set().field_pair().forEach(t -> parseField(t, out));\n\n    if (line.timestamp() != null) {\n      String timestamp = line.timestamp().getText();\n      parseTimestamp(timestamp, out);\n    }\n    return out;\n  }\n\n  private static void parseTag(InfluxLineProtocolParser.Tag_pairContext tag, Map<String, Object> out)\n  {","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/extensions-contrib/influx-extensions/src/main/java/org/apache/druid/data/input/influx/InfluxLineProtocolReader.java#L96-L132","documentation":"After successfully parsing a line-protocol point, parseLineToMap checks the measurement name against a configured whitelist (checkWhitelist). If the metric (measurement) is not on the whitelist, it throws ParseException(\"Metric [%s] not whitelisted.\", measurement). The extension deliberately restricts ingestion to an approved set of measurements.","triggerScenarios":"Ingesting a record whose measurement name is not present in the whitelist configured for the InfluxLineProtocolReader (e.g. a whitelist containing only \"cpu\" while the data contains \"mem\" points).","commonSituations":"New metrics added by the producer but not added to the reader's whitelist config; case or spelling mismatch between the measurement in the data and the whitelist entry; reusing a reader config from another pipeline with a narrower whitelist.","solutions":["Add the offending measurement name to the reader's whitelist configuration and restart/redeploy the ingestion spec.","Verify exact spelling/case of the measurement in the data versus the whitelist entries.","If broad ingestion is intended, widen the whitelist (or its wildcard settings) to cover the new metrics.","Filter out non-whitelisted measurements upstream if they are not supposed to be ingested."],"exampleFix":"// before\n\"whitelist\": [\"cpu\"]\n// after\n\"whitelist\": [\"cpu\", \"mem\", \"disk\"]","handlingStrategy":"validation","validationCode":"// Check the measurement against the whitelist before ingesting\nString measurement = input.substring(0, input.indexOf(',')).split(\" \")[0];\nif (!whitelist.contains(measurement)) {\n  throw new IllegalArgumentException(\"metric not whitelisted: \" + measurement);\n}","typeGuard":null,"tryCatchPattern":"try {\n  return parseLineToMap(input);\n} catch (org.apache.druid.java.util.common.parsers.ParseException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"not whitelisted\")) {\n    log.warn(\"Skipping non-whitelisted metric in record: {}\", input);\n    return null;\n  }\n  throw e;\n}","preventionTips":["Keep the reader whitelist in sync with the producer's measurement inventory.","Match measurement names exactly (case-sensitive) in config.","Re-audit the whitelist whenever new metrics are added upstream.","Log rejected measurements to drive whitelist updates instead of silently dropping them."],"tags":["influx","whitelist","configuration","parsing"],"backgroundTag":"invalid-config-value","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}