Skip to content

Commit 19d2bd4

Browse files
authored
Merge pull request #241 from appsignal/nginx-port
Add `nginx_port` configuration option
2 parents c789f93 + 2a76f66 commit 19d2bd4

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
---
22
bump: patch
33
type: add
4-
integrations: all
54
---
65

76
Add `nginx_port` configuration option. This configuration option can be used to customize the port on which the AppSignal integration exposes [the NGINX metrics server](https://docs.appsignal.com/metrics/nginx.html).

src/appsignal/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class Options(TypedDict, total=False):
3838
log_level: str | None
3939
log_path: str | None
4040
logging_endpoint: str | None
41+
nginx_port: str | int | None
4142
opentelemetry_port: str | int | None
4243
name: str | None
4344
push_api_key: str | None
@@ -184,6 +185,7 @@ def load_from_environment() -> Options:
184185
log_level=os.environ.get("APPSIGNAL_LOG_LEVEL"),
185186
log_path=os.environ.get("APPSIGNAL_LOG_PATH"),
186187
logging_endpoint=os.environ.get("APPSIGNAL_LOGGING_ENDPOINT"),
188+
nginx_port=os.environ.get("APPSIGNAL_NGINX_PORT"),
187189
opentelemetry_port=os.environ.get("APPSIGNAL_OPENTELEMETRY_PORT"),
188190
name=os.environ.get("APPSIGNAL_APP_NAME"),
189191
push_api_key=os.environ.get("APPSIGNAL_PUSH_API_KEY"),
@@ -252,6 +254,7 @@ def set_private_environ(self) -> None:
252254
"_APPSIGNAL_LOG_LEVEL": options.get("log_level"),
253255
"_APPSIGNAL_LOG_FILE_PATH": self.log_file_path(),
254256
"_APPSIGNAL_LOGGING_ENDPOINT": options.get("logging_endpoint"),
257+
"_APPSIGNAL_NGINX_PORT": options.get("nginx_port"),
255258
"_APPSIGNAL_OPENTELEMETRY_PORT": options.get("opentelemetry_port"),
256259
"_APPSIGNAL_PUSH_API_KEY": options.get("push_api_key"),
257260
"_APPSIGNAL_PUSH_API_ENDPOINT": options.get("endpoint"),

src/appsignal/opentelemetry.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
AggregationTemporality,
2020
PeriodicExportingMetricReader,
2121
)
22-
from opentelemetry.sdk.resources import Resource
22+
from opentelemetry.sdk.resources import Resource # type: ignore[attr-defined]
2323
from opentelemetry.sdk.trace import ConcurrentMultiSpanProcessor, TracerProvider
2424
from opentelemetry.sdk.trace.export import (
2525
BatchSpanProcessor,

tests/test_config.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def test_environ_source():
6464
os.environ["APPSIGNAL_IGNORE_NAMESPACES"] = "namespace1,namespace2"
6565
os.environ["APPSIGNAL_LOG_LEVEL"] = "trace"
6666
os.environ["APPSIGNAL_LOG_PATH"] = "/path/to/log_dir"
67+
os.environ["APPSIGNAL_NGINX_PORT"] = "8080"
6768
os.environ["APPSIGNAL_OPENTELEMETRY_PORT"] = "9002"
6869
os.environ["APPSIGNAL_PUSH_API_KEY"] = "some-api-key"
6970
os.environ["APPSIGNAL_PUSH_API_ENDPOINT"] = "https://push.appsignal.com"
@@ -100,6 +101,7 @@ def test_environ_source():
100101
ignore_namespaces=["namespace1", "namespace2"],
101102
log_level="trace",
102103
log_path="/path/to/log_dir",
104+
nginx_port="8080",
103105
opentelemetry_port="9002",
104106
name="MyApp",
105107
push_api_key="some-api-key",
@@ -198,6 +200,7 @@ def test_set_private_environ():
198200
ignore_namespaces=["namespace1", "namespace2"],
199201
log_level="trace",
200202
log_path=cwdir,
203+
nginx_port=8080,
201204
opentelemetry_port=9002,
202205
name="MyApp",
203206
push_api_key="some-api-key",
@@ -235,6 +238,7 @@ def test_set_private_environ():
235238
assert os.environ["_APPSIGNAL_IGNORE_NAMESPACES"] == "namespace1,namespace2"
236239
assert os.environ["_APPSIGNAL_LOG_LEVEL"] == "trace"
237240
assert os.environ["_APPSIGNAL_LOG_FILE_PATH"] == f"{cwdir}/appsignal.log"
241+
assert os.environ["_APPSIGNAL_NGINX_PORT"] == "8080"
238242
assert os.environ["_APPSIGNAL_OPENTELEMETRY_PORT"] == "9002"
239243
assert os.environ["_APPSIGNAL_PUSH_API_KEY"] == "some-api-key"
240244
assert os.environ["_APPSIGNAL_PUSH_API_ENDPOINT"] == "https://push.appsignal.com"

0 commit comments

Comments
 (0)