diff --git a/.pylintrc b/.pylintrc index 1aa1e10d0b..e3a42fea79 100644 --- a/.pylintrc +++ b/.pylintrc @@ -28,7 +28,7 @@ limit-inference-results=100 # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. -load-plugins= +load-plugins=pylint.extensions.docparams # Pickle collected data for later comparisons. persistent=yes @@ -69,6 +69,7 @@ disable=missing-docstring, wrong-import-order, # Leave this up to isort bad-continuation, # Leave this up to black line-too-long, # Leave this up to black + missing-yield-type-doc, # Use return type annotation instead exec-used # Enable the message, report, category or checker with the given id(s). You can diff --git a/ext/opentelemetry-ext-dbapi/setup.py b/ext/opentelemetry-ext-dbapi/setup.py index f5c1b3fa81..ccdeeda060 100644 --- a/ext/opentelemetry-ext-dbapi/setup.py +++ b/ext/opentelemetry-ext-dbapi/setup.py @@ -20,6 +20,7 @@ BASE_DIR, "src", "opentelemetry", "ext", "dbapi", "version.py" ) PACKAGE_INFO = {} +# pylint:disable=exec-used with open(VERSION_FILENAME) as f: exec(f.read(), PACKAGE_INFO) diff --git a/ext/opentelemetry-ext-wsgi/setup.py b/ext/opentelemetry-ext-wsgi/setup.py index 886800eacf..5cd1330a4d 100644 --- a/ext/opentelemetry-ext-wsgi/setup.py +++ b/ext/opentelemetry-ext-wsgi/setup.py @@ -20,6 +20,7 @@ BASE_DIR, "src", "opentelemetry", "ext", "wsgi", "version.py" ) PACKAGE_INFO = {} +# pylint:disable=exec-used with open(VERSION_FILENAME) as f: exec(f.read(), PACKAGE_INFO) diff --git a/ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/__init__.py b/ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/__init__.py index 61e8126c19..5d5a8102f9 100644 --- a/ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/__init__.py +++ b/ext/opentelemetry-ext-wsgi/src/opentelemetry/ext/wsgi/__init__.py @@ -211,12 +211,16 @@ def _start_response(status, response_headers, *args, **kwargs): return _start_response + # pylint: disable=missing-type-doc def __call__(self, environ, start_response): """The WSGI application Args: environ: A WSGI environment. start_response: The WSGI start_response callable. + + Yields: + Zero or more strings that comprise the WSGI response. """ token = context.attach( diff --git a/opentelemetry-api/setup.py b/opentelemetry-api/setup.py index 75d213ae4e..dc50de235f 100644 --- a/opentelemetry-api/setup.py +++ b/opentelemetry-api/setup.py @@ -19,6 +19,7 @@ BASE_DIR = os.path.dirname(__file__) VERSION_FILENAME = os.path.join(BASE_DIR, "src", "opentelemetry", "version.py") PACKAGE_INFO = {} +# pylint:disable=exec-used with open(VERSION_FILENAME) as f: exec(f.read(), PACKAGE_INFO) diff --git a/opentelemetry-api/src/opentelemetry/metrics/__init__.py b/opentelemetry-api/src/opentelemetry/metrics/__init__.py index b7ad62adb2..436a542ec6 100644 --- a/opentelemetry-api/src/opentelemetry/metrics/__init__.py +++ b/opentelemetry-api/src/opentelemetry/metrics/__init__.py @@ -103,6 +103,8 @@ def bind(self, labels: Dict[str, str]) -> "object": Args: labels: Labels to associate with the bound instrument. + Returns: + A new bound metric instrument. """ @@ -114,6 +116,8 @@ def bind(self, labels: Dict[str, str]) -> "DefaultBoundInstrument": Args: labels: Labels to associate with the bound instrument. + Returns: + A new bound metric instrument. """ return DefaultBoundInstrument() @@ -138,7 +142,13 @@ class Counter(Metric): """A counter type metric that expresses the computation of a sum.""" def bind(self, labels: Dict[str, str]) -> "BoundCounter": - """Gets a `BoundCounter`.""" + """Gets a `BoundCounter`. + + Args: + labels: Labels to associate with the bound instrument. + Returns: + A new bound metric instrument. + """ return BoundCounter() def add(self, value: ValueT, labels: Dict[str, str]) -> None: @@ -157,7 +167,13 @@ class Measure(Metric): """ def bind(self, labels: Dict[str, str]) -> "BoundMeasure": - """Gets a `BoundMeasure`.""" + """Gets a `BoundMeasure`. + + Args: + labels: Labels to associate with the bound instrument. + Returns: + A new bound metric instrument. + """ return BoundMeasure() def record(self, value: ValueT, labels: Dict[str, str]) -> None: diff --git a/opentelemetry-api/src/opentelemetry/propagators/__init__.py b/opentelemetry-api/src/opentelemetry/propagators/__init__.py index 5aa53e25dc..66021a1ddf 100644 --- a/opentelemetry-api/src/opentelemetry/propagators/__init__.py +++ b/opentelemetry-api/src/opentelemetry/propagators/__init__.py @@ -85,6 +85,8 @@ def extract( which understands how to extract a value from it. context: an optional Context to use. Defaults to current context if not set. + Returns: + The extracted context. """ return get_global_httptextformat().extract( get_from_carrier, carrier, context diff --git a/opentelemetry-api/src/opentelemetry/trace/propagation/tracecontexthttptextformat.py b/opentelemetry-api/src/opentelemetry/trace/propagation/tracecontexthttptextformat.py index 732ce96c66..62dfc72b6a 100644 --- a/opentelemetry-api/src/opentelemetry/trace/propagation/tracecontexthttptextformat.py +++ b/opentelemetry-api/src/opentelemetry/trace/propagation/tracecontexthttptextformat.py @@ -144,7 +144,7 @@ def _parse_tracestate(header_list: typing.List[str]) -> trace.TraceState: """Parse one or more w3c tracestate header into a TraceState. Args: - string: the value of the tracestate header. + header_list: A list of tracestate headers to parse. Returns: A valid TraceState that contains values extracted from diff --git a/opentelemetry-sdk/setup.py b/opentelemetry-sdk/setup.py index 3ba02ba245..3d1e83b4ce 100644 --- a/opentelemetry-sdk/setup.py +++ b/opentelemetry-sdk/setup.py @@ -21,6 +21,7 @@ BASE_DIR, "src", "opentelemetry", "sdk", "version.py" ) PACKAGE_INFO = {} +# pylint:disable=exec-used with open(VERSION_FILENAME) as f: exec(f.read(), PACKAGE_INFO) diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py index 1d35648fd3..0ccfa0bed7 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/metrics/__init__.py @@ -272,6 +272,7 @@ class Meter(metrics_api.Meter): Args: instrumentation_info: The `InstrumentationInfo` for this meter. stateful: Indicates whether the meter is stateful. + resource: The `Resource` associated with this `Meter`. """ def __init__( diff --git a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py index 20c50a849f..ec910ce20e 100644 --- a/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py +++ b/opentelemetry-sdk/src/opentelemetry/sdk/trace/__init__.py @@ -248,8 +248,12 @@ class Span(trace_api.Span): attributes: The span's attributes to be exported events: Timestamped events to be exported links: Links to other spans to be exported + kind: The span kind. span_processor: `SpanProcessor` to invoke when starting and ending this `Span`. + instrumentation_info: Optional instrumentation info. + set_status_on_exception: Whether to populate the span's status with + error details when handling an exception. """ def __init__( @@ -580,9 +584,8 @@ class Tracer(trace_api.Tracer): """See `opentelemetry.trace.Tracer`. Args: - name: The name of the tracer. - shutdown_on_exit: Register an atexit hook to shut down the tracer when - the application exits. + source: The parent `TracerProvider`. + instrumentation_info: Information about the instrumenting library. """ def __init__(