-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4c74a6d
commit c1a70d3
Showing
7 changed files
with
28 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,18 @@ | ||
import ast | ||
from .ast_utils import BaseTransformer as BaseTransformer, LogfireArgs as LogfireArgs | ||
from .constants import ATTRIBUTES_MESSAGE_TEMPLATE_KEY as ATTRIBUTES_MESSAGE_TEMPLATE_KEY, ATTRIBUTES_TAGS_KEY as ATTRIBUTES_TAGS_KEY | ||
from .main import Logfire as Logfire | ||
from dataclasses import dataclass | ||
from types import CodeType | ||
from typing import Callable, TypeVar | ||
from typing_extensions import ParamSpec | ||
from .stack_info import get_filepath_attribute as get_filepath_attribute | ||
from .utils import safe_repr as safe_repr, uniquify_sequence as uniquify_sequence | ||
from _typeshed import Incomplete | ||
from collections.abc import Sequence | ||
from opentelemetry.util import types as otel_types | ||
from typing import Any, Callable, TypeVar | ||
from typing_extensions import LiteralString, ParamSpec | ||
|
||
P = ParamSpec('P') | ||
R = TypeVar('R') | ||
CONTEXTMANAGER_HELPER_CODE: Incomplete | ||
ASYNCCONTEXTMANAGER_HELPER_CODE: Incomplete | ||
GENERATOR_WARNING_MESSAGE: str | ||
|
||
def instrument(logfire: Logfire, args: LogfireArgs) -> Callable[[Callable[P, R]], Callable[P, R]]: ... | ||
def transform_code(func_code: CodeType, args: LogfireArgs): ... | ||
|
||
@dataclass | ||
class InstrumentTransformer(BaseTransformer): | ||
"""Only modifies the function definition at the given line.""" | ||
code_lineno: int | ||
def rewrite_function(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.AST: ... | ||
def logfire_method_call_node(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> ast.Call: ... | ||
def logfire_method_arg_nodes(self, node: ast.FunctionDef | ast.AsyncFunctionDef, qualname: str) -> list[ast.expr]: ... | ||
def instrument(logfire: Logfire, tags: Sequence[str], msg_template: LiteralString | None, span_name: str | None, extract_args: bool, allow_generator: bool) -> Callable[[Callable[P, R]], Callable[P, R]]: ... | ||
def get_attributes(func: Any, msg_template: str | None, tags: Sequence[str] | None) -> dict[str, otel_types.AttributeValue]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.