pinpoint-apm/pinpoint · warning
Inserted customMetricName({}) is not valid. cause:{}
Error message
Inserted customMetricName({}) is not valid. cause:{} What it means
Inside CustomMetricIdGenerator.checkValidCustomMetricName, the character-by-character validation loop throws (e.g. unexpected null or an unexpected runtime error while inspecting chars); the catch block logs "Inserted customMetricName is not valid" with the exception message and returns false. This is the exceptional path of name validation, distinct from a simple character mismatch.
Source
Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/monitor/metric/CustomMetricIdGenerator.java:87
}
private boolean checkValidCustomMetricName(String customMetricName) {
try {
String[] split = customMetricName.split("/", 3);
if (split.length != 3) {
throw new IllegalArgumentException("customMetricName must consist of {GroupName}/{MetricName}/LabelName}");
}
for (String eachName : split) {
if (!IdValidateUtils.validateId(eachName, 64)) {
return false;
}
}
return true;
} catch (Exception e) {
logger.warn("Inserted customMetricName({}) is not valid. cause:{}", customMetricName, e.getMessage(), e);
}
return false;
}
}
View on GitHub (pinned to 744c3d3075)
Solutions
- Ensure the metric name is non-null and a plain String before constructing the counter.
- Add a null/empty check at the call site prior to register().
- Inspect the cause:{} value in the log to see the exact exception (likely NPE) and fix its source.
- Upgrade Pinpoint if the validator crashes on legitimate names.
Example fix
// before
IntCounter counter = buildCounter(); // name may be null
registryService.register(counter);
// after
if (counter.getName() != null && !counter.getName().isEmpty()) {
registryService.register(counter);
} Defensive patterns
Strategy: validation
Validate before calling
if (name == null || name.isEmpty()) {
throw new IllegalArgumentException("custom metric name required");
} Type guard
boolean nonNullName(IntCounter c) { return c != null && c.getName() instanceof String; } Try / catch
try {
registryService.register(counter);
} catch (NullPointerException e) {
logger.warn("counter name was null; metric skipped");
} Prevention
- Never construct counters with null or empty names.
- Validate names at object construction time in your own factory.
- Check the cause:{} field in the log to find the real exception.
When it happens
Trigger: Passing a metric name that makes the validator's loop throw — most commonly a null name dereferenced via length()/charAt(), or an unexpected CharSequence implementation.
Common situations: Programmatically constructed counters where the name field was left null; reflection/framework-built metric objects with unset names; upgrades where the validator logic changed and older names now hit an exception path.
Related errors
- Failed to create MetricId. metricName:{}
- Resource attribute `service.name` is required to save OTLP m
- Failed to register CustomMetric({}). message:not allowed met
- Failed to create metricId. metric:{}
- invalid hostGroupName='<hostGroupName>'
AI-assisted analysis of pinpoint-apm/pinpoint@744c3d3075 (2026-09-07).
Data as JSON: /api/errors/a0f3b84245a18903.
Report an issue: GitHub.