Repository: DataDog/dd-trace-py

Issue:
Configuration documentation table hard to read
### Summary of problem
The documentation's [configuration page](https://ddtrace.readthedocs.io/en/stable/configuration.html) contains a table of all the possible variables that can be set. This table includes the default value. There are a few variables that default to long regular expressions which don't render with any extra line breaks. This causes the description column to be far to the right after a long scroll.


### Which version of dd-trace-py are you using?
n/a

### Which version of pip are you using?
n/a

### Which libraries and their versions are you using?
n/a

### How can we reproduce your problem?
Go to the [documentation website](https://ddtrace.readthedocs.io/en/stable/configuration.html)

### What is the result that you get?
A table that requires significant horizontal scrolling.

### What is the result that you expected?
Have the page render in a way that doesn't require significant horizontal scrolling. Alternately, move the default column to be the most right column. This would only require scrolling when people care about the few values that are long.


Discussion:
Hey @plannigan thanks for opening this issue. We noticed this recently as well but haven't found a good way to fix it yet.

But this is a good reminder that we should try again!

Resolving patch:
diff --git a/docs/conf.py b/docs/conf.py
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -673,7 +673,60 @@ def run(self):
         return node.children
 
 
+class DDTraceConfigurationOptionsDirective(rst.Directive):
+    r"""
+    Directive class to handle ``.. ddtrace-configuration-options::`` directive.
+
+    For example::
+
+        .. ddtrace-configuration-options::
+    """
+
+    has_content = True
+
+    def run(self):
+        options = yaml.load("\n".join(self.content), Loader=yaml.CLoader)
+
+        results = statemachine.ViewList()
+        for var_name, value in options.items():
+            skip_label = value.get("skip_label") == "true"
+            var_label = var_name.lower().replace("_", "-")
+            var_description = value["description"]
+            var_type = value.get("type") or "String"
+            var_default = value.get("default") or "(no value)"
+            var_version_added = value.get("version_added")
+
+            if not skip_label:
+                results.append(".. _`{}`:".format(var_label), "", 0)
+                results.append("", "", 0)
+            results.append(".. py:data:: {}".format(var_name), "", 0)
+            results.append("", "", 0)
+            for line in var_description.splitlines():
+                results.append("    " + line.lstrip(), "", 0)
+
+            results.append("", "", 0)
+            results.append("    **Type**: {}".format(var_type), "", 0)
+            results.append("", "", 0)
+            results.append("    **Default**: {}".format(var_default), "", 0)
+            results.append("", "", 0)
+
+            if var_version_added:
+                for version, note in var_version_added.items():
+                    if note:
+                        results.append("    *Changed in version {}*: {}".format(version, note), "", 0)
+                    else:
+                        results.append("    *New in version {}.*".format(version), "", 0)
+                    results.append("", "", 0)
+
+        # Generate the RST nodes to return for rendering
+        node = nodes.section()
+        node.document = self.state.document
+        self.state.nested_parse(results, 0, node)
+        return node.children
+
+
 def setup(app):
     app.add_directive("ddtrace-release-notes", DDTraceReleaseNotesDirective)
+    app.add_directive("ddtrace-configuration-options", DDTraceConfigurationOptionsDirective)
     metadata_dict = {"version": "1.0.0", "parallel_read_safe": True}
     return metadata_dict


Test patch: