Skip to content

Commit

Permalink
Make telemetry an extra in setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanhellander committed Nov 24, 2023
1 parent a5f9280 commit fb1f335
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
30 changes: 17 additions & 13 deletions fedn/fedn/common/log_config.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,25 @@
import logging
import logging.config
from functools import wraps

import urllib3

from functools import wraps

from opentelemetry import trace
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.sdk.resources import Resource
from opentelemetry.semconv.resource import ResourceAttributes

import os
import platform
import socket
import psutil
try:
import os
import platform
import socket

import psutil
from opentelemetry import trace
from opentelemetry.exporter.jaeger.thrift import JaegerExporter
from opentelemetry.sdk.resources import Resource
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.semconv.resource import ResourceAttributes

telemetry_enabled = True
except ImportError:
telemetry_enabled = False

def get_system_info():
system_info = [
Expand Down
12 changes: 7 additions & 5 deletions fedn/fedn/network/clients/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@

import fedn.common.net.grpc.fedn_pb2 as fedn
import fedn.common.net.grpc.fedn_pb2_grpc as rpc
from fedn.common.log_config import (logger, set_log_level_from_string,
set_log_stream, log_remote,
add_trace, enable_tracing, get_tracer)
from fedn.common.log_config import (add_trace, enable_tracing, get_tracer,
log_remote, logger,
set_log_level_from_string, set_log_stream)
from fedn.network.clients.connect import ConnectorClient, Status
from fedn.network.clients.package import PackageRuntime
from fedn.network.clients.state import ClientState, ClientStateToString
Expand All @@ -36,12 +36,14 @@
import os
import platform
import socket
import psutil

import GPUtil
import psutil


def get_system_info():
gpus = GPUtil.getGPUs()
gpu_info = [[gpu.id, gpu.name] for gpu in gpus]
gpu_info = [["GPU ID: {}".format(gpu.id), gpu.name] for gpu in gpus]

system_info = {
"os.name": os.name,
Expand Down
9 changes: 9 additions & 0 deletions fedn/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@
"bokeh<3.0.0",
"networkx"
],
extras_require={
'telemetry': [
"GPUtil",
"opentelemetry-exporter-jaeger",
"opentelemetry-instrumentation",
"opentelemetry-sdk",
"opentelemetry-api"
]
},
license='Apache 2.0',
zip_safe=False,
entry_points={
Expand Down

0 comments on commit fb1f335

Please sign in to comment.