-
Notifications
You must be signed in to change notification settings - Fork 191
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #699 from psardana/prometheus_integration
* added initial config for prometheus integration in opal server * feat(data_update_publisher.py): add data_update_latency metric to track latency of data update events feat(prometheus_metrics.py): create data_update_latency histogram to monitor latency of data update events * refactor(api.py, data_update_publisher.py): update import paths for metrics to use opal_server.metrics.prometheus_metrics for better organization chore(requirements.txt): add prometheus_client to dependencies for metrics tracking functionality * feat(data_update_publisher.py): add data_update_count_per_topic metric to track updates per topic feat(prometheus_metrics.py): introduce data_update_count_per_topic counter for monitoring data updates by topic * feat(metrics): add new metrics for policy updates and bundle requests to enhance observability fix(api.py): increment policy bundle request count and measure latency for bundle generation fix(callbacks.py): observe size of changed directories in policy update notifications fix(task.py): track policy update count and latency when triggering policy watcher * moved prometheus metrics to opal common * scopes and security prometheus metrics added * added client metrics endpoint and total active clients metric * data topic subscribed by client * added token type in prometheus metric * added labels to the metrics for data and policy updates * added labels in token requests generations and errors * added more labels for prometheus metrics for scope * added metrics for opal client * added docker compose example with prometheus * fixed metric labels * added documentation * added open telemetry traces and metrics * added metrics and traces in documentation * added scope id as an attribute * renamed docker compose * fixed how span is being used * added documentation * fixed descriptions * removed top level code and protected metrics end point * fixes for tracing spans * fix metrics end point * fixed docker compose and removed logging exporter from otel * Fixed pre-commit --------- Co-authored-by: Dan Yishai <danyi1212@users.noreply.github.com>
- Loading branch information
Showing
26 changed files
with
938 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
services: | ||
broadcast_channel: | ||
image: postgres:alpine | ||
environment: | ||
- POSTGRES_DB=postgres | ||
- POSTGRES_USER=postgres | ||
- POSTGRES_PASSWORD=postgres | ||
volumes: | ||
- postgres_data:/var/lib/postgresql/data | ||
|
||
otel-collector: | ||
image: otel/opentelemetry-collector-contrib:0.114.0 | ||
volumes: | ||
- ./docker_files/otel-collector-config.yaml:/etc/otelcol/config.yaml | ||
command: ["--config", "/etc/otelcol/config.yaml"] | ||
ports: | ||
- "4317:4317" | ||
- "8888:8888" | ||
networks: | ||
- opal-network | ||
|
||
prometheus: | ||
image: prom/prometheus:v2.45.0 | ||
volumes: | ||
- ./docker_files/prometheus.yml:/etc/prometheus/prometheus.yml | ||
- prometheus_data:/prometheus | ||
ports: | ||
- "9090:9090" | ||
command: | ||
- '--config.file=/etc/prometheus/prometheus.yml' | ||
- '--storage.tsdb.path=/prometheus' | ||
- '--web.console.libraries=/etc/prometheus/console_libraries' | ||
- '--web.console.templates=/etc/prometheus/consoles' | ||
- '--web.enable-lifecycle' | ||
networks: | ||
- opal-network | ||
depends_on: | ||
- otel-collector | ||
|
||
grafana: | ||
image: grafana/grafana:9.5.3 | ||
ports: | ||
- "3000:3000" | ||
volumes: | ||
- grafana_data:/var/lib/grafana | ||
environment: | ||
- GF_SECURITY_ADMIN_PASSWORD=admin | ||
- GF_USERS_ALLOW_SIGN_UP=false | ||
depends_on: | ||
- prometheus | ||
networks: | ||
- opal-network | ||
|
||
opal_server: | ||
image: permitio/opal-server:latest | ||
environment: | ||
- OPAL_BROADCAST_URI=postgres://postgres:postgres@broadcast_channel:5432/postgres | ||
- UVICORN_NUM_WORKERS=4 | ||
- OPAL_POLICY_REPO_URL=https://github.com/permitio/opal-example-policy-repo | ||
- OPAL_POLICY_REPO_POLLING_INTERVAL=30 | ||
- OPAL_DATA_CONFIG_SOURCES={"config":{"entries":[{"url":"http://opal_server:7002/policy-data","topics":["policy_data"],"dst_path":"/static"}]}} | ||
- OPAL_LOG_FORMAT_INCLUDE_PID=true | ||
- OPAL_ENABLE_OPENTELEMETRY_TRACING=true | ||
- OPAL_ENABLE_OPENTELEMETRY_METRICS=true | ||
- OPAL_OPENTELEMETRY_OTLP_ENDPOINT="otel-collector:4317" | ||
ports: | ||
- "7002:7002" | ||
depends_on: | ||
- broadcast_channel | ||
- otel-collector | ||
networks: | ||
- opal-network | ||
|
||
opal_client: | ||
image: permitio/opal-client:latest | ||
environment: | ||
- OPAL_SERVER_URL=http://opal_server:7002 | ||
- OPAL_LOG_FORMAT_INCLUDE_PID=true | ||
- OPAL_INLINE_OPA_LOG_FORMAT=http | ||
ports: | ||
- "7766:7000" | ||
- "8181:8181" | ||
depends_on: | ||
- opal_server | ||
- otel-collector | ||
command: sh -c "exec ./wait-for.sh opal_server:7002 --timeout=20 -- ./start.sh" | ||
networks: | ||
- opal-network | ||
|
||
networks: | ||
opal-network: | ||
driver: bridge | ||
volumes: | ||
postgres_data: | ||
prometheus_data: | ||
grafana_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
endpoint: 0.0.0.0:4317 | ||
|
||
exporters: | ||
prometheus: | ||
endpoint: "0.0.0.0:8888" | ||
debug: | ||
verbosity: detailed | ||
|
||
processors: | ||
batch: | ||
|
||
service: | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [debug] | ||
metrics: | ||
receivers: [otlp] | ||
processors: [batch] | ||
exporters: [prometheus] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
global: | ||
scrape_interval: 15s | ||
evaluation_interval: 15s | ||
|
||
scrape_configs: | ||
- job_name: 'opal_server' | ||
static_configs: | ||
- targets: ['opal_server:7002'] | ||
metrics_path: '/metrics' | ||
|
||
- job_name: 'opal_client' | ||
static_configs: | ||
- targets: ['opal_client:7000'] | ||
metrics_path: '/metrics' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.