pinpoint-apm/pinpoint · warning

Failed to register CustomMetric({}). message:not allowed met

Error message

Failed to register CustomMetric({}). message:not allowed metric

What it means

DefaultCustomMetricRegistryService.register(IntCounter) first runs the configured metric-name filter; if the filter rejects the counter, it logs "Failed to register CustomMetric ... not allowed metric" and returns false. The profiler's allow/deny list for custom metric names blocked registration — the metric will not be sent to the collector.

Source

Thrown at agent-module/profiler/src/main/java/com/navercorp/pinpoint/profiler/context/monitor/metric/DefaultCustomMetricRegistryService.java:61

    private final CustomMetricIdGenerator customMetricIdGenerator;
    private final CustomMetricRegistryFilter filter;

    public DefaultCustomMetricRegistryService(int limitIdNumber) {
        this(limitIdNumber, new DefaultCustomMetricRegistryFilter());
    }

    public DefaultCustomMetricRegistryService(int limitIdNumber, CustomMetricRegistryFilter filter) {
        this.customMetricIdGenerator = new CustomMetricIdGenerator(limitIdNumber);
        this.filter = Objects.requireNonNull(filter, "filter");
    }

    @Override
    public boolean register(IntCounter intCounter) {
        Objects.requireNonNull(intCounter, "intCount");

        boolean filter = this.filter.filter(intCounter);
        if (filter) {
            LOGGER.warn("Failed to register CustomMetric({}). message:not allowed metric", intCounter);
            return false;
        }

        int id = customMetricIdGenerator.create(intCounter.getName());
        if (id == CustomMetricIdGenerator.NOT_REGISTERED) {
            LOGGER.warn("Failed to create metricId. metric:{}", intCounter);
            return false;
        }

        IntCounterWrapper customMetricWrapper = customMetricWrapperFactory.create(id, intCounter);
        return add(customMetricWrapper);
    }

    @Override
    public boolean register(LongCounter longCounter) {
        Objects.requireNonNull(longCounter, "longCount");

        boolean filter = this.filter.filter(longCounter);

View on GitHub (pinned to 744c3d3075)

Solutions

  1. Add the metric name pattern to the profiler's custom metric allow configuration (or remove it from the deny list) and restart the agent.
  2. Align the counter name in code with an already-allowed pattern.
  3. Check register()'s boolean return and log rejected metrics in your application.
  4. Review DefaultCustomMetricRegistryService's filter implementation to see the exact matching rules.

Example fix

// before: name not whitelisted
registryService.register(new IntCounterCounterAdapter("internal.debug.counter"));
// after: use an allowed name or extend the allow list in profiler config
registryService.register(new IntCounterCounterAdapter("allowed.metric.prefix"));
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the name matches your configured allow-list before registering
boolean allowed = yourAllowListPatterns.stream().anyMatch(p -> p.matcher(name).matches());

Try / catch

if (!registryService.register(counter)) {
    logger.warn("custom metric {} was rejected by profiler filter", counter.getName());
}

Prevention

When it happens

Trigger: Registering an IntCounter whose name matches the deny pattern or is absent from the allow pattern configured for custom metrics (profiler.custommetric filter settings); also triggered when the filter's default policy disallows unlisted names.

Common situations: Deploying an app with custom metrics whose names were not added to the profiler's custom-metric allow configuration; copying metric names across services where only some are whitelisted; typos between configured patterns and code.

Related errors


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