Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions skywalking/agent/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

import logging
from skywalking.loggings import logger
from queue import Queue
from threading import Thread, Event
from typing import TYPE_CHECKING
Expand All @@ -26,8 +26,6 @@
if TYPE_CHECKING:
from skywalking.trace.context import Segment

logger = logging.getLogger(__name__)


def __heartbeat():
while not __finished.is_set():
Expand Down
4 changes: 1 addition & 3 deletions skywalking/agent/protocol/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

import logging
from skywalking.loggings import logger
import traceback
from queue import Queue

Expand All @@ -29,8 +29,6 @@
from skywalking.protocol.language_agent.Tracing_pb2 import SegmentObject, SpanObject, Log, SegmentReference
from skywalking.trace.segment import Segment

logger = logging.getLogger(__name__)


class GrpcProtocol(Protocol):
def __init__(self):
Expand Down
4 changes: 1 addition & 3 deletions skywalking/agent/protocol/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
# limitations under the License.
#

import logging
from skywalking.loggings import logger
from queue import Queue

from skywalking.agent import Protocol
from skywalking.client.http import HttpServiceManagementClient, HttpTraceSegmentReportService
from skywalking.trace.segment import Segment

logger = logging.getLogger(__name__)


class HttpProtocol(Protocol):
def __init__(self):
Expand Down
7 changes: 3 additions & 4 deletions skywalking/agent/protocol/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

import logging
from skywalking.loggings import logger, getLogger
from queue import Queue

from skywalking import config
Expand All @@ -25,11 +26,9 @@
from skywalking.protocol.language_agent.Tracing_pb2 import SegmentObject, SpanObject, Log, SegmentReference
from skywalking.trace.segment import Segment

logger = logging.getLogger(__name__)

# avoid too many kafka logs
logger_kafka = logging.getLogger('kafka')
logger_kafka.setLevel(logging.WARN)
logger_kafka = getLogger('kafka')
logger_kafka.setLevel(max(logging.WARN, logger.level))


class KafkaProtocol(Protocol):
Expand Down
4 changes: 1 addition & 3 deletions skywalking/client/grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# limitations under the License.
#

import logging
from skywalking.loggings import logger

import grpc

Expand All @@ -26,8 +26,6 @@
from skywalking.protocol.management.Management_pb2 import InstancePingPkg, InstanceProperties
from skywalking.protocol.management.Management_pb2_grpc import ManagementServiceStub

logger = logging.getLogger(__name__)


class GrpcServiceManagementClient(ServiceManagementClient):
def __init__(self, channel: grpc.Channel):
Expand Down
4 changes: 1 addition & 3 deletions skywalking/client/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
# limitations under the License.
#

import logging
from skywalking.loggings import logger

import requests

from skywalking import config
from skywalking.client import ServiceManagementClient, TraceSegmentReportService

logger = logging.getLogger(__name__)


class HttpServiceManagementClient(ServiceManagementClient):
def __init__(self):
Expand Down
4 changes: 1 addition & 3 deletions skywalking/client/kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import os
import ast
import logging
from skywalking.loggings import logger

from skywalking import config
from skywalking.client import ServiceManagementClient, TraceSegmentReportService
Expand All @@ -26,8 +26,6 @@

from kafka import KafkaProducer

logger = logging.getLogger(__name__)

kafka_configs = {}


Expand Down
19 changes: 15 additions & 4 deletions skywalking/loggings.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,19 @@
from skywalking import config


def getLogger(name=None):
logger = logging.getLogger(name)
ch = logging.StreamHandler()
formatter = logging.Formatter('%(name)-32s [%(threadName)-15s] [%(levelname)-8s] %(message)s')
ch.setFormatter(formatter)
logger.addHandler(ch)

return logger


logger = getLogger('skywalking')


def init():
logging.basicConfig(
level=logging.getLevelName(config.logging_level),
format='%(name)-32s [%(threadName)-15s] [%(levelname)-8s] %(message)s',
)
logging.addLevelName(logging.CRITICAL + 10, 'OFF')
logger.setLevel(logging.getLevelName(config.logging_level))
3 changes: 1 addition & 2 deletions skywalking/plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#
import inspect
import logging
from skywalking.loggings import logger
import pkgutil
import re
import traceback
Expand All @@ -28,8 +29,6 @@

import skywalking

logger = logging.getLogger(__name__)


def install():
disable_patterns = config.disable_plugins
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_django.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component, config
from skywalking.trace import tags
from skywalking.trace.carrier import Carrier
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)

version_rule = {
"name": "django",
"rules": [">=2.0"]
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_elasticsearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component, config
from skywalking.trace import tags
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from elasticsearch import Transport
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component, config
from skywalking.trace import tags
Expand All @@ -23,8 +22,6 @@
from skywalking.trace.span import NoopSpan
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from flask import Flask
Expand Down
4 changes: 1 addition & 3 deletions skywalking/plugins/sw_http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#

import inspect
import logging

from skywalking import Layer, Component
from skywalking.trace import tags
from skywalking.trace.carrier import Carrier
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from http.server import BaseHTTPRequestHandler
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_kafka.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import config
from skywalking import Layer, Component
Expand All @@ -23,8 +22,6 @@
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from kafka import KafkaProducer
Expand Down
4 changes: 0 additions & 4 deletions skywalking/plugins/sw_pymongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
# limitations under the License.
#

import logging

from skywalking import Layer, Component, config
from skywalking.trace import tags
from skywalking.trace.carrier import Carrier
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)

version_rule = {
"name": "pymongo",
"rules": [">=3.7.0"]
Expand Down
4 changes: 1 addition & 3 deletions skywalking/plugins/sw_pymysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component, config
from skywalking.trace import tags
from skywalking.trace.carrier import Carrier
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from pymysql.cursors import Cursor
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_rabbitmq.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component
from skywalking.trace import tags
from skywalking.trace.carrier import Carrier
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from pika.channel import Channel
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_redis.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component
from skywalking.trace import tags
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from redis.connection import Connection
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from skywalking import Layer, Component
from skywalking.trace import tags
Expand All @@ -23,8 +22,6 @@
from skywalking.trace.tags import Tag
from skywalking import config

logger = logging.getLogger(__name__)


def install():
from requests import Session
Expand Down
4 changes: 1 addition & 3 deletions skywalking/plugins/sw_tornado.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
import logging

from inspect import iscoroutinefunction, isawaitable

from skywalking import Layer, Component
Expand All @@ -23,8 +23,6 @@
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from tornado.web import RequestHandler
Expand Down
4 changes: 0 additions & 4 deletions skywalking/plugins/sw_urllib3.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,12 @@
# limitations under the License.
#

import logging

from skywalking import Layer, Component
from skywalking.trace import tags
from skywalking.trace.carrier import Carrier
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
from urllib3.request import RequestMethods
Expand Down
3 changes: 0 additions & 3 deletions skywalking/plugins/sw_urllib_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
# limitations under the License.
#

import logging
from urllib.request import Request

from skywalking import Layer, Component
Expand All @@ -24,8 +23,6 @@
from skywalking.trace.context import get_context
from skywalking.trace.tags import Tag

logger = logging.getLogger(__name__)


def install():
import socket
Expand Down
Loading