Elastic Apm python 代理连接问题
Elastic Apm python agent connection problem
我有一个非常基本的 Django APM 代理设置:
ELASTIC_APM = {
# Set required service name. Allowed characters:
# a-z, A-Z, 0-9, -, _, and space
'SERVICE_NAME': 'bourse',
# Set custom APM Server URL (default: http://localhost:8200)
'SERVER_URL': '127.0.0.1:8200',
'LOG_LEVEL': "debug",
'LOG_FILE': "/home/hamed/Desktop/log.txt",}
我的 APM 服务器已启动并且 运行 在 localhost:8200。但我的 APM 代理似乎无法连接到 APM 服务器。这是我认为导致问题的日志文件的一部分:
Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found
HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe2625ed610>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
这是我的 APM 日志:
Inserting elasticapm log_record_factory into logging
Location of cgroup files failed, skipping cgroup metrics
Detected PID change from None to 13595, starting threads
Starting transport thread
Starting metrics thread
Starting metrics collect timer
Starting config thread
Instrumented jinja2, jinja2.Template.render
Skipping instrumentation of pymssql. Module pymssql not found
Instrumented psycopg2, psycopg2.extensions.register_type, psycopg2._json.register_json, psycopg2.extensions.quote_ident, psycopg2.extensions.encrypt_password
Skipping instrumentation of aiohttp_client. Module aiohttp.client not found
Instrumented psycopg2, psycopg2.connect
requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen already instrumented, skipping
Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found
Instrumented urllib3, urllib3.connectionpool.HTTPConnectionPool.urlopen
Skipping instrumentation of mysql_connector. Module mysql.connector not found
Skipping instrumentation of httpx. Module httpx not found
Skipping instrumentation of aiopg. Module aiopg.cursor not found
Instrumented tornado_handle_request_exception, tornado.web.RequestHandler._handle_request_exception
Instrumented tornado_render, tornado.web.RequestHandler.render
Instrumented redis, redis.connection.Connection.send_packed_command
Instrumented redis, redis.client.Pipeline.execute
Skipping instrumentation of python_memcached. Module memcache not found
Skipping instrumentation of pylibmc. Module pylibmc not found
Skipping instrumentation of graphql. Module graphql.backend.core not found
Skipping instrumentation of graphql. Module graphql.backend.cache not found
Skipping instrumentation of httpcore. Module httpcore._async.connection not found
Skipping instrumentation of pymongo. Module pymongo.bulk not found
Instrumented django_template_source, django.template.base.Parser.extend_nodelist
Instrumented urllib, urllib.request.AbstractHTTPHandler.do_open
Skipping instrumentation of pymongo. Module pymongo.collection not found
Skipping instrumentation of pymongo. Module pymongo.cursor not found
Skipping instrumentation of pyodbc. Module pyodbc not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch_async.connection not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch._async.http_aiohttp not found
Skipping instrumentation of httpcore. Module httpcore._sync.connection not found
Instrumented tornado_request_execute, tornado.web.RequestHandler._execute
Skipping instrumentation of httpx. Module httpx not found
Instrumented django_template, django.template.Template.render
Skipping instrumentation of asyncpg. Module asyncpg.connection not found
Skipping instrumentation of sqlite. Module pysqlite2.dbapi2 not found
Instrumented sqlite, sqlite3.connect, sqlite3.dbapi2.connect
Skipping instrumentation of pymysql. Module pymysql not found
Skipping instrumentation of cassandra. Module cassandra.cluster not found
Instrumented elasticsearch_connection, elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request, elasticsearch.connection.http_requests.RequestsHttpConnection.perform_request
Instrumented redis, redis.client.Redis.execute_command
Instrumented asyncio_sleep, asyncio.tasks.sleep
Skipping instrumentation of mysql. Module MySQLdb not found
Instrumented requests, requests.sessions.Session.send
Skipping instrumentation of graphql. Module graphql.execution.executors.sync not found
Skipping instrumentation of graphql. Module graphql.execution.executors.gevent not found
Skipping instrumentation of graphql. Module graphql.execution.executors.asyncio not found
Skipping instrumentation of graphql. Module graphql.execution.executors.process not found
Skipping instrumentation of graphql. Module graphql.execution.executors.thread not found
Skipping instrumentation of pymemcache. Module pymemcache.client.base not found
Skipping instrumentation of pymemcache. Module pymemcache.client.hash not found
Skipping instrumentation of botocore. Module botocore.client not found
Inserting elasticapm log_record_factory into logging
Location of cgroup files failed, skipping cgroup metrics
Detected PID change from None to 13607, starting threads
Starting transport thread
Starting metrics thread
Starting metrics collect timer
Starting config thread
Instrumented elasticsearch_connection, elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request, elasticsearch.connection.http_requests.RequestsHttpConnection.perform_request
Instrumented django_template, django.template.Template.render
Skipping instrumentation of pylibmc. Module pylibmc not found
Instrumented django_template_source, django.template.base.Parser.extend_nodelist
Instrumented redis, redis.connection.Connection.send_packed_command
Skipping instrumentation of graphql. Module graphql.backend.core not found
Skipping instrumentation of graphql. Module graphql.backend.cache not found
Instrumented asyncio_sleep, asyncio.tasks.sleep
Skipping instrumentation of pymongo. Module pymongo.cursor not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch_async.connection not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch._async.http_aiohttp not found
Instrumented redis, redis.client.Redis.execute_command
Skipping instrumentation of mysql_connector. Module mysql.connector not found
Skipping instrumentation of sqlite. Module pysqlite2.dbapi2 not found
Instrumented sqlite, sqlite3.connect, sqlite3.dbapi2.connect
Instrumented requests, requests.sessions.Session.send
Skipping instrumentation of aiohttp_client. Module aiohttp.client not found
Skipping instrumentation of pymemcache. Module pymemcache.client.base not found
Skipping instrumentation of pymemcache. Module pymemcache.client.hash not found
Instrumented tornado_handle_request_exception, tornado.web.RequestHandler._handle_request_exception
requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen already instrumented, skipping
Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found
Instrumented urllib3, urllib3.connectionpool.HTTPConnectionPool.urlopen
Skipping instrumentation of pymssql. Module pymssql not found
Skipping instrumentation of pymysql. Module pymysql not found
Skipping instrumentation of pymongo. Module pymongo.collection not found
Skipping instrumentation of httpcore. Module httpcore._sync.connection not found
Instrumented psycopg2, psycopg2.connect
Instrumented urllib, urllib.request.AbstractHTTPHandler.do_open
Skipping instrumentation of aiopg. Module aiopg.cursor not found
Skipping instrumentation of httpx. Module httpx not found
Skipping instrumentation of botocore. Module botocore.client not found
Skipping instrumentation of pymongo. Module pymongo.bulk not found
Skipping instrumentation of cassandra. Module cassandra.cluster not found
Instrumented tornado_render, tornado.web.RequestHandler.render
Skipping instrumentation of graphql. Module graphql.execution.executors.sync not found
Skipping instrumentation of graphql. Module graphql.execution.executors.gevent not found
Skipping instrumentation of graphql. Module graphql.execution.executors.asyncio not found
Skipping instrumentation of graphql. Module graphql.execution.executors.process not found
Skipping instrumentation of graphql. Module graphql.execution.executors.thread not found
Instrumented psycopg2, psycopg2.extensions.register_type, psycopg2._json.register_json, psycopg2.extensions.quote_ident, psycopg2.extensions.encrypt_password
Skipping instrumentation of httpx. Module httpx not found
Skipping instrumentation of asyncpg. Module asyncpg.connection not found
Instrumented tornado_request_execute, tornado.web.RequestHandler._execute
Skipping instrumentation of httpcore. Module httpcore._async.connection not found
Instrumented jinja2, jinja2.Template.render
Skipping instrumentation of pyodbc. Module pyodbc not found
Skipping instrumentation of mysql. Module MySQLdb not found
Instrumented redis, redis.client.Pipeline.execute
Skipping instrumentation of python_memcached. Module memcache not found
Checking for new config...
HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe2625ed610>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Remote config unchanged
Checking for new config...
HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f44c17c2a30>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Remote config unchanged
flushing due to time since last flush 9.503s > max_flush_time 9.503s
flushing due to time since last flush 10.827s > max_flush_time 10.827s
flushing due to time since last flush 9.971s > max_flush_time 9.971s
flushing due to time since last flush 9.114s > max_flush_time 9.114s
flushing due to time since last flush 9.763s > max_flush_time 9.763s
Collecting metrics
Collecting metrics
flushing due to time since last flush 10.874s > max_flush_time 10.874s
Failed to submit message: 'Connection to APM Server timed out (url: intake/v2/events, timeout: 5 seconds)'
flushing due to time since last flush 10.796s > max_flush_time 10.796s
Failed to submit message: 'Connection to APM Server timed out (url: intake/v2/events, timeout: 5 seconds)'
Cancelling collect timer
Cancelling collect timer
在我的 APM 服务器上,我没有收到来自代理的任何请求。我检查了 APM 服务器日志文件。
注释掉 'SERVER_URL': '127.0.0.1:8200'
解决了问题。
我有一个非常基本的 Django APM 代理设置:
ELASTIC_APM = {
# Set required service name. Allowed characters:
# a-z, A-Z, 0-9, -, _, and space
'SERVICE_NAME': 'bourse',
# Set custom APM Server URL (default: http://localhost:8200)
'SERVER_URL': '127.0.0.1:8200',
'LOG_LEVEL': "debug",
'LOG_FILE': "/home/hamed/Desktop/log.txt",}
我的 APM 服务器已启动并且 运行 在 localhost:8200。但我的 APM 代理似乎无法连接到 APM 服务器。这是我认为导致问题的日志文件的一部分:
Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found
HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe2625ed610>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
这是我的 APM 日志:
Inserting elasticapm log_record_factory into logging
Location of cgroup files failed, skipping cgroup metrics
Detected PID change from None to 13595, starting threads
Starting transport thread
Starting metrics thread
Starting metrics collect timer
Starting config thread
Instrumented jinja2, jinja2.Template.render
Skipping instrumentation of pymssql. Module pymssql not found
Instrumented psycopg2, psycopg2.extensions.register_type, psycopg2._json.register_json, psycopg2.extensions.quote_ident, psycopg2.extensions.encrypt_password
Skipping instrumentation of aiohttp_client. Module aiohttp.client not found
Instrumented psycopg2, psycopg2.connect
requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen already instrumented, skipping
Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found
Instrumented urllib3, urllib3.connectionpool.HTTPConnectionPool.urlopen
Skipping instrumentation of mysql_connector. Module mysql.connector not found
Skipping instrumentation of httpx. Module httpx not found
Skipping instrumentation of aiopg. Module aiopg.cursor not found
Instrumented tornado_handle_request_exception, tornado.web.RequestHandler._handle_request_exception
Instrumented tornado_render, tornado.web.RequestHandler.render
Instrumented redis, redis.connection.Connection.send_packed_command
Instrumented redis, redis.client.Pipeline.execute
Skipping instrumentation of python_memcached. Module memcache not found
Skipping instrumentation of pylibmc. Module pylibmc not found
Skipping instrumentation of graphql. Module graphql.backend.core not found
Skipping instrumentation of graphql. Module graphql.backend.cache not found
Skipping instrumentation of httpcore. Module httpcore._async.connection not found
Skipping instrumentation of pymongo. Module pymongo.bulk not found
Instrumented django_template_source, django.template.base.Parser.extend_nodelist
Instrumented urllib, urllib.request.AbstractHTTPHandler.do_open
Skipping instrumentation of pymongo. Module pymongo.collection not found
Skipping instrumentation of pymongo. Module pymongo.cursor not found
Skipping instrumentation of pyodbc. Module pyodbc not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch_async.connection not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch._async.http_aiohttp not found
Skipping instrumentation of httpcore. Module httpcore._sync.connection not found
Instrumented tornado_request_execute, tornado.web.RequestHandler._execute
Skipping instrumentation of httpx. Module httpx not found
Instrumented django_template, django.template.Template.render
Skipping instrumentation of asyncpg. Module asyncpg.connection not found
Skipping instrumentation of sqlite. Module pysqlite2.dbapi2 not found
Instrumented sqlite, sqlite3.connect, sqlite3.dbapi2.connect
Skipping instrumentation of pymysql. Module pymysql not found
Skipping instrumentation of cassandra. Module cassandra.cluster not found
Instrumented elasticsearch_connection, elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request, elasticsearch.connection.http_requests.RequestsHttpConnection.perform_request
Instrumented redis, redis.client.Redis.execute_command
Instrumented asyncio_sleep, asyncio.tasks.sleep
Skipping instrumentation of mysql. Module MySQLdb not found
Instrumented requests, requests.sessions.Session.send
Skipping instrumentation of graphql. Module graphql.execution.executors.sync not found
Skipping instrumentation of graphql. Module graphql.execution.executors.gevent not found
Skipping instrumentation of graphql. Module graphql.execution.executors.asyncio not found
Skipping instrumentation of graphql. Module graphql.execution.executors.process not found
Skipping instrumentation of graphql. Module graphql.execution.executors.thread not found
Skipping instrumentation of pymemcache. Module pymemcache.client.base not found
Skipping instrumentation of pymemcache. Module pymemcache.client.hash not found
Skipping instrumentation of botocore. Module botocore.client not found
Inserting elasticapm log_record_factory into logging
Location of cgroup files failed, skipping cgroup metrics
Detected PID change from None to 13607, starting threads
Starting transport thread
Starting metrics thread
Starting metrics collect timer
Starting config thread
Instrumented elasticsearch_connection, elasticsearch.connection.http_urllib3.Urllib3HttpConnection.perform_request, elasticsearch.connection.http_requests.RequestsHttpConnection.perform_request
Instrumented django_template, django.template.Template.render
Skipping instrumentation of pylibmc. Module pylibmc not found
Instrumented django_template_source, django.template.base.Parser.extend_nodelist
Instrumented redis, redis.connection.Connection.send_packed_command
Skipping instrumentation of graphql. Module graphql.backend.core not found
Skipping instrumentation of graphql. Module graphql.backend.cache not found
Instrumented asyncio_sleep, asyncio.tasks.sleep
Skipping instrumentation of pymongo. Module pymongo.cursor not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch_async.connection not found
Skipping instrumentation of elasticsearch_connection. Module elasticsearch._async.http_aiohttp not found
Instrumented redis, redis.client.Redis.execute_command
Skipping instrumentation of mysql_connector. Module mysql.connector not found
Skipping instrumentation of sqlite. Module pysqlite2.dbapi2 not found
Instrumented sqlite, sqlite3.connect, sqlite3.dbapi2.connect
Instrumented requests, requests.sessions.Session.send
Skipping instrumentation of aiohttp_client. Module aiohttp.client not found
Skipping instrumentation of pymemcache. Module pymemcache.client.base not found
Skipping instrumentation of pymemcache. Module pymemcache.client.hash not found
Instrumented tornado_handle_request_exception, tornado.web.RequestHandler._handle_request_exception
requests.packages.urllib3.connectionpool.HTTPConnectionPool.urlopen already instrumented, skipping
Skipping instrumentation of urllib3. Module botocore.vendored.requests.packages.urllib3.connectionpool not found
Instrumented urllib3, urllib3.connectionpool.HTTPConnectionPool.urlopen
Skipping instrumentation of pymssql. Module pymssql not found
Skipping instrumentation of pymysql. Module pymysql not found
Skipping instrumentation of pymongo. Module pymongo.collection not found
Skipping instrumentation of httpcore. Module httpcore._sync.connection not found
Instrumented psycopg2, psycopg2.connect
Instrumented urllib, urllib.request.AbstractHTTPHandler.do_open
Skipping instrumentation of aiopg. Module aiopg.cursor not found
Skipping instrumentation of httpx. Module httpx not found
Skipping instrumentation of botocore. Module botocore.client not found
Skipping instrumentation of pymongo. Module pymongo.bulk not found
Skipping instrumentation of cassandra. Module cassandra.cluster not found
Instrumented tornado_render, tornado.web.RequestHandler.render
Skipping instrumentation of graphql. Module graphql.execution.executors.sync not found
Skipping instrumentation of graphql. Module graphql.execution.executors.gevent not found
Skipping instrumentation of graphql. Module graphql.execution.executors.asyncio not found
Skipping instrumentation of graphql. Module graphql.execution.executors.process not found
Skipping instrumentation of graphql. Module graphql.execution.executors.thread not found
Instrumented psycopg2, psycopg2.extensions.register_type, psycopg2._json.register_json, psycopg2.extensions.quote_ident, psycopg2.extensions.encrypt_password
Skipping instrumentation of httpx. Module httpx not found
Skipping instrumentation of asyncpg. Module asyncpg.connection not found
Instrumented tornado_request_execute, tornado.web.RequestHandler._execute
Skipping instrumentation of httpcore. Module httpcore._async.connection not found
Instrumented jinja2, jinja2.Template.render
Skipping instrumentation of pyodbc. Module pyodbc not found
Skipping instrumentation of mysql. Module MySQLdb not found
Instrumented redis, redis.client.Pipeline.execute
Skipping instrumentation of python_memcached. Module memcache not found
Checking for new config...
HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fe2625ed610>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Remote config unchanged
Checking for new config...
HTTP error while fetching remote config: HTTPConnectionPool(host='config', port=80): Max retries exceeded with url: /v1/agents (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f44c17c2a30>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))
Remote config unchanged
flushing due to time since last flush 9.503s > max_flush_time 9.503s
flushing due to time since last flush 10.827s > max_flush_time 10.827s
flushing due to time since last flush 9.971s > max_flush_time 9.971s
flushing due to time since last flush 9.114s > max_flush_time 9.114s
flushing due to time since last flush 9.763s > max_flush_time 9.763s
Collecting metrics
Collecting metrics
flushing due to time since last flush 10.874s > max_flush_time 10.874s
Failed to submit message: 'Connection to APM Server timed out (url: intake/v2/events, timeout: 5 seconds)'
flushing due to time since last flush 10.796s > max_flush_time 10.796s
Failed to submit message: 'Connection to APM Server timed out (url: intake/v2/events, timeout: 5 seconds)'
Cancelling collect timer
Cancelling collect timer
在我的 APM 服务器上,我没有收到来自代理的任何请求。我检查了 APM 服务器日志文件。
注释掉 'SERVER_URL': '127.0.0.1:8200'
解决了问题。