Skip to content

Commit a90b9cb

Browse files
committed
Commit initial version (manual sync).
1 parent 6637ee0 commit a90b9cb

39 files changed

+4883
-0
lines changed

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
*.pyc
2+
*.pyo
3+
build/
4+
__pycache__/
5+
onesdk_shared.dll
6+
.tox/
7+
dist/
8+
/MANIFEST
9+
.cache/
10+
/tmp/
11+
*.egg-info
12+
.pytest_cache/

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
prune test
2+
graft src
3+
global-exclude *.pyc
4+
global-exclude *.pyo
5+
global-exclude __pycache__/*

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
**Disclaimer: This SDK is currently in early access and still work in
2+
progress.**
3+
4+
5+
# Dynatrace OneAgent SDK for Python
6+
7+
This SDK enables Dynatrace customers to extend request level visibility into
8+
Python applications.
9+
10+
It provides the Python implementation of the [Dynatrace OneAgent
11+
SDK](https://github.com/Dynatrace/OneAgent-SDK).
12+
13+
14+
## Package contents
15+
16+
- `LICENSE`: License under which the whole SDK and sample applications are
17+
published.
18+
- `src/`: Actual source code of the Python OneAgent SDK.
19+
- `docs/`: Source files for the ([Sphinx](https://sphinx-doc.org)-based) HTML
20+
documentation. For the actual, readable documentation, see
21+
[here](#documenation).
22+
- `tests/`: Contains tests that are useful (only) for developers wanting
23+
contribute to the SDK itself.
24+
- `setup.py`, `setup.cfg`, `MANIFEST.in`: Development Files required for
25+
creating e.g. the PyPI package for the Python OneAgent SDK.
26+
- `tox.ini`, `pylintrc`: Supporting files for developing the SDK itself. See
27+
<https://tox.readthedocs.io/en/latest/> and <https://www.pylint.org/>.
28+
29+
30+
## Features
31+
32+
Dynatrace OneAgent SDK for Python currently implements support for the following
33+
features (corresponding to features specified in [Dynatrace OneAgent
34+
SDK](https://github.com/Dynatrace/OneAgent-SDK)):
35+
36+
- Outgoing and incoming remote calls
37+
- SQL Database requests
38+
- Incoming web requests
39+
40+
41+
## Documentation
42+
43+
The reference documentation is included in this package. The most recent version
44+
is also available online at <https://dynatrace.github.io/OneAgent-SDK-for-Python/>
45+
46+
A high level documentation/description of OneAgent SDK concepts is available at
47+
<https://github.com/Dynatrace/OneAgent-SDK/>.

docs/conf.py

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
#!/usr/bin/env python3
2+
# -*- coding: utf-8 -*-
3+
#
4+
# OneAgent and SDK for Python documentation build configuration file, created by
5+
# sphinx-quickstart on Mon Dec 4 14:43:27 2017.
6+
#
7+
# This file is execfile()d with the current directory set to its
8+
# containing dir.
9+
#
10+
# Note that not all possible configuration values are present in this
11+
# autogenerated file.
12+
#
13+
# All configuration values have a default; values that are commented out
14+
# serve to show the default.
15+
16+
# If extensions (or modules to document with autodoc) are in another directory,
17+
# add these directories to sys.path here. If the directory is relative to the
18+
# documentation root, use os.path.abspath to make it absolute, like shown here.
19+
#
20+
# import os
21+
# import sys
22+
# sys.path.insert(0, os.path.abspath('.'))
23+
24+
# Fix spurious "= None" for instance attributes
25+
# https://github.com/sphinx-doc/sphinx/issues/2044
26+
from sphinx.ext.autodoc import (
27+
ClassLevelDocumenter, InstanceAttributeDocumenter)
28+
29+
def iad_add_directive_header(self, sig):
30+
ClassLevelDocumenter.add_directive_header(self, sig)
31+
32+
InstanceAttributeDocumenter.add_directive_header = iad_add_directive_header
33+
34+
35+
# -- General configuration ------------------------------------------------
36+
37+
# If your documentation needs a minimal Sphinx version, state it here.
38+
#
39+
# needs_sphinx = '1.0'
40+
41+
# Add any Sphinx extension module names here, as strings. They can be
42+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
43+
# ones.
44+
extensions = [
45+
'sphinx.ext.autodoc',
46+
'sphinx.ext.intersphinx',
47+
'sphinx.ext.coverage',
48+
'sphinx.ext.githubpages']
49+
50+
# Add any paths that contain templates here, relative to this directory.
51+
templates_path = ['_templates']
52+
53+
# The suffix(es) of source filenames.
54+
# You can specify multiple suffix as a list of string:
55+
#
56+
# source_suffix = ['.rst', '.md']
57+
source_suffix = '.rst'
58+
59+
# The master toctree document.
60+
master_doc = 'index'
61+
62+
# General information about the project.
63+
project = 'Dynatrace OneAgent and SDK for Python'
64+
copyright = '2017, Dynatrace LLC'
65+
author = 'Dynatrace LLC'
66+
67+
# The version info for the project you're documenting, acts as replacement for
68+
# |version| and |release|, also used in various other places throughout the
69+
# built documents.
70+
#
71+
# The short X.Y version.
72+
version = ''
73+
# The full version, including alpha/beta/rc tags.
74+
release = ''
75+
76+
# The language for content autogenerated by Sphinx. Refer to documentation
77+
# for a list of supported languages.
78+
#
79+
# This is also used if you do content translation via gettext catalogs.
80+
# Usually you set "language" from the command line for these cases.
81+
language = None
82+
83+
# List of patterns, relative to source directory, that match files and
84+
# directories to ignore when looking for source files.
85+
# This patterns also effect to html_static_path and html_extra_path
86+
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
87+
88+
# The name of the Pygments (syntax highlighting) style to use.
89+
pygments_style = 'sphinx'
90+
91+
# If true, `todo` and `todoList` produce output, else they produce nothing.
92+
todo_include_todos = False
93+
94+
95+
# -- Options for HTML output ----------------------------------------------
96+
97+
# The theme to use for HTML and HTML Help pages. See the documentation for
98+
# a list of builtin themes.
99+
#
100+
html_theme = 'nature'
101+
102+
# Theme options are theme-specific and customize the look and feel of a theme
103+
# further. For a list of options available for each theme, see the
104+
# documentation.
105+
#
106+
# html_theme_options = {}
107+
108+
# Add any paths that contain custom static files (such as style sheets) here,
109+
# relative to this directory. They are copied after the builtin static files,
110+
# so a file named "default.css" will overwrite the builtin "default.css".
111+
html_static_path = ['_static']
112+
113+
# Custom sidebar templates, must be a dictionary that maps document names
114+
# to template names.
115+
#
116+
# This is required for the alabaster theme
117+
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
118+
html_sidebars = {
119+
'**': [
120+
'searchbox.html',
121+
'localtoc.html',
122+
'relations.html', # needs 'show_related': True theme option to display
123+
]
124+
}
125+
126+
127+
# -- Options for HTMLHelp output ------------------------------------------
128+
129+
# Output file base name for HTML help builder.
130+
htmlhelp_basename = 'OneAgentandSDKforPythondoc'
131+
132+
133+
# -- Options for LaTeX output ---------------------------------------------
134+
135+
latex_elements = {
136+
# The paper size ('letterpaper' or 'a4paper').
137+
#
138+
# 'papersize': 'letterpaper',
139+
140+
# The font size ('10pt', '11pt' or '12pt').
141+
#
142+
# 'pointsize': '10pt',
143+
144+
# Additional stuff for the LaTeX preamble.
145+
#
146+
# 'preamble': '',
147+
148+
# Latex figure (float) alignment
149+
#
150+
# 'figure_align': 'htbp',
151+
}
152+
153+
# Grouping the document tree into LaTeX files. List of tuples
154+
# (source start file, target name, title,
155+
# author, documentclass [howto, manual, or own class]).
156+
latex_documents = [
157+
(master_doc, 'OneAgentandSDKforPython.tex', 'OneAgent and SDK for Python Documentation',
158+
'Dynatrace LLC', 'manual'),
159+
]
160+
161+
162+
# -- Options for manual page output ---------------------------------------
163+
164+
# One entry per manual page. List of tuples
165+
# (source start file, name, description, authors, manual section).
166+
man_pages = [
167+
(master_doc, 'oneagentandsdkforpython', 'OneAgent and SDK for Python Documentation',
168+
[author], 1)
169+
]
170+
171+
172+
# -- Options for Texinfo output -------------------------------------------
173+
174+
# Grouping the document tree into Texinfo files. List of tuples
175+
# (source start file, target name, title, author,
176+
# dir menu entry, description, category)
177+
texinfo_documents = [
178+
(master_doc, 'OneAgentandSDKforPython', 'OneAgent and SDK for Python Documentation',
179+
author, 'OneAgentandSDKforPython', 'Dynatrace OneAgent and SDK for Python',
180+
'Miscellaneous'),
181+
]
182+
183+
# -- Other ----------------------------------------------------------------
184+
185+
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}
186+
187+
# http://www.sphinx-doc.org/en/master/config.html#confval-nitpicky
188+
# Sphinx will warn about all references where the target cannot be found.
189+
nitpicky = True
190+
nitpick_ignore = [
191+
('envvar', 'DT_HOME'),
192+
('py:class', 'callable'),
193+
('py:class', 'unicode'),
194+
('py:class', 'typing.Union'),
195+
('py:class', 'typing.Tuple'),
196+
('py:class', 'oneagent.common._Uninstantiable')
197+
]
198+
199+
autodoc_member_order = 'bysource'

docs/encoding.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
.. _encoding:
2+
3+
String encoding and unicode issues
4+
==================================
5+
6+
This section mostly concerns Python 2.
7+
8+
When the documentation says that a :class:`str` is accepted, an :class:`unicode`
9+
is also always accepted on Python 2. What is more, when the documentation says
10+
that a :class:`str` is returned or passed to a callback, on Python 2 it is
11+
actually a :class:`unicode` (you mostly don't need to care about that though,
12+
because most string operations on Python 2 allow mixing :class:`str` and
13+
:class:`unicode`).
14+
15+
When passing a :class:`bytes` object (or, equivalently, a :code:`str` object on
16+
Python 2) to a SDK function that says that it accepts a :class:`str`, the bytes
17+
will be interpreted as being UTF-8 encoded. Beware: If the string has invalid
18+
UTF-8 (e.g. Latin-1/ISO-8859-1, as it may occur in :ref:`HTTP headers
19+
<http-encoding-warning>`), the function to which it was passed may fail either
20+
partially or fully. Such failures are guaranteed to neither throw exceptions nor
21+
violate any invariants of the involved objects, but some or all of the
22+
information passed in that function call may be lost (E.g. a single invalid HTTP
23+
header passed to :meth:`oneagent.sdk.SDK.trace_incoming_web_request` may cause
24+
an null-tracer to be returned -- but it is also allowed to e.g. truncate that
25+
HTTP header and discard all that follow; the exact failure mode is undefined and
26+
you should take care to not pass invalid strings). Also, the diagnostic callback
27+
(:meth:`oneagent.sdk.SDK.set_diagnostic_callback`) may be invoked (but is not
28+
guaranteed to).

docs/index.rst

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Welcome to the documentation for Dynatrace OneAgent and SDK for Python
2+
======================================================================
3+
4+
.. toctree::
5+
:maxdepth: 2
6+
:caption: Contents:
7+
8+
quickstart
9+
sdkref
10+
encoding
11+
tagging
12+
13+
14+
15+
Indices and tables
16+
==================
17+
18+
* :ref:`genindex`
19+
* :ref:`modindex`
20+
* :ref:`search`

docs/quickstart.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Quickstart
2+
==========
3+
4+
The following example shows most features of the Python SDK:
5+
6+
.. literalinclude:: ../test/onesdksamplepy.py
7+
8+
See the rest of the documentation for more information.

docs/sdkref.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
Public SDK API Reference
2+
========================
3+
4+
For a high-level overview of SDK concepts, see
5+
https://github.com/Dynatrace/OneAgent-SDK.
6+
7+
Module :code:`oneagent` (initialization)
8+
----------------------------------------
9+
10+
.. automodule:: oneagent
11+
:members: sdkopts_from_commandline, try_init, shutdown
12+
13+
..
14+
.. autofunction:: oneagent.start_agent
15+
.. autofunction:: oneagent.try_start_agent
16+
17+
Module :code:`oneagent.sdk`
18+
---------------------------
19+
20+
.. automodule:: oneagent.sdk
21+
:members: SDK
22+
:show-inheritance:
23+
24+
Module :code:`oneagent.sdk.tracers`
25+
-----------------------------------
26+
27+
.. automodule:: oneagent.sdk.tracers
28+
:members:
29+
:show-inheritance:
30+
31+
Module :code:`oneagent.common`
32+
----------------------------------
33+
34+
.. automodule:: oneagent.common
35+
:members:
36+
:show-inheritance:
37+

0 commit comments

Comments
 (0)