Merge pull request 'feature/icecheng/prometheus' (#8) from feature/icecheng/prometheus into dev
Reviewed-on: https://gitea.freeleaps.mathmast.com/products/freeleaps-authentication/pulls/8
This commit is contained in:
commit
a2b3e4e1aa
@ -18,4 +18,6 @@ data:
|
|||||||
MONGODB_PORT: {{ .Values.authentication.configs.mongodbPort | toString | b64enc }}
|
MONGODB_PORT: {{ .Values.authentication.configs.mongodbPort | toString | b64enc }}
|
||||||
METRICS_ENABLED: {{ .Values.authentication.configs.metricsEnabled | default false | toString | b64enc }}
|
METRICS_ENABLED: {{ .Values.authentication.configs.metricsEnabled | default false | toString | b64enc }}
|
||||||
PROBES_ENABLED: {{ .Values.authentication.configs.probesEnabled | default false | toString | b64enc }}
|
PROBES_ENABLED: {{ .Values.authentication.configs.probesEnabled | default false | toString | b64enc }}
|
||||||
|
FREELEAPS_PRODUCT_ID: { { .Values.authentication.configs.freeleapsProductId | b64enc | quote } }
|
||||||
|
ENVIRONMENT: { { .Values.authentication.configs.environment | b64enc | quote } }
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ authentication:
|
|||||||
registry: docker.io
|
registry: docker.io
|
||||||
repository: null
|
repository: null
|
||||||
name: 6901bcf4ed3725f39f11343d-authentication
|
name: 6901bcf4ed3725f39f11343d-authentication
|
||||||
tag: snapshot-ddcf8d8
|
tag: snapshot-e6b358e
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
@ -89,6 +89,8 @@ authentication:
|
|||||||
mongodbPort: 27017
|
mongodbPort: 27017
|
||||||
metricsEnabled: 'false'
|
metricsEnabled: 'false'
|
||||||
probesEnabled: 'true'
|
probesEnabled: 'true'
|
||||||
|
freeleapsProductId: 6901bcf4ed3725f39f11343d
|
||||||
|
environment: alpha
|
||||||
secrets:
|
secrets:
|
||||||
secretStoreRef:
|
secretStoreRef:
|
||||||
kind: FreeleapsSecretStore
|
kind: FreeleapsSecretStore
|
||||||
|
|||||||
@ -18,7 +18,7 @@ authentication:
|
|||||||
registry: docker.io
|
registry: docker.io
|
||||||
repository: null
|
repository: null
|
||||||
name: 6901bcf4ed3725f39f11343d-authentication
|
name: 6901bcf4ed3725f39f11343d-authentication
|
||||||
tag: snapshot-8584f90
|
tag: snapshot-9a7fa21
|
||||||
imagePullPolicy: IfNotPresent
|
imagePullPolicy: IfNotPresent
|
||||||
ports:
|
ports:
|
||||||
- name: http
|
- name: http
|
||||||
@ -97,6 +97,8 @@ authentication:
|
|||||||
mongodbPort: 27017
|
mongodbPort: 27017
|
||||||
metricsEnabled: 'true'
|
metricsEnabled: 'true'
|
||||||
probesEnabled: 'true'
|
probesEnabled: 'true'
|
||||||
|
freeleapsProductId: 6901bcf4ed3725f39f11343d
|
||||||
|
environment: prod
|
||||||
secrets:
|
secrets:
|
||||||
secretStoreRef:
|
secretStoreRef:
|
||||||
kind: FreeleapsSecretStore
|
kind: FreeleapsSecretStore
|
||||||
|
|||||||
@ -82,6 +82,8 @@ authentication:
|
|||||||
metricsEnabled: "false"
|
metricsEnabled: "false"
|
||||||
# PROBES_ENABLED
|
# PROBES_ENABLED
|
||||||
probesEnabled: "false"
|
probesEnabled: "false"
|
||||||
|
freeleapsProductId: ""
|
||||||
|
environment: alpha
|
||||||
# AKV secrets configuration
|
# AKV secrets configuration
|
||||||
secrets:
|
secrets:
|
||||||
secretStoreRef:
|
secretStoreRef:
|
||||||
|
|||||||
@ -25,6 +25,9 @@ ENV LOG_BASE_PATH=$CONTAINER_APP_ROOT/log/$APP_NAME
|
|||||||
ENV BACKEND_LOG_FILE_NAME=$APP_NAME
|
ENV BACKEND_LOG_FILE_NAME=$APP_NAME
|
||||||
ENV APPLICATION_ACTIVITY_LOG=$APP_NAME-activity
|
ENV APPLICATION_ACTIVITY_LOG=$APP_NAME-activity
|
||||||
|
|
||||||
|
ENV FREELEAPS_PRODUCT_ID="6901bcf4ed3725f39f11343d"
|
||||||
|
ENV ENVIRONMENT="alpha"
|
||||||
|
|
||||||
|
|
||||||
WORKDIR ${CONTAINER_APP_ROOT}
|
WORKDIR ${CONTAINER_APP_ROOT}
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
|
|||||||
@ -30,6 +30,9 @@ class AppSettings(BaseSettings):
|
|||||||
BACKEND_LOG_FILE_NAME: str = APP_NAME
|
BACKEND_LOG_FILE_NAME: str = APP_NAME
|
||||||
APPLICATION_ACTIVITY_LOG: str = APP_NAME + "-application-activity"
|
APPLICATION_ACTIVITY_LOG: str = APP_NAME + "-application-activity"
|
||||||
|
|
||||||
|
FREELEAPS_PRODUCT_ID: str = ""
|
||||||
|
ENVIRONMENT: str = ""
|
||||||
|
|
||||||
class Config:
|
class Config:
|
||||||
env_file = ".myapp.env"
|
env_file = ".myapp.env"
|
||||||
env_file_encoding = "utf-8"
|
env_file_encoding = "utf-8"
|
||||||
|
|||||||
@ -2,12 +2,14 @@ import logging
|
|||||||
from prometheus_fastapi_instrumentator import Instrumentator
|
from prometheus_fastapi_instrumentator import Instrumentator
|
||||||
from common.config.app_settings import app_settings
|
from common.config.app_settings import app_settings
|
||||||
|
|
||||||
def register(app):
|
|
||||||
instrumentator = Instrumentator().instrument(app,
|
|
||||||
metric_namespace="freeleaps",
|
|
||||||
metric_subsystem=app_settings.APP_NAME)
|
|
||||||
|
|
||||||
@app.on_event("startup")
|
def register(app):
|
||||||
async def startup():
|
instrumentator = Instrumentator().instrument(
|
||||||
instrumentator.expose(app, endpoint="/api/_/metrics", should_gzip=True)
|
app,
|
||||||
logging.info("Metrics endpoint exposed at /api/_/metrics")
|
metric_namespace="freeleaps_{}".format(app_settings.FREELEAPS_PRODUCT_ID),
|
||||||
|
metric_subsystem=app_settings.ENVIRONMENT)
|
||||||
|
|
||||||
|
@app.on_event("startup")
|
||||||
|
async def startup():
|
||||||
|
instrumentator.expose(app, endpoint="/api/_/metrics", should_gzip=True)
|
||||||
|
logging.info("Metrics endpoint exposed at /api/_/metrics")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user