Understanding socket connection issues

Open
#554 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Stale
Tech stack
python

Research direction

Start at src/scout_apm/core/socket.py around line 190, where socket connection attempts are exhausted, and trace the available agent configuration and startup timing data. Implement the diagnostic POST to diagnostics.scoutapp.com with the specified headers, URL parameters, and body fields; done means exhausted connection attempts are reported with the requested socket and agent context.

Written by the indexing model from the issue text.

Description

What

We'd like to track socket connection issues with the core agent so we can identify issues and fix them proactively.

Why

The socket connection might fail for multiple reasons, which might include

  • Unable to create the core_agent_dir
  • Unable to download (e.g outbound firewall prevents it)
  • Permission denied to an already existing core_agent_socket path
  • noexec is set on the volume where core_agent_dir resides
  • Random things like core_agent_dir resides on a bind mount inside a docker container on an OSX host and creating a socket results in a name too long error. https://github.com/moby/moby/issues/23545#issuecomment-226144475

No matter the issue, the end result is that the python agent will attempt to connect to the socket, fail, and ultimately stop trying after a few attempts. We'll start by tracking when the connection attempts are exhausted.

How

  1. At https://github.com/scoutapp/scout_apm_python/blob/master/src/scout_apm/core/socket.py#L190
  2. Report the following data in a POST to https://checkin.scoutapp.com/apps/diagnostics.scout
  3. With URL parameters: ?key=#{org_key}&name=#{app_name}
  4. With Headers:
Agent-Hostname: #{socket.gethostbyname()}
Agent-Version: #{agent version}
Content-Type: application/octet-stream
  1. With body data:
{
  version: 1,
  type: socket,
  language: python,
  agent_version: ${agent_version},
  environment: #{app_environment},
  node: #{socket.gethostbyname()},
  time_since_startup: #{figure out how to determine this},
  agent_config: #{json object/hash of key/value of the agent's config options}
}
Dominant language
Python
Stars
77
Forks
19
Avg merge
1d 9h
Merged PRs (30d)
5

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from scoutapp/scout_apm_python

All issues in scoutapp/scout_apm_python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.