Skip to content

Commit 20b42a9

Browse files
committed
add service pid for without name
1 parent c207f44 commit 20b42a9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

middleware/options.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
DEFAULT_COLLECT_PROFILING = False
4444
DEFAULT_AGENT_SERVICE = "localhost"
4545
DEFAULT_EXPORTER_PROTOCOL = "grpc"
46-
DEFAULT_SERVICE_NAME = "unknown_service:python"
46+
DEFAULT_SERVICE_NAME = f"python-service-{os.getpid()}"
4747
DEFAULT_LOG_LEVEL = "INFO"
4848
DEFAULT_PROPAGATORS = "b3"
4949
DEFAULT_SAMPLE_RATE = 1
@@ -68,7 +68,7 @@
6868
"Missing service name. Specify either "
6969
+ "OTEL_SERVICE_NAME/MW_SERVICE_NAME environment variable or service_name in the "
7070
+ "options parameter. If left unset, this will show up in middleware "
71-
+ "as unknown_service:python"
71+
+ "as python-service-pid"
7272
)
7373

7474
log_levels = {
@@ -245,7 +245,7 @@ def __init__(
245245
OTEL_SERVICE_NAME, os.environ.get(MW_SERVICE_NAME, service_name)
246246
)
247247
if not self.service_name:
248-
_logger.warning(MISSING_SERVICE_NAME_ERROR)
248+
_logger.debug(MISSING_SERVICE_NAME_ERROR)
249249
self.service_name = DEFAULT_SERVICE_NAME
250250

251251
self.collect_traces = parse_bool(MW_APM_COLLECT_TRACES, collect_traces)

0 commit comments

Comments
 (0)