将 APIMAN 连接到外部 ElasticSearch 数据库以获取指标

connecting APIMAN to an external ElasticSearch database for metrics

我正在尝试使用 Docker-compose 将 APIMAN 连接到外部 Elastic Search 数据库。我遇到了一些问题(请参阅下面的日志输出)。以下是配置:

-apiman.properties

apiman.es.protocol=http
apiman.es.host=MY_MACHINE_HOST
apiman.es.port=9200
apiman.es.username=elasticsearch
apiman.es.password=
apiman.es.timeout=10000

apiman-manager.metrics.type=es
apiman-manager.metrics.es.client-factory=
apiman-manager.metrics.es.protocol=${apiman.es.protocol}
apiman-manager.metrics.es.host=${apiman.es.host}
apiman-manager.metrics.es.port=${apiman.es.port}
apiman-manager.metrics.es.username=${apiman.es.username}
apiman-manager.metrics.es.password=${apiman.es.password}
apiman-manager.metrics.es.timeout=${apiman.es.timeout}

ETC...

-和日志

 ERROR [io.undertow.request] (default task-28) UT005023: Exception handling request to /apiman/organizations/test/apis/test/versions/1.0/metrics/planUsage: org.jboss.resteasy.spi.UnhandledException: java.lang.RuntimeException: java.lang.IllegalArgumentException: name is empty
    at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)
    at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)
    at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)
    at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)
ETC...

Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: name is empty
    at io.apiman.manager.api.war.WarCdiFactory.provideMetricsESClientFactory(WarCdiFactory.java:255)
    at sun.reflect.GeneratedMethodAccessor50.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:88)
    at org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(StaticMethodInjectionPoint.java:78)
    at org.jboss.weld.injection.producer.ProducerMethodProducer.produce(ProducerMethodProducer.java:99)
    at org.jboss.weld.injection.producer.AbstractMemberProducer.produce(AbstractMemberProducer.java:161)
ETC...

Caused by: java.lang.IllegalArgumentException: name is empty
    at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:344)
    at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)

这里是 docker-compose 配置:

apiman:
  build: ./docker/apiman/
  links:
    - elastic:elastic
  ports:
    - "8060:8080"
    - "8443:8443"
elastic:
  image: elasticsearch
  ports:
    - "9200:9200"

我做错了什么吗? 任何帮助将不胜感激。

尝试将 apiman-manager.metrics.es.client-factory= 注释掉,否则您试图用空字符串(或其他不存在的东西)覆盖默认值。