Apm-сервер и флеш-приложение - PullRequest
0 голосов
/ 09 октября 2019

У меня проблема с apm-сервером, который работает в контейнере, мое приложение фляги используетastic-apm == 5.0.0, и оно также работает в контейнере, эта ошибка иногда возникает, и у меня есть 10 флягприложения, которые указывают на этот сервер, я хотел бы знать, как решить эту проблему.

Заранее спасибо

Traceback (most recent call last):
  File "C:\Users\diogo.silva\Documents\titans-partes-api\venv\lib\site- 
packages\elasticapm\transport\base.py", line 208, in _flush
    self.send(data)
File "C:\Users\diogo.silva\Documents\titans-partes-api\venv\lib\site- 
packages\elasticapm\transport\http.py", line 91, in send
   raise TransportException(message, data, print_trace=print_trace)
elasticapm.transport.base.TransportException: Unable to reach APM Server: ('Connection aborted.', 
RemoteDisconnected('Remote end closed connection without response')) (url:x.x.x.x)

apm-server.yaml

################### APM Server Configuration #########################

############################# APM Server ######################################

apm-server:
   # Defines the host and port the server is listening on.  use "unix:/path/to.sock" to listen on a 
unix domain socket.
   host: "0.0.0.0:8200"

# Maximum permitted size in bytes of a request's header accepted by the server to be processed.
max_header_size: 1048576

#-- v1 Intake API (deprecated)

# Maximum allowed size in bytes of a single event
max_event_size: 104857600

# Maximum number of new connections to accept simultaneously (0 means unlimited)
max_connections: 0

#rum:
# To enable real user monitoring (RUM) support set this to true.
#enabled: false

#-- v1 RUM endpoint (deprecated)

# Rate limit per second and IP address for requests sent to the RUM endpoint.
#rate_limit: 10

#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# Array of hosts to connect to.
# Scheme and port can be left out and will be set to the default (http and 9200)
# In case you specify and additional path, the scheme is required: http://localhost:9200/path
# IPv6 addresses should always be defined as: https://[2001:db8::1]:9200
hosts: ["vpc-logserver-xxxxxxxxxxxxxxxxxxxxx.amazonaws.com:443"] 
indices:
  - index: "apm-%{[beat.version]}-sourcemap"
    when.contains:
      processor.event: "sourcemap"

  - index: "apm-%{[beat.version]}-error-%{+yyyy.MM.dd}"
    when.contains:
      processor.event: "error"

  - index: "apm-%{[beat.version]}-transaction-%{+yyyy.MM.dd}"
    when.contains:
      processor.event: "transaction"

  - index: "apm-%{[beat.version]}-span-%{+yyyy.MM.dd}"
    when.contains:
      processor.event: "span"

  - index: "apm-%{[beat.version]}-metric-%{+yyyy.MM.dd}"
    when.contains:
      processor.event: "metric"

  - index: "apm-%{[beat.version]}-onboarding-%{+yyyy.MM.dd}"
    when.contains:
      processor.event: "onboarding"

Dockerfile

FROM docker.elastic.co/apm/apm-server:6.5.4
COPY apm-server.yml /usr/share/apm-server/apm-server.yml
USER root
RUN chown apm-server /usr/share/apm-server/apm-server.yml
RUN chmod go-w /usr/share/apm-server/apm-server.yml
USER apm-server

колба с аппликацией

import os
import connexion
from elasticapm.contrib.flask import ElasticAPM
from swagger_server import encoder

apm  = ElasticAPM()
APM_SERVER = os.getenv('APM_SERVER')

def main():
    app = connexion.App(__name__, specification_dir='./swagger/')
    app.app.json_encoder = encoder.JSONEncoder
    app.add_api('swagger.yaml', arguments={'title': 'Teste'})
    apm.init_app(app.app, service_name="teste-api", server_url=APM_SERVER)
    app.run(port=8080)


if __name__ == '__main__':
     main()
...