elastic / elastic/apm-agent-python

Warning for `SERVICE_NAME` even after explicitly given value in config

Open
#1,908 3 comments 0 reactions 0 assignees View on GitHub
agent-python community triage
Dominant language
Python
Stars
431
Forks
239
Avg merge
5d 10h
Merged PRs (30d)
7

Description

I have integrated elastic-apm with flask application, following simple document provided in flask-support documentation.
Im getting warning:

`[2023-09-28 15:07:07,840 base.py->__init__():123]WARNING: No custom SERVICE_NAME was set -- using non-descript default 'unknown-python-service'`

Here is exact code:

```app = flask.Flask(__name__)
apm = None
try:
app.config['ELASTIC_APM'] = {
'SERVICE_NAME': 'myservice-api',
'SECRET_TOKEN': '',
'SERVER_URL': '',
'ENVIRONMENT': '',
}
apm = ElasticAPM(app)
except Exception as e:
logging.critical(f"APM error for middleware: {e}")
del apm
```

I tried another way to initialize apm object:
`apm = ElasticAPM(app, service_name='myservice-api')`

But doesn't make any difference.

- OS: WSL2 (Windows 11 with Ubuntu 22.04)
- Python version: 3.10.12
- Framework and version: Flask 2.0.1
- elastic-apm==6.17.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.