diff --git a/.codecov.yml b/.codecov.yml index c710934efe..42c1d0733d 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -199,6 +199,10 @@ coverage: target: 75 flags: - sortdb + SpiceDB: + target: 75 + flags: + - spicedb Stardog: target: 70 flags: @@ -622,6 +626,11 @@ flags: paths: - speedtest/datadog_checks/speedtest - speedtest/tests + spicedb: + carryforward: true + paths: + - spicedb/datadog_checks/spicedb + - spicedb/tests stardog: carryforward: true paths: diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index de74b8c2f6..7c252e1e29 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1150,6 +1150,8 @@ /zilliz_cloud_zilliz_cloud/ @DataDog/ecosystems-review +/spicedb/ @tstirrat15 @DataDog/ecosystems-review + # LEAVE THE FOLLOWING LOG OWNERSHIP LAST IN THE FILE # Make sure logs team is the full owner for all logs related files **/assets/logs/ @DataDog/logs-backend @DataDog/logs-core diff --git a/.github/workflows/test-all.yml b/.github/workflows/test-all.yml index 6e80e01515..47dd2a46f5 100644 --- a/.github/workflows/test-all.yml +++ b/.github/workflows/test-all.yml @@ -1246,6 +1246,25 @@ jobs: test-py3: ${{ inputs.test-py3 }} setup-env-vars: "${{ inputs.setup-env-vars }}" secrets: inherit + jc9d4106: + uses: DataDog/integrations-core/.github/workflows/test-target.yml@master + with: + job-name: SpiceDB + target: spicedb + platform: linux + runner: '["ubuntu-22.04"]' + repo: "${{ inputs.repo }}" + python-version: "${{ inputs.python-version }}" + standard: ${{ inputs.standard }} + latest: ${{ inputs.latest }} + agent-image: "${{ inputs.agent-image }}" + agent-image-py2: "${{ inputs.agent-image-py2 }}" + agent-image-windows: "${{ inputs.agent-image-windows }}" + agent-image-windows-py2: "${{ inputs.agent-image-windows-py2 }}" + test-py2: ${{ inputs.test-py2 }} + test-py3: ${{ inputs.test-py3 }} + setup-env-vars: "${{ inputs.setup-env-vars }}" + secrets: inherit je0445d5: uses: DataDog/integrations-core/.github/workflows/test-target.yml@master with: diff --git a/spicedb/CHANGELOG.md b/spicedb/CHANGELOG.md new file mode 100644 index 0000000000..32092677ef --- /dev/null +++ b/spicedb/CHANGELOG.md @@ -0,0 +1,8 @@ +# CHANGELOG - SpiceDB + +## 1.0.0 / 2024-12-06 + +***Added***: + +* Initial Release + diff --git a/spicedb/README.md b/spicedb/README.md new file mode 100644 index 0000000000..bf496ac79c --- /dev/null +++ b/spicedb/README.md @@ -0,0 +1,77 @@ +# Agent Check: SpiceDB + +## Overview + +[SpiceDB][1] is an open source, [Google Zanzibar][zanzibar]-inspired database system for creating and managing security-critical application permissions. + +Developers create a schema that models their permissions requirements. Then, they use any of the official or community maintained client libraries to apply the schema to the database and insert data into the database. They can query the data to efficiently check permissions in their applications. + +SpiceDB metrics allow developers and SREs to monitor their SpiceDB deployments, including request latency metrics, cache metrics such as size and hit/miss metrics, and datastore connection and query metrics. These metrics allow developers and SREs to diagnose performance problems and tune performance characteristics of their SpiceDB clusters. + +## Setup + +### Installation + +#### Host-level installation +To install the SpiceDB check on your host: + +1. Download and install the [Datadog Agent][2]. +1. Install the SpiceDB integration on the Agent on the host where it's running. + ```shell + datadog-agent integration install -t datadog-spicedb== + ``` + +#### With the Agent sidecar container +1. Build a custom image with the Agent installed: + ```dockerfile + FROM gcr.io/datadoghq/agent:latest + RUN agent integration install -t datadog-spicedb== + # Optionally include the configuration in the image + COPY spicedb.yaml /conf.d/spicedb.d/conf.yaml + ``` +1. Deploy that image as a sidecar (or whatever makes sense for your topology). + +### Configuration + +A full list of configuration options are available in the [example configuration][example-conf]. +This integration wraps the Datadog Openmetrics configuration, so the [openmetrics documentation][openmentrics-docs] +may be helpful as well. + +### Validation + +[Run the Agent's status subcommand][6] and look for `spicedb` under the Checks section. + +## Data Collected + +### Metrics + +The integration collects metrics through the [SpiceDB prometheus endpoint][spicedb-prometheus]. + +For a full list of metrics this integration provides, see the [metadata.csv][metadata.csv] file. + +### Service Checks + +Service check `spicedb.openmetrics.health` is submitted in the base check. + +### Events + +SpiceDB does not include any events. + +## Troubleshooting + +Need help? Contact [Datadog support][3]. + +[1]: https://authzed.com/spicedb +[2]: https://app.datadoghq.com/account/settings/agent/latest +[3]: https://docs.datadoghq.com/agent/kubernetes/integrations/ +[4]: https://github.com/DataDog/integrations-extras/blob/master/spicedb/datadog_checks/spicedb/data/conf.yaml.example +[5]: https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent +[6]: https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information +[7]: https://github.com/DataDog/integrations-extras/blob/master/spicedb/metadata.csv +[8]: https://github.com/DataDog/integrations-extras/blob/master/spicedb/assets/service_checks.json +[9]: https://docs.datadoghq.com/help/ +[zanzibar]: https://authzed.com/zanzibar +[metadata.csv]: https://github.com/DataDog/integrations-extras/blob/master/spicedb/metadata.csv +[example-conf]: https://github.com/DataDog/integrations-extras/blob/master/spicedb/datadog_checks/spicedb/data/conf.yaml.example +[spicedb-prometheus]: https://authzed.com/docs/spicedb/ops/observability#prometheus +[openmetrics-docs]: https://docs.datadoghq.com/integrations/openmetrics/ diff --git a/spicedb/assets/configuration/spec.yaml b/spicedb/assets/configuration/spec.yaml new file mode 100644 index 0000000000..8147a5d722 --- /dev/null +++ b/spicedb/assets/configuration/spec.yaml @@ -0,0 +1,22 @@ +--- +name: "SpiceDB" +files: + - name: "spicedb.yaml" + options: + - template: "init_config" + options: + - template: "init_config/openmetrics" + - template: "instances" + options: + - template: "instances/openmetrics" + overrides: + openmetrics_endpoint.required: false + openmetrics_endpoint.value.example: "http://localhost:9090/metrics" + # This is required to make pXX graphs in the default dashboard. + histogram_buckets_as_distributions.value.example: true + tags.value.example: + - "node:" + - "cluster:" + - "region:" + - ":" + - ":" diff --git a/spicedb/assets/dashboards/spicedb_overview.json b/spicedb/assets/dashboards/spicedb_overview.json new file mode 100644 index 0000000000..1173010816 --- /dev/null +++ b/spicedb/assets/dashboards/spicedb_overview.json @@ -0,0 +1,1198 @@ +{ + "title": "SpiceDB Overview", + "description": "[[suggested_dashboards]]", + "widgets": [ + { + "id": 512625727012637, + "definition": { + "title": "New group", + "banner_img": "", + "show_title": false, + "type": "group", + "layout_type": "ordered", + "widgets": [ + { + "id": 790129298401198, + "definition": { + "type": "image", + "url": "https://design-authzed.vercel.app/images/Banners/SpiceDB-1600x400-Banner-Light.svg", + "url_dark_theme": "https://design-authzed.vercel.app/images/Banners/SpiceDB-1600x400-Banner.svg", + "sizing": "contain", + "has_background": false, + "has_border": false, + "vertical_align": "center", + "horizontal_align": "left" + }, + "layout": { + "x": 0, + "y": 0, + "width": 6, + "height": 2 + } + }, + { + "id": 5391176615093781, + "definition": { + "type": "note", + "content": "#### Optimize your SpiceDB integration configuration for monitoring\n\n1. Configure `cluster`, `node`, and `region` tags in your `spicedb.d/conf.yaml` file:\n\n\n ```\n instances:\n - openmetrics_endpoint: http://localhost:8080/_status/vars\n tags: [\"cluster:prod\", \"node:1\", \"region:us-east-1\"]\n - openmetrics_endpoint: http://localhost:8082/_status/vars\n tags: [\"cluster:dev\", \"node:1\", \"region:us-east-2\"]\n ```", + "background_color": "white", + "font_size": "14", + "text_align": "left", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": true + }, + "layout": { + "x": 6, + "y": 0, + "width": 6, + "height": 3 + } + }, + { + "id": 8404853868782660, + "definition": { + "type": "note", + "content": "This dashboard provides a high-level view of your SpiceDB cluster, including:\n- A high-level view of request performance & latency.\n- Information about resource consumption to help aid in capacity planning.", + "background_color": "transparent", + "font_size": "14", + "text_align": "left", + "vertical_align": "center", + "show_tick": false, + "tick_pos": "50%", + "tick_edge": "left", + "has_padding": false + }, + "layout": { + "x": 0, + "y": 2, + "width": 6, + "height": 1 + } + } + ] + }, + "layout": { + "x": 0, + "y": 0, + "width": 12, + "height": 4 + } + }, + { + "id": 3560130955990344, + "definition": { + "title": "Throughput", + "show_title": true, + "type": "group", + "layout_type": "ordered", + "widgets": [ + { + "id": 7615141942543467, + "definition": { + "title": "Total by RPC", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.grpc.server.handled.count{*}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "bars" + } + ] + }, + "layout": { + "x": 0, + "y": 0, + "width": 6, + "height": 3 + } + }, + { + "id": 3925663272929855, + "definition": { + "title": "Total by Consistency", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.grpc.server.handled.count{*}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "bars" + } + ] + }, + "layout": { + "x": 6, + "y": 0, + "width": 6, + "height": 3 + } + }, + { + "id": 364527830066764, + "definition": { + "title": "Check Operations", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.grpc.server.handled.count{grpc_method:checkpermission}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "bars" + } + ] + }, + "layout": { + "x": 0, + "y": 3, + "width": 6, + "height": 3 + } + }, + { + "id": 2823083366205463, + "definition": { + "title": "Lookup Operations", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.grpc.server.handled.count{grpc_method in (lookupsubjects ,lookupresources )} by {grpc_method}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "bars" + } + ] + }, + "layout": { + "x": 6, + "y": 3, + "width": 6, + "height": 3 + } + }, + { + "id": 279197301579739, + "definition": { + "title": "Relationship Operations", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.grpc.server.handled.count{grpc_method in (readrelationships ,writerelationships ,deleterelationships )} by {grpc_method}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "bars" + } + ] + }, + "layout": { + "x": 0, + "y": 6, + "width": 6, + "height": 3 + } + }, + { + "id": 3380816430782344, + "definition": { + "title": "Schema Operations", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.grpc.server.handled.count{grpc_method in (writeschema ,readschema)} by {grpc_method}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "bars" + } + ] + }, + "layout": { + "x": 6, + "y": 6, + "width": 6, + "height": 3 + } + } + ] + }, + "layout": { + "x": 0, + "y": 4, + "width": 12, + "height": 10 + } + }, + { + "id": 4793433791679627, + "definition": { + "title": "Latency", + "show_title": true, + "type": "group", + "layout_type": "ordered", + "widgets": [ + { + "id": 863409587490583, + "definition": { + "title": "Checks", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: CheckPermission", + "formula": "query1" + }, + { + "alias": "p95: CheckPermission", + "formula": "query2" + }, + { + "alias": "p95: CheckPermission", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:checkpermission}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:checkpermission}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:checkpermission}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 0, + "y": 0, + "width": 6, + "height": 3 + } + }, + { + "id": 6076165849438225, + "definition": { + "title": "Bulk Checks", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: CheckBulkPermission", + "formula": "query1" + }, + { + "alias": "p95: CheckBulkPermission", + "formula": "query2" + }, + { + "alias": "p99: CheckBulkPermission", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method in (checkbulkpermission, bulkcheckpermission)}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method in (checkbulkpermission, bulkcheckpermission)}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method in (checkbulkpermission, bulkcheckpermission)}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 6, + "y": 0, + "width": 6, + "height": 3 + } + }, + { + "id": 5409060165861238, + "definition": { + "title": "ReadRelationships", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: ReadRelationships", + "formula": "query1" + }, + { + "alias": "p95: WriteRelationships", + "formula": "query2" + }, + { + "alias": "p99: WriteRelationships", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:readrelationships}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:readrelationships}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:readrelationships}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 0, + "y": 3, + "width": 6, + "height": 3 + } + }, + { + "id": 4680938480636664, + "definition": { + "title": "WriteRelationships", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: WriteRelationships", + "formula": "query1" + }, + { + "alias": "p95: WriteRelationships", + "formula": "query2" + }, + { + "alias": "p99: WriteRelationships", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:writerelationships}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:writerelationships}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:writerelationships}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 6, + "y": 3, + "width": 6, + "height": 3 + } + }, + { + "id": 7324769101390434, + "definition": { + "title": "DeleteRelationships", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: DeleteRelationships", + "formula": "query1" + }, + { + "alias": "p95: DeleteRelationships", + "formula": "query2" + }, + { + "alias": "p99: DeleteRelationships", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:deleterelationships}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:deleterelationships}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:deleterelationships}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 0, + "y": 6, + "width": 6, + "height": 3 + } + }, + { + "id": 2497504251532424, + "definition": { + "title": "ExpandPermissionTree", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: ExpandPermissionTree", + "formula": "query1" + }, + { + "alias": "p95: ExpandPermissionTree", + "formula": "query2" + }, + { + "alias": "p99: ExpandPermissionTree", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:expandpermissiontree}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:expandpermissiontree}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:expandpermissiontree}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 6, + "y": 6, + "width": 6, + "height": 3 + } + }, + { + "id": 8307194191289555, + "definition": { + "title": "LookupResources", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: LookupResources", + "formula": "query1" + }, + { + "alias": "p95: LookupResources", + "formula": "query2" + }, + { + "alias": "p99: LookupResources", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:lookupresources}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:lookupresources}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:lookupresources}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 0, + "y": 9, + "width": 6, + "height": 3 + } + }, + { + "id": 8169958283522599, + "definition": { + "title": "LookupSubjects", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: LookupSubjects", + "formula": "query1" + }, + { + "alias": "p95: LookupSubjects", + "formula": "query2" + }, + { + "alias": "p99: LookupSubjects", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:lookupsubjects}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:lookupsubjects}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:lookupsubjects}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 6, + "y": 9, + "width": 6, + "height": 3 + } + }, + { + "id": 4835192591489553, + "definition": { + "title": "ReadSchema", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: ReadSchema", + "formula": "query1" + }, + { + "alias": "p95: ReadSchema", + "formula": "query2" + }, + { + "alias": "p99: ReadSchema", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:readschema}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:readschema}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:readschema}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 0, + "y": 12, + "width": 6, + "height": 3 + } + }, + { + "id": 1786825540718652, + "definition": { + "title": "WriteSchema", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "p50: WriteSchema", + "formula": "query1" + }, + { + "alias": "p95: WriteSchema", + "formula": "query2" + }, + { + "alias": "p99: WriteSchema", + "formula": "query3" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "p50:spicedb.grpc.server.handling{grpc_method:writeschema}" + }, + { + "name": "query2", + "data_source": "metrics", + "query": "p95:spicedb.grpc.server.handling{grpc_method:writeschema}" + }, + { + "name": "query3", + "data_source": "metrics", + "query": "p99:spicedb.grpc.server.handling{grpc_method:writeschema}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 6, + "y": 12, + "width": 6, + "height": 3 + } + } + ] + }, + "layout": { + "x": 0, + "y": 14, + "width": 12, + "height": 16, + "is_column_break": true + } + }, + { + "id": 1969543100199273, + "definition": { + "title": "Node", + "show_title": true, + "type": "group", + "layout_type": "ordered", + "widgets": [ + { + "id": 3363586656686623, + "definition": { + "title": "vCPU", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "CPU %", + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "sum:spicedb.process.cpu.seconds.count{*} by {host}.as_rate()" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ], + "markers": [] + }, + "layout": { + "x": 0, + "y": 0, + "width": 6, + "height": 3 + } + }, + { + "id": 5592139522821831, + "definition": { + "title": "Memory", + "title_size": "16", + "title_align": "left", + "show_legend": true, + "legend_layout": "auto", + "legend_columns": [ + "avg", + "min", + "max", + "value", + "sum" + ], + "type": "timeseries", + "requests": [ + { + "formulas": [ + { + "alias": "Memory Usage", + "formula": "query1" + } + ], + "queries": [ + { + "name": "query1", + "data_source": "metrics", + "query": "avg:spicedb.process.virtual_memory_bytes{*} by {host}" + } + ], + "response_format": "timeseries", + "style": { + "palette": "dog_classic", + "order_by": "values", + "line_type": "solid", + "line_width": "normal" + }, + "display_type": "line" + } + ] + }, + "layout": { + "x": 6, + "y": 0, + "width": 6, + "height": 3 + } + } + ] + }, + "layout": { + "x": 0, + "y": 30, + "width": 12, + "height": 4 + } + } + ], + "template_variables": [], + "layout_type": "ordered", + "notify_list": [], + "reflow_type": "fixed" +} diff --git a/spicedb/assets/service_checks.json b/spicedb/assets/service_checks.json new file mode 100644 index 0000000000..216ce85ac5 --- /dev/null +++ b/spicedb/assets/service_checks.json @@ -0,0 +1,33 @@ +[ + { + "agent_version": "7.34.0", + "integration": "SpiceDB", + "check": "spicedb.openmetrics.health", + "statuses": [ + "ok", + "critical" + ], + "groups": [ + "host", + "endpoint" + ], + "name": "SpiceDB OpenMetrics endpoint up", + "description": "Returns `CRITICAL` if the check cannot access the OpenMetrics metrics endpoint of SpiceDB." + }, + { + "agent_version": "7.19.0", + "integration": "SpiceDB", + "check": "spicedb.prometheus.health", + "statuses": [ + "ok", + "critical" + ], + "groups": [ + "host", + "endpoint" + ], + "name": "SpiceDB Prometheus endpoint up", + "description": "Returns `CRITICAL` if the check cannot access the Prometheus metrics endpoint of SpiceDB." + } +] + diff --git a/spicedb/datadog_checks/__init__.py b/spicedb/datadog_checks/__init__.py new file mode 100644 index 0000000000..0d1f7edf5d --- /dev/null +++ b/spicedb/datadog_checks/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) # type: ignore diff --git a/spicedb/datadog_checks/spicedb/__about__.py b/spicedb/datadog_checks/spicedb/__about__.py new file mode 100644 index 0000000000..5becc17c04 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/__about__.py @@ -0,0 +1 @@ +__version__ = "1.0.0" diff --git a/spicedb/datadog_checks/spicedb/__init__.py b/spicedb/datadog_checks/spicedb/__init__.py new file mode 100644 index 0000000000..359d395907 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/__init__.py @@ -0,0 +1,4 @@ +from .__about__ import __version__ +from .check import SpicedbCheck + +__all__ = ['__version__', 'SpicedbCheck'] diff --git a/spicedb/datadog_checks/spicedb/check.py b/spicedb/datadog_checks/spicedb/check.py new file mode 100644 index 0000000000..0023c04cfa --- /dev/null +++ b/spicedb/datadog_checks/spicedb/check.py @@ -0,0 +1,27 @@ +""" +A SpiceDB metrics check for the Datadog agent. + +Borrows heavily from the CockroachDB check in integrations-core. +""" + +from datadog_checks.base import OpenMetricsBaseCheckV2 + +from .config_models import ConfigMixin +from .metrics import METRICS_CONFIG + + +class SpicedbCheck(OpenMetricsBaseCheckV2, ConfigMixin): + # This will be the prefix of every metric and service check the integration sends + __NAMESPACE__ = "spicedb" + + def get_default_config(self): + """ + Provides a default configuration. Anything configured by the user overrides this, + but this is where we provide the metrics definitions used by the scraper. + """ + return { + # TODO: this is technically the prometheus endpoint, not the openmetrics endpoint + # Need to see if that'll be a problem. + "openmetrics_endpoint": "http://localhost:9090/metrics", + "metrics": METRICS_CONFIG, + } diff --git a/spicedb/datadog_checks/spicedb/config_models/__init__.py b/spicedb/datadog_checks/spicedb/config_models/__init__.py new file mode 100644 index 0000000000..5c2bf5c9f4 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/config_models/__init__.py @@ -0,0 +1,20 @@ +# This file is autogenerated. +# To change this file you should edit assets/configuration/spec.yaml and then run the following commands: +# ddev -x validate config -s +# ddev -x validate models -s + +from .instance import InstanceConfig +from .shared import SharedConfig + + +class ConfigMixin: + _config_model_instance: InstanceConfig + _config_model_shared: SharedConfig + + @property + def config(self) -> InstanceConfig: + return self._config_model_instance + + @property + def shared_config(self) -> SharedConfig: + return self._config_model_shared diff --git a/spicedb/datadog_checks/spicedb/config_models/defaults.py b/spicedb/datadog_checks/spicedb/config_models/defaults.py new file mode 100644 index 0000000000..f6ed9749d8 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/config_models/defaults.py @@ -0,0 +1,132 @@ +# This file is autogenerated. +# To change this file you should edit assets/configuration/spec.yaml and then run the following commands: +# ddev -x validate config -s +# ddev -x validate models -s + + +def shared_skip_proxy(): + return False + + +def shared_timeout(): + return 10 + + +def instance_allow_redirects(): + return True + + +def instance_auth_type(): + return "basic" + + +def instance_cache_metric_wildcards(): + return True + + +def instance_cache_shared_labels(): + return True + + +def instance_collect_counters_with_distributions(): + return False + + +def instance_collect_histogram_buckets(): + return True + + +def instance_disable_generic_tags(): + return False + + +def instance_empty_default_hostname(): + return False + + +def instance_enable_health_service_check(): + return True + + +def instance_histogram_buckets_as_distributions(): + return True + + +def instance_ignore_connection_errors(): + return False + + +def instance_kerberos_auth(): + return "disabled" + + +def instance_kerberos_delegate(): + return False + + +def instance_kerberos_force_initiate(): + return False + + +def instance_log_requests(): + return False + + +def instance_min_collection_interval(): + return 15 + + +def instance_non_cumulative_histogram_buckets(): + return False + + +def instance_openmetrics_endpoint(): + return "http://localhost:9090/metrics" + + +def instance_persist_connections(): + return False + + +def instance_request_size(): + return 16 + + +def instance_skip_proxy(): + return False + + +def instance_tag_by_endpoint(): + return True + + +def instance_telemetry(): + return False + + +def instance_timeout(): + return 10 + + +def instance_tls_ignore_warning(): + return False + + +def instance_tls_use_host_header(): + return False + + +def instance_tls_verify(): + return True + + +def instance_use_latest_spec(): + return False + + +def instance_use_legacy_auth_encoding(): + return True + + +def instance_use_process_start_time(): + return False diff --git a/spicedb/datadog_checks/spicedb/config_models/instance.py b/spicedb/datadog_checks/spicedb/config_models/instance.py new file mode 100644 index 0000000000..5c7be53cf7 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/config_models/instance.py @@ -0,0 +1,167 @@ +# This file is autogenerated. +# To change this file you should edit assets/configuration/spec.yaml and then run the following commands: +# ddev -x validate config -s +# ddev -x validate models -s + +from __future__ import annotations + +from types import MappingProxyType +from typing import Any, Optional, Union + +from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator + +from datadog_checks.base.utils.functions import identity +from datadog_checks.base.utils.models import validation + +from . import defaults, validators + + +class AuthToken(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + frozen=True, + ) + reader: Optional[MappingProxyType[str, Any]] = None + writer: Optional[MappingProxyType[str, Any]] = None + + +class ExtraMetrics(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + extra="allow", + frozen=True, + ) + name: Optional[str] = None + type: Optional[str] = None + + +class MetricPatterns(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + frozen=True, + ) + exclude: Optional[tuple[str, ...]] = None + include: Optional[tuple[str, ...]] = None + + +class Metrics(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + extra="allow", + frozen=True, + ) + name: Optional[str] = None + type: Optional[str] = None + + +class Proxy(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + frozen=True, + ) + http: Optional[str] = None + https: Optional[str] = None + no_proxy: Optional[tuple[str, ...]] = None + + +class ShareLabels(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + frozen=True, + ) + labels: Optional[tuple[str, ...]] = None + match: Optional[tuple[str, ...]] = None + + +class InstanceConfig(BaseModel): + model_config = ConfigDict( + validate_default=True, + arbitrary_types_allowed=True, + frozen=True, + ) + allow_redirects: Optional[bool] = None + auth_token: Optional[AuthToken] = None + auth_type: Optional[str] = None + aws_host: Optional[str] = None + aws_region: Optional[str] = None + aws_service: Optional[str] = None + cache_metric_wildcards: Optional[bool] = None + cache_shared_labels: Optional[bool] = None + collect_counters_with_distributions: Optional[bool] = None + collect_histogram_buckets: Optional[bool] = None + connect_timeout: Optional[float] = None + disable_generic_tags: Optional[bool] = None + empty_default_hostname: Optional[bool] = None + enable_health_service_check: Optional[bool] = None + exclude_labels: Optional[tuple[str, ...]] = None + exclude_metrics: Optional[tuple[str, ...]] = None + exclude_metrics_by_labels: Optional[MappingProxyType[str, Union[bool, tuple[str, ...]]]] = None + extra_headers: Optional[MappingProxyType[str, Any]] = None + extra_metrics: Optional[tuple[Union[str, MappingProxyType[str, Union[str, ExtraMetrics]]], ...]] = None + headers: Optional[MappingProxyType[str, Any]] = None + histogram_buckets_as_distributions: Optional[bool] = None + hostname_format: Optional[str] = None + hostname_label: Optional[str] = None + ignore_connection_errors: Optional[bool] = None + ignore_tags: Optional[tuple[str, ...]] = None + include_labels: Optional[tuple[str, ...]] = None + kerberos_auth: Optional[str] = None + kerberos_cache: Optional[str] = None + kerberos_delegate: Optional[bool] = None + kerberos_force_initiate: Optional[bool] = None + kerberos_hostname: Optional[str] = None + kerberos_keytab: Optional[str] = None + kerberos_principal: Optional[str] = None + log_requests: Optional[bool] = None + metric_patterns: Optional[MetricPatterns] = None + metrics: Optional[tuple[Union[str, MappingProxyType[str, Union[str, Metrics]]], ...]] = None + min_collection_interval: Optional[float] = None + namespace: Optional[str] = Field(None, pattern="\\w*") + non_cumulative_histogram_buckets: Optional[bool] = None + ntlm_domain: Optional[str] = None + openmetrics_endpoint: Optional[str] = None + password: Optional[str] = None + persist_connections: Optional[bool] = None + proxy: Optional[Proxy] = None + raw_line_filters: Optional[tuple[str, ...]] = None + raw_metric_prefix: Optional[str] = None + read_timeout: Optional[float] = None + rename_labels: Optional[MappingProxyType[str, Any]] = None + request_size: Optional[float] = None + service: Optional[str] = None + share_labels: Optional[MappingProxyType[str, Union[bool, ShareLabels]]] = None + skip_proxy: Optional[bool] = None + tag_by_endpoint: Optional[bool] = None + tags: Optional[tuple[str, ...]] = None + telemetry: Optional[bool] = None + timeout: Optional[float] = None + tls_ca_cert: Optional[str] = None + tls_cert: Optional[str] = None + tls_ignore_warning: Optional[bool] = None + tls_private_key: Optional[str] = None + tls_protocols_allowed: Optional[tuple[str, ...]] = None + tls_use_host_header: Optional[bool] = None + tls_verify: Optional[bool] = None + use_latest_spec: Optional[bool] = None + use_legacy_auth_encoding: Optional[bool] = None + use_process_start_time: Optional[bool] = None + username: Optional[str] = None + + @model_validator(mode="before") + def _initial_validation(cls, values): + return validation.core.initialize_config(getattr(validators, "initialize_instance", identity)(values)) + + @field_validator("*", mode="before") + def _validate(cls, value, info): + field = cls.model_fields[info.field_name] + field_name = field.alias or info.field_name + if field_name in info.context["configured_fields"]: + value = getattr(validators, f"instance_{info.field_name}", identity)(value, field=field) + else: + value = getattr(defaults, f"instance_{info.field_name}", lambda: value)() + + return validation.utils.make_immutable(value) + + @model_validator(mode="after") + def _final_validation(cls, model): + return validation.core.check_model(getattr(validators, "check_instance", identity)(model)) diff --git a/spicedb/datadog_checks/spicedb/config_models/shared.py b/spicedb/datadog_checks/spicedb/config_models/shared.py new file mode 100644 index 0000000000..0966d4e69f --- /dev/null +++ b/spicedb/datadog_checks/spicedb/config_models/shared.py @@ -0,0 +1,56 @@ +# This file is autogenerated. +# To change this file you should edit assets/configuration/spec.yaml and then run the following commands: +# ddev -x validate config -s +# ddev -x validate models -s + +from __future__ import annotations + +from typing import Optional + +from pydantic import BaseModel, ConfigDict, field_validator, model_validator + +from datadog_checks.base.utils.functions import identity +from datadog_checks.base.utils.models import validation + +from . import defaults, validators + + +class Proxy(BaseModel): + model_config = ConfigDict( + arbitrary_types_allowed=True, + frozen=True, + ) + http: Optional[str] = None + https: Optional[str] = None + no_proxy: Optional[tuple[str, ...]] = None + + +class SharedConfig(BaseModel): + model_config = ConfigDict( + validate_default=True, + arbitrary_types_allowed=True, + frozen=True, + ) + proxy: Optional[Proxy] = None + service: Optional[str] = None + skip_proxy: Optional[bool] = None + timeout: Optional[float] = None + + @model_validator(mode="before") + def _initial_validation(cls, values): + return validation.core.initialize_config(getattr(validators, "initialize_shared", identity)(values)) + + @field_validator("*", mode="before") + def _validate(cls, value, info): + field = cls.model_fields[info.field_name] + field_name = field.alias or info.field_name + if field_name in info.context["configured_fields"]: + value = getattr(validators, f"shared_{info.field_name}", identity)(value, field=field) + else: + value = getattr(defaults, f"shared_{info.field_name}", lambda: value)() + + return validation.utils.make_immutable(value) + + @model_validator(mode="after") + def _final_validation(cls, model): + return validation.core.check_model(getattr(validators, "check_shared", identity)(model)) diff --git a/spicedb/datadog_checks/spicedb/config_models/validators.py b/spicedb/datadog_checks/spicedb/config_models/validators.py new file mode 100644 index 0000000000..39523e4f92 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/config_models/validators.py @@ -0,0 +1,9 @@ +# Here you can include additional config validators or transformers +# +# def initialize_instance(values, **kwargs): +# if 'my_option' not in values and 'my_legacy_option' in values: +# values['my_option'] = values['my_legacy_option'] +# if values.get('my_number') > 10: +# raise ValueError('my_number max value is 10, got %s' % str(values.get('my_number'))) +# +# return values diff --git a/spicedb/datadog_checks/spicedb/data/conf.yaml.example b/spicedb/datadog_checks/spicedb/data/conf.yaml.example new file mode 100644 index 0000000000..0d7068dec5 --- /dev/null +++ b/spicedb/datadog_checks/spicedb/data/conf.yaml.example @@ -0,0 +1,629 @@ +## All options defined here are available to all instances. +# +init_config: + + ## @param proxy - mapping - optional + ## Set HTTP or HTTPS proxies for all instances. Use the `no_proxy` list + ## to specify hosts that must bypass proxies. + ## + ## The SOCKS protocol is also supported like so: + ## + ## socks5://user:pass@host:port + ## + ## Using the scheme `socks5` causes the DNS resolution to happen on the + ## client, rather than on the proxy server. This is in line with `curl`, + ## which uses the scheme to decide whether to do the DNS resolution on + ## the client or proxy. If you want to resolve the domains on the proxy + ## server, use `socks5h` as the scheme. + # + # proxy: + # http: http://: + # https: https://: + # no_proxy: + # - + # - + + ## @param skip_proxy - boolean - optional - default: false + ## If set to `true`, this makes the check bypass any proxy + ## settings enabled and attempt to reach services directly. + # + # skip_proxy: false + + ## @param timeout - number - optional - default: 10 + ## The timeout for connecting to services. + # + # timeout: 10 + + ## @param service - string - optional + ## Attach the tag `service:` to every metric, event, and service check emitted by this integration. + ## + ## Additionally, this sets the default `service` for every log source. + # + # service: + +## Every instance is scheduled independently of the others. +# +instances: + + - + ## @param openmetrics_endpoint - string - optional - default: http://localhost:9090/metrics + ## The URL exposing metrics in the OpenMetrics format. + # + # openmetrics_endpoint: http://localhost:9090/metrics + + ## @param raw_metric_prefix - string - optional + ## A prefix that is removed from all exposed metric names, if present. + ## All configuration options will use the prefix-less name. + # + # raw_metric_prefix: _ + + ## @param extra_metrics - (list of string or mapping) - optional + ## This list defines metrics to collect from the `openmetrics_endpoint`, in addition to + ## what the check collects by default. If the check already collects a metric, then + ## metric definitions here take precedence. Metrics may be defined in 3 ways: + ## + ## 1. If the item is a string, then it represents the exposed metric name, and + ## the sent metric name will be identical. For example: + ## + ## extra_metrics: + ## - + ## - + ## 2. If the item is a mapping, then the keys represent the exposed metric names. + ## + ## a. If a value is a string, then it represents the sent metric name. For example: + ## + ## extra_metrics: + ## - : + ## - : + ## b. If a value is a mapping, then it must have a `name` and/or `type` key. + ## The `name` represents the sent metric name, and the `type` represents how + ## the metric should be handled, overriding any type information the endpoint + ## may provide. For example: + ## + ## extra_metrics: + ## - : + ## name: + ## type: + ## - : + ## name: + ## type: + ## + ## The supported native types are `gauge`, `counter`, `histogram`, and `summary`. + ## + ## Note: To collect counter metrics with names ending in `_total`, specify the metric name without the `_total` + ## suffix. For example, to collect the counter metric `promhttp_metric_handler_requests_total`, specify + ## `promhttp_metric_handler_requests`. This submits to Datadog the metric name appended with `.count`. + ## For more information, see: + ## https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#suffixes + ## + ## Regular expressions may be used to match the exposed metric names, for example: + ## + ## extra_metrics: + ## - ^network_(ingress|egress)_.+ + ## - .+: + ## type: gauge + # + # extra_metrics: [] + + ## @param exclude_metrics - list of strings - optional + ## A list of metrics to exclude, with each entry being either + ## the exact metric name or a regular expression. + ## In order to exclude all metrics but the ones matching a specific filter, + ## you can use a negative lookahead regex like: + ## - ^(?!foo).*$ + # + # exclude_metrics: [] + + ## @param exclude_metrics_by_labels - mapping - optional + ## A mapping of labels to exclude metrics with matching label name and their corresponding metric values. To match + ## all values of a label, set it to `true`. + ## + ## Note: Label filtering happens before `rename_labels`. + ## + ## For example, the following configuration instructs the check to exclude all metrics with + ## a label `worker` or a label `pid` with the value of either `23` or `42`. + ## + ## exclude_metrics_by_labels: + ## worker: true + ## pid: + ## - '23' + ## - '42' + # + # exclude_metrics_by_labels: {} + + ## @param exclude_labels - list of strings - optional + ## A list of labels to exclude, useful for high cardinality values like timestamps or UUIDs. + ## May be used in conjunction with `include_labels`. + ## Labels defined in `exclude_labels` will take precedence in case of overlap. + ## + ## Note: Label filtering happens before `rename_labels`. + # + # exclude_labels: [] + + ## @param include_labels - list of strings - optional + ## A list of labels to include. May be used in conjunction with `exclude_labels`. + ## Labels defined in `exclude_labels` will take precedence in case of overlap. + ## + ## Note: Label filtering happens before `rename_labels`. + # + # include_labels: [] + + ## @param rename_labels - mapping - optional + ## A mapping of label names to their new names. + # + # rename_labels: + # : + # : + + ## @param enable_health_service_check - boolean - optional - default: true + ## Whether or not to send a service check named `.openmetrics.health` which reports + ## the health of the `openmetrics_endpoint`. + # + # enable_health_service_check: true + + ## @param ignore_connection_errors - boolean - optional - default: false + ## Whether or not to ignore connection errors when scraping `openmetrics_endpoint`. + # + # ignore_connection_errors: false + + ## @param hostname_label - string - optional + ## Override the hostname for every metric submission with the value of one of its labels. + # + # hostname_label: + + ## @param hostname_format - string - optional + ## When `hostname_label` is set, this instructs the check how to format the values. The string + ## `` is replaced by the value of the label defined by `hostname_label`. + # + # hostname_format: + + ## @param collect_histogram_buckets - boolean - optional - default: true + ## Whether or not to send histogram buckets. + # + # collect_histogram_buckets: true + + ## @param non_cumulative_histogram_buckets - boolean - optional - default: false + ## Whether or not histogram buckets are non-cumulative and to come with a `lower_bound` tag. + # + # non_cumulative_histogram_buckets: false + + ## @param histogram_buckets_as_distributions - boolean - optional - default: true + ## Whether or not to send histogram buckets as Datadog distribution metrics. This implicitly + ## enables the `collect_histogram_buckets` and `non_cumulative_histogram_buckets` options. + ## + ## Learn more about distribution metrics: + ## https://docs.datadoghq.com/developers/metrics/types/?tab=distribution#metric-types + # + # histogram_buckets_as_distributions: true + + ## @param collect_counters_with_distributions - boolean - optional - default: false + ## Whether or not to also collect the observation counter metrics ending in `.sum` and `.count` + ## when sending histogram buckets as Datadog distribution metrics. This implicitly enables the + ## `histogram_buckets_as_distributions` option. + # + # collect_counters_with_distributions: false + + ## @param use_process_start_time - boolean - optional - default: false + ## Whether to enable a heuristic for reporting counter values on the first scrape. When true, + ## the first time an endpoint is scraped, check `process_start_time_seconds` to decide whether zero + ## initial value can be assumed for counters. This requires keeping metrics in memory until the entire + ## response is received. + # + # use_process_start_time: false + + ## @param share_labels - mapping - optional + ## This mapping allows for the sharing of labels across multiple metrics. The keys represent the + ## exposed metrics from which to share labels, and the values are mappings that configure the + ## sharing behavior. Each mapping must have at least one of the following keys: + ## + ## labels - This is a list of labels to share. All labels are shared if this is not set. + ## match - This is a list of labels to match on other metrics as a condition for sharing. + ## values - This is a list of allowed values as a condition for sharing. + ## + ## To unconditionally share all labels of a metric, set it to `true`. + ## + ## For example, the following configuration instructs the check to apply all labels from `metric_a` + ## to all other metrics, the `node` label from `metric_b` to only those metrics that have a `pod` + ## label value that matches the `pod` label value of `metric_b`, and all labels from `metric_c` + ## to all other metrics if their value is equal to `23` or `42`. + ## + ## share_labels: + ## metric_a: true + ## metric_b: + ## labels: + ## - node + ## match: + ## - pod + ## metric_c: + ## values: + ## - 23 + ## - 42 + # + # share_labels: {} + + ## @param cache_shared_labels - boolean - optional - default: true + ## When `share_labels` is set, it instructs the check to cache labels collected from the first payload + ## for improved performance. + ## + ## Set this to `false` to compute label sharing for every payload at the risk of potentially increased memory usage. + # + # cache_shared_labels: true + + ## @param raw_line_filters - list of strings - optional + ## A list of regular expressions used to exclude lines read from the `openmetrics_endpoint` + ## from being parsed. + # + # raw_line_filters: [] + + ## @param cache_metric_wildcards - boolean - optional - default: true + ## Whether or not to cache data from metrics that are defined by regular expressions rather + ## than the full metric name. + # + # cache_metric_wildcards: true + + ## @param telemetry - boolean - optional - default: false + ## Whether or not to submit metrics prefixed by `.telemetry.` for debugging purposes. + # + # telemetry: false + + ## @param ignore_tags - list of strings - optional + ## A list of regular expressions used to ignore tags added by Autodiscovery and entries in the `tags` option. + # + # ignore_tags: + # - + # - + # - + + ## @param proxy - mapping - optional + ## This overrides the `proxy` setting in `init_config`. + ## + ## Set HTTP or HTTPS proxies for this instance. Use the `no_proxy` list + ## to specify hosts that must bypass proxies. + ## + ## The SOCKS protocol is also supported, for example: + ## + ## socks5://user:pass@host:port + ## + ## Using the scheme `socks5` causes the DNS resolution to happen on the + ## client, rather than on the proxy server. This is in line with `curl`, + ## which uses the scheme to decide whether to do the DNS resolution on + ## the client or proxy. If you want to resolve the domains on the proxy + ## server, use `socks5h` as the scheme. + # + # proxy: + # http: http://: + # https: https://: + # no_proxy: + # - + # - + + ## @param skip_proxy - boolean - optional - default: false + ## This overrides the `skip_proxy` setting in `init_config`. + ## + ## If set to `true`, this makes the check bypass any proxy + ## settings enabled and attempt to reach services directly. + # + # skip_proxy: false + + ## @param auth_type - string - optional - default: basic + ## The type of authentication to use. The available types (and related options) are: + ## + ## - basic + ## |__ username + ## |__ password + ## |__ use_legacy_auth_encoding + ## - digest + ## |__ username + ## |__ password + ## - ntlm + ## |__ ntlm_domain + ## |__ password + ## - kerberos + ## |__ kerberos_auth + ## |__ kerberos_cache + ## |__ kerberos_delegate + ## |__ kerberos_force_initiate + ## |__ kerberos_hostname + ## |__ kerberos_keytab + ## |__ kerberos_principal + ## - aws + ## |__ aws_region + ## |__ aws_host + ## |__ aws_service + ## + ## The `aws` auth type relies on boto3 to automatically gather AWS credentials, for example: from `.aws/credentials`. + ## Details: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#configuring-credentials + # + # auth_type: basic + + ## @param use_legacy_auth_encoding - boolean - optional - default: true + ## When `auth_type` is set to `basic`, this determines whether to encode as `latin1` rather than `utf-8`. + # + # use_legacy_auth_encoding: true + + ## @param username - string - optional + ## The username to use if services are behind basic or digest auth. + # + # username: + + ## @param password - string - optional + ## The password to use if services are behind basic or NTLM auth. + # + # password: + + ## @param ntlm_domain - string - optional + ## If your services use NTLM authentication, specify + ## the domain used in the check. For NTLM Auth, append + ## the username to domain, not as the `username` parameter. + # + # ntlm_domain: \ + + ## @param kerberos_auth - string - optional - default: disabled + ## If your services use Kerberos authentication, you can specify the Kerberos + ## strategy to use between: + ## + ## - required + ## - optional + ## - disabled + ## + ## See https://github.com/requests/requests-kerberos#mutual-authentication + # + # kerberos_auth: disabled + + ## @param kerberos_cache - string - optional + ## Sets the KRB5CCNAME environment variable. + ## It should point to a credential cache with a valid TGT. + # + # kerberos_cache: + + ## @param kerberos_delegate - boolean - optional - default: false + ## Set to `true` to enable Kerberos delegation of credentials to a server that requests delegation. + ## + ## See https://github.com/requests/requests-kerberos#delegation + # + # kerberos_delegate: false + + ## @param kerberos_force_initiate - boolean - optional - default: false + ## Set to `true` to preemptively initiate the Kerberos GSS exchange and + ## present a Kerberos ticket on the initial request (and all subsequent). + ## + ## See https://github.com/requests/requests-kerberos#preemptive-authentication + # + # kerberos_force_initiate: false + + ## @param kerberos_hostname - string - optional + ## Override the hostname used for the Kerberos GSS exchange if its DNS name doesn't + ## match its Kerberos hostname, for example: behind a content switch or load balancer. + ## + ## See https://github.com/requests/requests-kerberos#hostname-override + # + # kerberos_hostname: + + ## @param kerberos_principal - string - optional + ## Set an explicit principal, to force Kerberos to look for a + ## matching credential cache for the named user. + ## + ## See https://github.com/requests/requests-kerberos#explicit-principal + # + # kerberos_principal: + + ## @param kerberos_keytab - string - optional + ## Set the path to your Kerberos key tab file. + # + # kerberos_keytab: + + ## @param auth_token - mapping - optional + ## This allows for the use of authentication information from dynamic sources. + ## Both a reader and writer must be configured. + ## + ## The available readers are: + ## + ## - type: file + ## path (required): The absolute path for the file to read from. + ## pattern: A regular expression pattern with a single capture group used to find the + ## token rather than using the entire file, for example: Your secret is (.+) + ## - type: oauth + ## url (required): The token endpoint. + ## client_id (required): The client identifier. + ## client_secret (required): The client secret. + ## basic_auth: Whether the provider expects credentials to be transmitted in + ## an HTTP Basic Auth header. The default is: false + ## options: Mapping of additional options to pass to the provider, such as the audience + ## or the scope. For example: + ## options: + ## audience: https://example.com + ## scope: read:example + ## + ## The available writers are: + ## + ## - type: header + ## name (required): The name of the field, for example: Authorization + ## value: The template value, for example `Bearer `. The default is: + ## placeholder: The substring in `value` to replace with the token, defaults to: + # + # auth_token: + # reader: + # type: + # : + # : + # writer: + # type: + # : + # : + + ## @param aws_region - string - optional + ## If your services require AWS Signature Version 4 signing, set the region. + ## + ## See https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html + # + # aws_region: + + ## @param aws_host - string - optional + ## If your services require AWS Signature Version 4 signing, set the host. + ## This only needs the hostname and does not require the protocol (HTTP, HTTPS, and more). + ## For example, if connecting to https://us-east-1.amazonaws.com/, set `aws_host` to `us-east-1.amazonaws.com`. + ## + ## Note: This setting is not necessary for official integrations. + ## + ## See https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html + # + # aws_host: + + ## @param aws_service - string - optional + ## If your services require AWS Signature Version 4 signing, set the service code. For a list + ## of available service codes, see https://docs.aws.amazon.com/general/latest/gr/rande.html + ## + ## Note: This setting is not necessary for official integrations. + ## + ## See https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html + # + # aws_service: + + ## @param tls_verify - boolean - optional - default: true + ## Instructs the check to validate the TLS certificate of services. + # + # tls_verify: true + + ## @param tls_use_host_header - boolean - optional - default: false + ## If a `Host` header is set, this enables its use for SNI (matching against the TLS certificate CN or SAN). + # + # tls_use_host_header: false + + ## @param tls_ignore_warning - boolean - optional - default: false + ## If `tls_verify` is disabled, security warnings are logged by the check. + ## Disable those by setting `tls_ignore_warning` to true. + # + # tls_ignore_warning: false + + ## @param tls_cert - string - optional + ## The path to a single file in PEM format containing a certificate as well as any + ## number of CA certificates needed to establish the certificate's authenticity for + ## use when connecting to services. It may also contain an unencrypted private key to use. + # + # tls_cert: + + ## @param tls_private_key - string - optional + ## The unencrypted private key to use for `tls_cert` when connecting to services. This is + ## required if `tls_cert` is set and it does not already contain a private key. + # + # tls_private_key: + + ## @param tls_ca_cert - string - optional + ## The path to a file of concatenated CA certificates in PEM format or a directory + ## containing several CA certificates in PEM format. If a directory, the directory + ## must have been processed using the `openssl rehash` command. See: + ## https://www.openssl.org/docs/man3.2/man1/c_rehash.html + # + # tls_ca_cert: + + ## @param tls_protocols_allowed - list of strings - optional + ## The expected versions of TLS/SSL when fetching intermediate certificates. + ## Only `SSLv3`, `TLSv1.2`, `TLSv1.3` are allowed by default. The possible values are: + ## SSLv3 + ## TLSv1 + ## TLSv1.1 + ## TLSv1.2 + ## TLSv1.3 + # + # tls_protocols_allowed: + # - SSLv3 + # - TLSv1.2 + # - TLSv1.3 + + ## @param headers - mapping - optional + ## The headers parameter allows you to send specific headers with every request. + ## You can use it for explicitly specifying the host header or adding headers for + ## authorization purposes. + ## + ## This overrides any default headers. + # + # headers: + # Host: + # X-Auth-Token: + + ## @param extra_headers - mapping - optional + ## Additional headers to send with every request. + # + # extra_headers: + # Host: + # X-Auth-Token: + + ## @param timeout - number - optional - default: 10 + ## The timeout for accessing services. + ## + ## This overrides the `timeout` setting in `init_config`. + # + # timeout: 10 + + ## @param connect_timeout - number - optional + ## The connect timeout for accessing services. Defaults to `timeout`. + # + # connect_timeout: + + ## @param read_timeout - number - optional + ## The read timeout for accessing services. Defaults to `timeout`. + # + # read_timeout: + + ## @param request_size - number - optional - default: 16 + ## The number of kibibytes (KiB) to read from streaming HTTP responses at a time. + # + # request_size: 16 + + ## @param log_requests - boolean - optional - default: false + ## Whether or not to debug log the HTTP(S) requests made, including the method and URL. + # + # log_requests: false + + ## @param persist_connections - boolean - optional - default: false + ## Whether or not to persist cookies and use connection pooling for improved performance. + # + # persist_connections: false + + ## @param allow_redirects - boolean - optional - default: true + ## Whether or not to allow URL redirection. + # + # allow_redirects: true + + ## @param tags - list of strings - optional + ## A list of tags to attach to every metric and service check emitted by this instance. + ## + ## Learn more about tagging at https://docs.datadoghq.com/tagging + # + # tags: + # - node: + # - cluster: + # - region: + # - : + # - : + + ## @param service - string - optional + ## Attach the tag `service:` to every metric, event, and service check emitted by this integration. + ## + ## Overrides any `service` defined in the `init_config` section. + # + # service: + + ## @param min_collection_interval - number - optional - default: 15 + ## This changes the collection interval of the check. For more information, see: + ## https://docs.datadoghq.com/developers/write_agent_check/#collection-interval + # + # min_collection_interval: 15 + + ## @param empty_default_hostname - boolean - optional - default: false + ## This forces the check to send metrics with no hostname. + ## + ## This is useful for cluster-level checks. + # + # empty_default_hostname: false + + ## @param metric_patterns - mapping - optional + ## A mapping of metrics to include or exclude, with each entry being a regular expression. + ## + ## Metrics defined in `exclude` will take precedence in case of overlap. + # + # metric_patterns: + # include: + # - + # exclude: + # - diff --git a/spicedb/datadog_checks/spicedb/metrics.py b/spicedb/datadog_checks/spicedb/metrics.py new file mode 100644 index 0000000000..6a59512a5b --- /dev/null +++ b/spicedb/datadog_checks/spicedb/metrics.py @@ -0,0 +1,88 @@ +""" +A definition of the metrics publicly exposed in SpiceDB. +""" + +from itertools import chain + +# For the metrics, the key is the SpiceDB name and the +# value is the Datadog name. They're manually rewritten +# because Datadog likes dot-separated names and SpiceDB +# likes underscore-separated names. + +# For all spicedb_ prefixed metrics, we make the prefix +# `application.` because all of these metrics will come in +# with a `spicedb.` prefix. + +COUNTER_METRICS = { + # SpiceDB counter metrics + "spicedb_cache_cost_added_bytes": "application.cache.cost_added", + "spicedb_cache_cost_evicted_bytes": "application.cache.cost_evicted", + "spicedb_cache_hits_total": "application.cache.hits", + "spicedb_cache_misses_total": "application.cache.misses", + "spicedb_datastore_hedgeable_requests_total": "application.datastore.hedgeable_requests", + "spicedb_datastore_hedged_requests_total": "application.datastore.hedged_requests", + "spicedb_dispatch_client_check_from_cache_total": "application.dispatch_client.check_from_cache", + "spicedb_dispatch_client_check_total": "application.dispatch_client.check", + "spicedb_dispatch_client_lookup_resources_from_cache_total": "application.dispatch_client.lookup_resources_from_cache", # noqa: E501 + "spicedb_dispatch_client_lookup_resources_total": "application.dispatch_client.lookup_resources", + "spicedb_dispatch_client_lookup_subjects_from_cache_total": "application.dispatch_client.lookup_subjects_from_cache", # noqa: E501 + "spicedb_dispatch_client_lookup_subjects_total": "application.dispatch_client.lookup_subjects", + "spicedb_dispatch_client_reachable_resources_from_cache_total": "application.dispatch_client.reachable_resources_from_cache", # noqa: E501 + "spicedb_dispatch_client_reachable_resources_total": "application.dispatch_client.reachable_resources", + # gRPC counter metrics + "grpc_server_handled_total": "grpc.server.handled", + "grpc_server_msg_received_total": "grpc.server.msg_received", + "grpc_server_msg_sent_total": "grpc.server.msg_sent", + "grpc_server_started_total": "grpc.server.started", + # process counter metrics + "process_cpu_seconds_total": "process.cpu.seconds", +} + +GAUGE_METRICS = { + # SpiceDB gauge metrics + "spicedb_datastore_watching_schema_cache_caveats_fallback_mode": "application.datastore.watching_schema_cache.caveats_fallback_mode", # noqa: E501 + "spicedb_datastore_watching_schema_cache_namespaces_fallback_mode": "application.datastore.watching_schema_cache.namespaces_fallback_mode", # noqa: E501 + "spicedb_datastore_watching_schema_cache_tracked_revision": "application.datastore.watching_schema_cache.tracked_revision", # noqa: E501 + # process gauge metrics + "process_virtual_memory_bytes": "process.virtual_memory_bytes", +} + +HISTOGRAM_METRICS = { + # SpiceDB histogram metrics + "spicedb_check_direct_dispatch_query_count": "application.check.direct_dispatch_query_count", + "spicedb_check_dispatch_chunk_count": "application.check.dispatch_chunk_count", + "spicedb_datastore_crdb_watch_retries": "application.datastore.crdb_watch_retries", + "spicedb_datastore_loaded_relationships_count": "application.datastore.loaded_relationships_count", + "spicedb_datastore_query_latency": "application.datastore.query_latency", + "spicedb_datastore_spanner_watch_retries": "application.datastore.spanner_watch_retries", + "spicedb_services_dispatches": "application.services.dispatches", + # gRPC histogram metrics + "grpc_server_handling_seconds": "grpc.server.handling_seconds", +} + + +def construct_counter_metric_config(raw: str, dotted: str): + """ + Transforms openmetrics configuration names into names that datadog likes. + """ + + # Datadog doesn't like _total as a suffix on openmetrics + # counter metrics, so we remove it + return {raw.removesuffix("_total"): {"name": dotted, "type": "counter"}} + + +def construct_gauge_metric_config(raw: str, dotted: str): + return {raw: {"name": dotted, "type": "gauge"}} + + +def construct_histogram_metric_config(raw: str, dotted: str): + return {raw: {"name": dotted, "type": "histogram"}} + + +METRICS_CONFIG: list[dict[str, dict[str, str]]] = list( + chain( + (construct_counter_metric_config(raw, dotted) for raw, dotted in COUNTER_METRICS.items()), + (construct_gauge_metric_config(raw, dotted) for raw, dotted in GAUGE_METRICS.items()), + (construct_histogram_metric_config(raw, dotted) for raw, dotted in HISTOGRAM_METRICS.items()), + ) +) diff --git a/spicedb/hatch.toml b/spicedb/hatch.toml new file mode 100644 index 0000000000..defd1217c2 --- /dev/null +++ b/spicedb/hatch.toml @@ -0,0 +1,8 @@ +[env.collectors.datadog-checks] + +[[envs.default.matrix]] +python = ["3.12"] + +[envs.default.env-vars] +SPICEDB_VERSION = "latest" +DDEV_SKIP_GENERIC_TAGS_CHECK = "true" diff --git a/spicedb/images/dashboard.png b/spicedb/images/dashboard.png new file mode 100644 index 0000000000..9b245c6887 Binary files /dev/null and b/spicedb/images/dashboard.png differ diff --git a/spicedb/images/hero.png b/spicedb/images/hero.png new file mode 100644 index 0000000000..f55a6f2557 Binary files /dev/null and b/spicedb/images/hero.png differ diff --git a/spicedb/images/schema-visualization.png b/spicedb/images/schema-visualization.png new file mode 100644 index 0000000000..48891c634c Binary files /dev/null and b/spicedb/images/schema-visualization.png differ diff --git a/spicedb/images/schema.png b/spicedb/images/schema.png new file mode 100644 index 0000000000..22d735133d Binary files /dev/null and b/spicedb/images/schema.png differ diff --git a/spicedb/manifest.json b/spicedb/manifest.json new file mode 100644 index 0000000000..db01f2b80e --- /dev/null +++ b/spicedb/manifest.json @@ -0,0 +1,76 @@ +{ + "manifest_version": "2.0.0", + "app_uuid": "3084d0f4-cf4c-493f-9a0d-5754555da0b2", + "app_id": "spicedb", + "display_on_public_website": true, + "tile": { + "overview": "README.md#Overview", + "configuration": "README.md#Setup", + "support": "README.md#Support", + "changelog": "CHANGELOG.md", + "description": "SpiceDB is an open source database system for creating and managing security-critical application permissions.", + "title": "SpiceDB", + "media": [ + { + "media_type": "image", + "caption": "SpiceDB in a nutshell", + "image_url": "images/hero.png" + }, + { + "media_type": "image", + "caption": "A SpiceDB schema in our playground schema editor", + "image_url": "images/schema.png" + }, + { + "media_type": "image", + "caption": "A visualization of a SpiceDB schema", + "image_url": "images/schema-visualization.png" + }, + { + "media_type": "image", + "caption": "A preview of the SpiceDB Datadog Dashboard", + "image_url": "images/dashboard.png" + } + ], + "classifier_tags": [ + "Supported OS::Linux", + "Supported OS::Windows", + "Supported OS::macOS", + "Category::Cloud", + "Offering::Integration", + "Submitted Data Type::Metrics" + ] + }, + "assets": { + "integration": { + "auto_install": true, + "source_type_id": 31725454, + "source_type_name": "SpiceDB", + "configuration": { + "spec": "assets/configuration/spec.yaml" + }, + "events": { + "creates_events": false + }, + "metrics": { + "prefix": "spicedb.", + "check": "", + "metadata_path": "metadata.csv" + }, + "service_checks": { + "metadata_path": "assets/service_checks.json" + } + }, + "dashboards": { + "SpiceDB Overview": "assets/dashboards/spicedb_overview.json" + }, + "monitors": {}, + "saved_views": {} + }, + "author": { + "support_email": "support@authzed.com", + "name": "Tanner Stirrat", + "homepage": "https://authzed.com/spicedb", + "sales_email": "sales@authzed.com" + } +} diff --git a/spicedb/metadata.csv b/spicedb/metadata.csv new file mode 100644 index 0000000000..0b4d2ce2d2 --- /dev/null +++ b/spicedb/metadata.csv @@ -0,0 +1,32 @@ +metric_name,metric_type,interval,unit_name,per_unit_name,description,orientation,integration,short_name,curated_metric,sample_tags +spicedb.application.cache.cost_added.count,count,,byte,,Cost of entries added to the cache,0,spicedb,spicedb.application.cache.cost_added.count,, +spicedb.application.cache.cost_evicted.count,count,,byte,,Cost of entries evicted from the cache,0,spicedb,spicedb.application.cache.cost_evicted.count,, +spicedb.application.cache.hits.count,count,,hit,,Number of cache hits,1,spicedb,spicedb.application.cache.hits.count,, +spicedb.application.cache.misses.count,count,,miss,,Number of cache misses,-1,spicedb,spicedb.application.cache.misses.count,, +spicedb.application.datastore.hedgeable_requests.count,count,,request,,Total number of datastore requests which are eligible for hedging,0,spicedb,spicedb.application.datastore.hedgeable_requests.count,, +spicedb.application.datastore.hedged_requests.count,count,,request,,Total number of requests which have been hedged,0,spicedb,spicedb.application.datastore.hedged_requests.count,, +spicedb.application.dispatch_client.check_from_cache.count,count,,request,,Total number of Check dispatches served by the cache,1,spicedb,spicedb.application.dispatch_client.check_from_cache.count,, +spicedb.application.dispatch_client.check.count,count,,request,,Total number of Check dispatches,0,spicedb,spicedb.application.dispatch_client.check.count,, +spicedb.application.dispatch_client.lookup_resources_from_cache.count,count,,request,,Total number of LookupResources dispatches served from the cache,1,spicedb,spicedb.application.dispatch_client.lookup_resources_from_cache.count,, +spicedb.application.dispatch_client.lookup_resources.count,count,,request,,Total number of LookupResources dispatches,0,spicedb,spicedb.application.dispatch_client.lookup_resources.count,, +spicedb.application.dispatch_client.lookup_subjects_from_cache.count,count,,request,,Total number of LookupSubjects dispatches served from the cache,1,spicedb,spicedb.application.dispatch_client.lookup_subjects_from_cache.count,, +spicedb.application.dispatch_client.lookup_subjects.count,count,,request,,Total number of LookupSubjects dispatches,0,spicedb,spicedb.application.dispatch_client.lookup_subjects.count,, +spicedb.application.dispatch_client.reachable_resources_from_cache.count,count,,resource,,Total number of ReachableResources dispatches served from the cache,1,spicedb,spicedb.application.dispatch_client.reachable_resources_from_cache.count,, +spicedb.application.dispatch_client.reachable_resources.count,count,,resource,,Total number of ReachableResources dispatches,0,spicedb,spicedb.application.dispatch_client.reachable_resources.count,, +spicedb.grpc.server.handled.count,count,,request,,"Total number of RPCs completed on the server, regardless of success or failure.",0,spicedb,spicedb.grpc.server.handled.count,, +spicedb.grpc.server.msg_received.count,count,,message,,Total number of RPC stream messages received on the server.,0,spicedb,spicedb.grpc.server.msg_received.count,, +spicedb.grpc.server.msg_sent.count,count,,message,,Total number of gRPC stream messages sent by the server.,0,spicedb,spicedb.grpc.server.msg_sent.count,, +spicedb.grpc.server.started.count,count,,request,,Total number of RPCs started on the server.,0,spicedb,spicedb.grpc.server.started.count,, +spicedb.process.cpu.seconds.count,count,,second,,Total user and system CPU time spent in seconds.,0,spicedb,spicedb.process.cpu.seconds.count,, +spicedb.application.datastore.watching_schema_cache.caveats_fallback_mode,gauge,,,,Value of 1 if the cache is in fallback mode and 0 otherwise,0,spicedb,spicedb.application.datastore.watching_schema_cache.caveats_fallback_mode,, +spicedb.application.datastore.watching_schema_cache.namespaces_fallback_mode,gauge,,,,Value of 1 if the cache is in fallback mode and 0 otherwise,0,spicedb,spicedb.application.datastore.watching_schema_cache.namespaces_fallback_mode,, +spicedb.application.datastore.watching_schema_cache.tracked_revision,gauge,,,,The currently tracked max revision for the schema cache,0,spicedb,spicedb.application.datastore.watching_schema_cache.tracked_revision,, +spicedb.process.virtual_memory_bytes,gauge,,byte,,Virtual memory size in bytes.,0,spicedb,spicedb.process.virtual_memory_bytes,, +spicedb.application.check.direct_dispatch_query_count,distribution,,query,,Number of queries made per direct dispatch,0,spicedb,spicedb.application.check.direct_dispatch_query_count,, +spicedb.application.check.dispatch_chunk_count,distribution,,,,Number of chunks when dispatching in check,0,spicedb,spicedb.application.check.dispatch_chunk_count,, +spicedb.application.datastore.crdb_watch_retries,distribution,,,,Watch retry distribution,0,spicedb,spicedb.application.datastore.crdb_watch_retries,, +spicedb.application.datastore.loaded_relationships_count,distribution,,payload,,Total number of relationships loaded for a query,0,spicedb,spicedb.application.datastore.loaded_relationships_count,, +spicedb.application.datastore.query_latency,distribution,,second,,Response latency for a database query,-1,spicedb,spicedb.application.datastore.query_latency,, +spicedb.application.datastore.spanner_watch_retries,distribution,,,,Watch retry distribution,0,spicedb,spicedb.application.datastore.spanner_watch_retries,, +spicedb.application.services.dispatches,distribution,,request,,Distribution of cluster dispatches performed by the instance.,0,spicedb,spicedb.application.services.dispatches,, +spicedb.grpc.server.handling_seconds,distribution,,second,,Distribution of response latency (seconds) of gRPC that had been application-level handled by the server.,-1,spicedb,spicedb.grpc.server.handling_seconds,, diff --git a/spicedb/pyproject.toml b/spicedb/pyproject.toml new file mode 100644 index 0000000000..50366d98b2 --- /dev/null +++ b/spicedb/pyproject.toml @@ -0,0 +1,63 @@ +[build-system] +requires = [ + "hatchling>=0.13.0", +] +build-backend = "hatchling.build" + +[project] +name = "datadog-spicedb" +description = "The SpiceDB check" +readme = "README.md" +license = "BSD-3-Clause" +requires-python = ">=3.12" +keywords = [ + "datadog", + "datadog agent", + "datadog check", + "spicedb", +] +authors = [ + { name = "Tanner Stirrat", email = "support@authzed.com" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Intended Audience :: System Administrators", + "License :: OSI Approved :: BSD License", + "Private :: Do Not Upload", + "Programming Language :: Python :: 3.12", + "Topic :: System :: Monitoring", +] +dependencies = [ + "datadog-checks-base>=37.0.0", +] +dynamic = [ + "version", +] + +[project.optional-dependencies] +test = [ +"authzed" +] +deps = [] + +[project.urls] +Source = "https://github.com/DataDog/integrations-extras" + +[tool.hatch.version] +path = "datadog_checks/spicedb/__about__.py" + +[tool.hatch.build.targets.sdist] +include = [ + "/datadog_checks", + "/tests", + "/manifest.json", +] + +[tool.hatch.build.targets.wheel] +include = [ + "/datadog_checks/spicedb", +] +dev-mode-dirs = [ + ".", +] diff --git a/spicedb/tests/__init__.py b/spicedb/tests/__init__.py new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/spicedb/tests/__init__.py @@ -0,0 +1 @@ + diff --git a/spicedb/tests/conftest.py b/spicedb/tests/conftest.py new file mode 100644 index 0000000000..8f69084dc3 --- /dev/null +++ b/spicedb/tests/conftest.py @@ -0,0 +1,29 @@ +import os + +import pytest + +from datadog_checks.dev import docker_run, get_here + +from .util import HOST, PORT + + +@pytest.fixture(scope="session") +def dd_environment(instance): + env_vars = {"SPICEDB_GRPC_PRESHARED_KEY": "somerandomkey"} + + with docker_run( + os.path.join(get_here(), "docker", "docker-compose.yml"), + env_vars=env_vars, + endpoints=instance["openmetrics_endpoint"], + conditions=None, + ): + yield instance + + +@pytest.fixture(scope="session") +def instance(): + return { + "openmetrics_endpoint": "http://{}:{}/metrics".format(HOST, PORT), + "histogram_buckets_as_distributions": True, + "tags": ["cluster:spicedb-cluster", "node:1"], + } diff --git a/spicedb/tests/docker/docker-compose.yml b/spicedb/tests/docker/docker-compose.yml new file mode 100644 index 0000000000..de5d390a04 --- /dev/null +++ b/spicedb/tests/docker/docker-compose.yml @@ -0,0 +1,25 @@ +--- +name: "spicedb" + +services: + spicedb: + image: "authzed/spicedb:v1.38.1" + command: "serve" + environment: + SPICEDB_GRPC_PRESHARED_KEY: ${SPICEDB_GRPC_PRESHARED_KEY} + ports: + - "9090:9090" + thumper: + image: "authzed/thumper" + command: "run --endpoint spicedb:50051 --token ${SPICEDB_GRPC_PRESHARED_KEY} /scripts/example.yaml" + depends_on: + - "spicedb" + - "thumper-init" + thumper-init: + image: "authzed/thumper" + command: "migrate --endpoint spicedb:50051 --token ${SPICEDB_GRPC_PRESHARED_KEY} /scripts/schema.yaml" + # Restarting on failure should mean that the init reattempts until it succeeds + restart: "on-failure" + depends_on: + spicedb: + condition: "service_started" diff --git a/spicedb/tests/fixtures/all_metrics.txt b/spicedb/tests/fixtures/all_metrics.txt new file mode 100644 index 0000000000..23bfe679cc --- /dev/null +++ b/spicedb/tests/fixtures/all_metrics.txt @@ -0,0 +1,788 @@ +# HELP crdb_client_resets cockroachdb client-side tx reset distribution +# TYPE crdb_client_resets histogram +crdb_client_resets_bucket{le="0"} 0 +crdb_client_resets_bucket{le="1"} 0 +crdb_client_resets_bucket{le="2"} 0 +crdb_client_resets_bucket{le="5"} 0 +crdb_client_resets_bucket{le="10"} 0 +crdb_client_resets_bucket{le="20"} 0 +crdb_client_resets_bucket{le="50"} 0 +crdb_client_resets_bucket{le="+Inf"} 0 +crdb_client_resets_sum 0 +crdb_client_resets_count 0 +# HELP crdb_healthy_nodes the number of healthy crdb nodes detected by spicedb +# TYPE crdb_healthy_nodes gauge +crdb_healthy_nodes 0 +# HELP go_cgo_go_to_c_calls_calls_total Count of calls made from Go to C by the current process. Sourced from /cgo/go-to-c-calls:calls +# TYPE go_cgo_go_to_c_calls_calls_total counter +go_cgo_go_to_c_calls_calls_total 0 +# HELP go_cpu_classes_gc_mark_assist_cpu_seconds_total Estimated total CPU time goroutines spent performing GC tasks to assist the GC and prevent it from falling behind the application. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/gc/mark/assist:cpu-seconds +# TYPE go_cpu_classes_gc_mark_assist_cpu_seconds_total counter +go_cpu_classes_gc_mark_assist_cpu_seconds_total 0.001753435 +# HELP go_cpu_classes_gc_mark_dedicated_cpu_seconds_total Estimated total CPU time spent performing GC tasks on processors (as defined by GOMAXPROCS) dedicated to those tasks. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/gc/mark/dedicated:cpu-seconds +# TYPE go_cpu_classes_gc_mark_dedicated_cpu_seconds_total counter +go_cpu_classes_gc_mark_dedicated_cpu_seconds_total 0.03961781 +# HELP go_cpu_classes_gc_mark_idle_cpu_seconds_total Estimated total CPU time spent performing GC tasks on spare CPU resources that the Go scheduler could not otherwise find a use for. This should be subtracted from the total GC CPU time to obtain a measure of compulsory GC CPU time. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/gc/mark/idle:cpu-seconds +# TYPE go_cpu_classes_gc_mark_idle_cpu_seconds_total counter +go_cpu_classes_gc_mark_idle_cpu_seconds_total 0.031616581 +# HELP go_cpu_classes_gc_pause_cpu_seconds_total Estimated total CPU time spent with the application paused by the GC. Even if only one thread is running during the pause, this is computed as GOMAXPROCS times the pause latency because nothing else can be executing. This is the exact sum of samples in /sched/pauses/total/gc:seconds if each sample is multiplied by GOMAXPROCS at the time it is taken. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/gc/pause:cpu-seconds +# TYPE go_cpu_classes_gc_pause_cpu_seconds_total counter +go_cpu_classes_gc_pause_cpu_seconds_total 0.007634338 +# HELP go_cpu_classes_gc_total_cpu_seconds_total Estimated total CPU time spent performing GC tasks. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sum of all metrics in /cpu/classes/gc. Sourced from /cpu/classes/gc/total:cpu-seconds +# TYPE go_cpu_classes_gc_total_cpu_seconds_total counter +go_cpu_classes_gc_total_cpu_seconds_total 0.080622164 +# HELP go_cpu_classes_idle_cpu_seconds_total Estimated total available CPU time not spent executing any Go or Go runtime code. In other words, the part of /cpu/classes/total:cpu-seconds that was unused. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/idle:cpu-seconds +# TYPE go_cpu_classes_idle_cpu_seconds_total counter +go_cpu_classes_idle_cpu_seconds_total 2508.887356225 +# HELP go_cpu_classes_scavenge_assist_cpu_seconds_total Estimated total CPU time spent returning unused memory to the underlying platform in response eagerly in response to memory pressure. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/scavenge/assist:cpu-seconds +# TYPE go_cpu_classes_scavenge_assist_cpu_seconds_total counter +go_cpu_classes_scavenge_assist_cpu_seconds_total 2.67e-07 +# HELP go_cpu_classes_scavenge_background_cpu_seconds_total Estimated total CPU time spent performing background tasks to return unused memory to the underlying platform. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/scavenge/background:cpu-seconds +# TYPE go_cpu_classes_scavenge_background_cpu_seconds_total counter +go_cpu_classes_scavenge_background_cpu_seconds_total 1.06e-07 +# HELP go_cpu_classes_scavenge_total_cpu_seconds_total Estimated total CPU time spent performing tasks that return unused memory to the underlying platform. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sum of all metrics in /cpu/classes/scavenge. Sourced from /cpu/classes/scavenge/total:cpu-seconds +# TYPE go_cpu_classes_scavenge_total_cpu_seconds_total counter +go_cpu_classes_scavenge_total_cpu_seconds_total 3.73e-07 +# HELP go_cpu_classes_total_cpu_seconds_total Estimated total available CPU time for user Go code or the Go runtime, as defined by GOMAXPROCS. In other words, GOMAXPROCS integrated over the wall-clock duration this process has been executing for. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sum of all metrics in /cpu/classes. Sourced from /cpu/classes/total:cpu-seconds +# TYPE go_cpu_classes_total_cpu_seconds_total counter +go_cpu_classes_total_cpu_seconds_total 2509.166712672 +# HELP go_cpu_classes_user_cpu_seconds_total Estimated total CPU time spent running user Go code. This may also include some small amount of time spent in the Go runtime. This metric is an overestimate, and not directly comparable to system CPU time measurements. Compare only with other /cpu/classes metrics. Sourced from /cpu/classes/user:cpu-seconds +# TYPE go_cpu_classes_user_cpu_seconds_total counter +go_cpu_classes_user_cpu_seconds_total 0.19873391 +# HELP go_gc_cycles_automatic_gc_cycles_total Count of completed GC cycles generated by the Go runtime. Sourced from /gc/cycles/automatic:gc-cycles +# TYPE go_gc_cycles_automatic_gc_cycles_total counter +go_gc_cycles_automatic_gc_cycles_total 7 +# HELP go_gc_cycles_forced_gc_cycles_total Count of completed GC cycles forced by the application. Sourced from /gc/cycles/forced:gc-cycles +# TYPE go_gc_cycles_forced_gc_cycles_total counter +go_gc_cycles_forced_gc_cycles_total 0 +# HELP go_gc_cycles_total_gc_cycles_total Count of all completed GC cycles. Sourced from /gc/cycles/total:gc-cycles +# TYPE go_gc_cycles_total_gc_cycles_total counter +go_gc_cycles_total_gc_cycles_total 7 +# HELP go_gc_duration_seconds A summary of the wall-time pause (stop-the-world) duration in garbage collection cycles. +# TYPE go_gc_duration_seconds summary +go_gc_duration_seconds{quantile="0"} 2.2494e-05 +go_gc_duration_seconds{quantile="0.25"} 5.1619e-05 +go_gc_duration_seconds{quantile="0.5"} 6.4489e-05 +go_gc_duration_seconds{quantile="0.75"} 0.0001829 +go_gc_duration_seconds{quantile="1"} 0.000200723 +go_gc_duration_seconds_sum 0.000718186 +go_gc_duration_seconds_count 7 +# HELP go_gc_gogc_percent Heap size target percentage configured by the user, otherwise 100. This value is set by the GOGC environment variable, and the runtime/debug.SetGCPercent function. Sourced from /gc/gogc:percent +# TYPE go_gc_gogc_percent gauge +go_gc_gogc_percent 100 +# HELP go_gc_gomemlimit_bytes Go runtime memory limit configured by the user, otherwise math.MaxInt64. This value is set by the GOMEMLIMIT environment variable, and the runtime/debug.SetMemoryLimit function. Sourced from /gc/gomemlimit:bytes +# TYPE go_gc_gomemlimit_bytes gauge +go_gc_gomemlimit_bytes 3.28493056e+10 +# HELP go_gc_heap_allocs_by_size_bytes Distribution of heap allocations by approximate size. Bucket counts increase monotonically. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks. Sourced from /gc/heap/allocs-by-size:bytes +# TYPE go_gc_heap_allocs_by_size_bytes histogram +go_gc_heap_allocs_by_size_bytes_bucket{le="8.999999999999998"} 5419 +go_gc_heap_allocs_by_size_bytes_bucket{le="24.999999999999996"} 112324 +go_gc_heap_allocs_by_size_bytes_bucket{le="64.99999999999999"} 202127 +go_gc_heap_allocs_by_size_bytes_bucket{le="144.99999999999997"} 263918 +go_gc_heap_allocs_by_size_bytes_bucket{le="320.99999999999994"} 274302 +go_gc_heap_allocs_by_size_bytes_bucket{le="704.9999999999999"} 276913 +go_gc_heap_allocs_by_size_bytes_bucket{le="1536.9999999999998"} 278365 +go_gc_heap_allocs_by_size_bytes_bucket{le="3200.9999999999995"} 278992 +go_gc_heap_allocs_by_size_bytes_bucket{le="6528.999999999999"} 279344 +go_gc_heap_allocs_by_size_bytes_bucket{le="13568.999999999998"} 279499 +go_gc_heap_allocs_by_size_bytes_bucket{le="27264.999999999996"} 279555 +go_gc_heap_allocs_by_size_bytes_bucket{le="+Inf"} 279636 +go_gc_heap_allocs_by_size_bytes_sum 3.2286016e+07 +go_gc_heap_allocs_by_size_bytes_count 279636 +# HELP go_gc_heap_allocs_bytes_total Cumulative sum of memory allocated to the heap by the application. Sourced from /gc/heap/allocs:bytes +# TYPE go_gc_heap_allocs_bytes_total counter +go_gc_heap_allocs_bytes_total 3.2286016e+07 +# HELP go_gc_heap_allocs_objects_total Cumulative count of heap allocations triggered by the application. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks. Sourced from /gc/heap/allocs:objects +# TYPE go_gc_heap_allocs_objects_total counter +go_gc_heap_allocs_objects_total 279636 +# HELP go_gc_heap_frees_by_size_bytes Distribution of freed heap allocations by approximate size. Bucket counts increase monotonically. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks. Sourced from /gc/heap/frees-by-size:bytes +# TYPE go_gc_heap_frees_by_size_bytes histogram +go_gc_heap_frees_by_size_bytes_bucket{le="8.999999999999998"} 3865 +go_gc_heap_frees_by_size_bytes_bucket{le="24.999999999999996"} 64719 +go_gc_heap_frees_by_size_bytes_bucket{le="64.99999999999999"} 107856 +go_gc_heap_frees_by_size_bytes_bucket{le="144.99999999999997"} 136336 +go_gc_heap_frees_by_size_bytes_bucket{le="320.99999999999994"} 140909 +go_gc_heap_frees_by_size_bytes_bucket{le="704.9999999999999"} 142134 +go_gc_heap_frees_by_size_bytes_bucket{le="1536.9999999999998"} 142975 +go_gc_heap_frees_by_size_bytes_bucket{le="3200.9999999999995"} 143259 +go_gc_heap_frees_by_size_bytes_bucket{le="6528.999999999999"} 143435 +go_gc_heap_frees_by_size_bytes_bucket{le="13568.999999999998"} 143498 +go_gc_heap_frees_by_size_bytes_bucket{le="27264.999999999996"} 143527 +go_gc_heap_frees_by_size_bytes_bucket{le="+Inf"} 143586 +go_gc_heap_frees_by_size_bytes_sum 1.7642992e+07 +go_gc_heap_frees_by_size_bytes_count 143586 +# HELP go_gc_heap_frees_bytes_total Cumulative sum of heap memory freed by the garbage collector. Sourced from /gc/heap/frees:bytes +# TYPE go_gc_heap_frees_bytes_total counter +go_gc_heap_frees_bytes_total 1.7642992e+07 +# HELP go_gc_heap_frees_objects_total Cumulative count of heap allocations whose storage was freed by the garbage collector. Note that this does not include tiny objects as defined by /gc/heap/tiny/allocs:objects, only tiny blocks. Sourced from /gc/heap/frees:objects +# TYPE go_gc_heap_frees_objects_total counter +go_gc_heap_frees_objects_total 143586 +# HELP go_gc_heap_goal_bytes Heap size target for the end of the GC cycle. Sourced from /gc/heap/goal:bytes +# TYPE go_gc_heap_goal_bytes gauge +go_gc_heap_goal_bytes 2.332124e+07 +# HELP go_gc_heap_live_bytes Heap memory occupied by live objects that were marked by the previous GC. Sourced from /gc/heap/live:bytes +# TYPE go_gc_heap_live_bytes gauge +go_gc_heap_live_bytes 1.1260352e+07 +# HELP go_gc_heap_objects_objects Number of objects, live or unswept, occupying heap memory. Sourced from /gc/heap/objects:objects +# TYPE go_gc_heap_objects_objects gauge +go_gc_heap_objects_objects 136050 +# HELP go_gc_heap_tiny_allocs_objects_total Count of small allocations that are packed together into blocks. These allocations are counted separately from other allocations because each individual allocation is not tracked by the runtime, only their block. Each block is already accounted for in allocs-by-size and frees-by-size. Sourced from /gc/heap/tiny/allocs:objects +# TYPE go_gc_heap_tiny_allocs_objects_total counter +go_gc_heap_tiny_allocs_objects_total 36018 +# HELP go_gc_limiter_last_enabled_gc_cycle GC cycle the last time the GC CPU limiter was enabled. This metric is useful for diagnosing the root cause of an out-of-memory error, because the limiter trades memory for CPU time when the GC's CPU time gets too high. This is most likely to occur with use of SetMemoryLimit. The first GC cycle is cycle 1, so a value of 0 indicates that it was never enabled. Sourced from /gc/limiter/last-enabled:gc-cycle +# TYPE go_gc_limiter_last_enabled_gc_cycle gauge +go_gc_limiter_last_enabled_gc_cycle 0 +# HELP go_gc_pauses_seconds Deprecated. Prefer the identical /sched/pauses/total/gc:seconds. Sourced from /gc/pauses:seconds +# TYPE go_gc_pauses_seconds histogram +go_gc_pauses_seconds_bucket{le="6.399999999999999e-08"} 0 +go_gc_pauses_seconds_bucket{le="6.399999999999999e-07"} 0 +go_gc_pauses_seconds_bucket{le="7.167999999999999e-06"} 2 +go_gc_pauses_seconds_bucket{le="8.191999999999999e-05"} 11 +go_gc_pauses_seconds_bucket{le="0.0009175039999999999"} 14 +go_gc_pauses_seconds_bucket{le="0.010485759999999998"} 14 +go_gc_pauses_seconds_bucket{le="0.11744051199999998"} 14 +go_gc_pauses_seconds_bucket{le="+Inf"} 14 +go_gc_pauses_seconds_sum 0.00031155200000000004 +go_gc_pauses_seconds_count 14 +# HELP go_gc_scan_globals_bytes The total amount of global variable space that is scannable. Sourced from /gc/scan/globals:bytes +# TYPE go_gc_scan_globals_bytes gauge +go_gc_scan_globals_bytes 764864 +# HELP go_gc_scan_heap_bytes The total amount of heap space that is scannable. Sourced from /gc/scan/heap:bytes +# TYPE go_gc_scan_heap_bytes gauge +go_gc_scan_heap_bytes 1.0542576e+07 +# HELP go_gc_scan_stack_bytes The number of bytes of stack that were scanned last GC cycle. Sourced from /gc/scan/stack:bytes +# TYPE go_gc_scan_stack_bytes gauge +go_gc_scan_stack_bytes 35672 +# HELP go_gc_scan_total_bytes The total amount space that is scannable. Sum of all metrics in /gc/scan. Sourced from /gc/scan/total:bytes +# TYPE go_gc_scan_total_bytes gauge +go_gc_scan_total_bytes 1.1343112e+07 +# HELP go_gc_stack_starting_size_bytes The stack size of new goroutines. Sourced from /gc/stack/starting-size:bytes +# TYPE go_gc_stack_starting_size_bytes gauge +go_gc_stack_starting_size_bytes 2048 +# HELP go_godebug_non_default_behavior_asynctimerchan_events_total The number of non-default behaviors executed by the time package due to a non-default GODEBUG=asynctimerchan=... setting. Sourced from /godebug/non-default-behavior/asynctimerchan:events +# TYPE go_godebug_non_default_behavior_asynctimerchan_events_total counter +go_godebug_non_default_behavior_asynctimerchan_events_total 39 +# HELP go_godebug_non_default_behavior_execerrdot_events_total The number of non-default behaviors executed by the os/exec package due to a non-default GODEBUG=execerrdot=... setting. Sourced from /godebug/non-default-behavior/execerrdot:events +# TYPE go_godebug_non_default_behavior_execerrdot_events_total counter +go_godebug_non_default_behavior_execerrdot_events_total 0 +# HELP go_godebug_non_default_behavior_gocachehash_events_total The number of non-default behaviors executed by the cmd/go package due to a non-default GODEBUG=gocachehash=... setting. Sourced from /godebug/non-default-behavior/gocachehash:events +# TYPE go_godebug_non_default_behavior_gocachehash_events_total counter +go_godebug_non_default_behavior_gocachehash_events_total 0 +# HELP go_godebug_non_default_behavior_gocachetest_events_total The number of non-default behaviors executed by the cmd/go package due to a non-default GODEBUG=gocachetest=... setting. Sourced from /godebug/non-default-behavior/gocachetest:events +# TYPE go_godebug_non_default_behavior_gocachetest_events_total counter +go_godebug_non_default_behavior_gocachetest_events_total 0 +# HELP go_godebug_non_default_behavior_gocacheverify_events_total The number of non-default behaviors executed by the cmd/go package due to a non-default GODEBUG=gocacheverify=... setting. Sourced from /godebug/non-default-behavior/gocacheverify:events +# TYPE go_godebug_non_default_behavior_gocacheverify_events_total counter +go_godebug_non_default_behavior_gocacheverify_events_total 0 +# HELP go_godebug_non_default_behavior_gotypesalias_events_total The number of non-default behaviors executed by the go/types package due to a non-default GODEBUG=gotypesalias=... setting. Sourced from /godebug/non-default-behavior/gotypesalias:events +# TYPE go_godebug_non_default_behavior_gotypesalias_events_total counter +go_godebug_non_default_behavior_gotypesalias_events_total 0 +# HELP go_godebug_non_default_behavior_http2client_events_total The number of non-default behaviors executed by the net/http package due to a non-default GODEBUG=http2client=... setting. Sourced from /godebug/non-default-behavior/http2client:events +# TYPE go_godebug_non_default_behavior_http2client_events_total counter +go_godebug_non_default_behavior_http2client_events_total 0 +# HELP go_godebug_non_default_behavior_http2server_events_total The number of non-default behaviors executed by the net/http package due to a non-default GODEBUG=http2server=... setting. Sourced from /godebug/non-default-behavior/http2server:events +# TYPE go_godebug_non_default_behavior_http2server_events_total counter +go_godebug_non_default_behavior_http2server_events_total 0 +# HELP go_godebug_non_default_behavior_httplaxcontentlength_events_total The number of non-default behaviors executed by the net/http package due to a non-default GODEBUG=httplaxcontentlength=... setting. Sourced from /godebug/non-default-behavior/httplaxcontentlength:events +# TYPE go_godebug_non_default_behavior_httplaxcontentlength_events_total counter +go_godebug_non_default_behavior_httplaxcontentlength_events_total 0 +# HELP go_godebug_non_default_behavior_httpmuxgo121_events_total The number of non-default behaviors executed by the net/http package due to a non-default GODEBUG=httpmuxgo121=... setting. Sourced from /godebug/non-default-behavior/httpmuxgo121:events +# TYPE go_godebug_non_default_behavior_httpmuxgo121_events_total counter +go_godebug_non_default_behavior_httpmuxgo121_events_total 0 +# HELP go_godebug_non_default_behavior_httpservecontentkeepheaders_events_total The number of non-default behaviors executed by the net/http package due to a non-default GODEBUG=httpservecontentkeepheaders=... setting. Sourced from /godebug/non-default-behavior/httpservecontentkeepheaders:events +# TYPE go_godebug_non_default_behavior_httpservecontentkeepheaders_events_total counter +go_godebug_non_default_behavior_httpservecontentkeepheaders_events_total 0 +# HELP go_godebug_non_default_behavior_installgoroot_events_total The number of non-default behaviors executed by the go/build package due to a non-default GODEBUG=installgoroot=... setting. Sourced from /godebug/non-default-behavior/installgoroot:events +# TYPE go_godebug_non_default_behavior_installgoroot_events_total counter +go_godebug_non_default_behavior_installgoroot_events_total 0 +# HELP go_godebug_non_default_behavior_multipartmaxheaders_events_total The number of non-default behaviors executed by the mime/multipart package due to a non-default GODEBUG=multipartmaxheaders=... setting. Sourced from /godebug/non-default-behavior/multipartmaxheaders:events +# TYPE go_godebug_non_default_behavior_multipartmaxheaders_events_total counter +go_godebug_non_default_behavior_multipartmaxheaders_events_total 0 +# HELP go_godebug_non_default_behavior_multipartmaxparts_events_total The number of non-default behaviors executed by the mime/multipart package due to a non-default GODEBUG=multipartmaxparts=... setting. Sourced from /godebug/non-default-behavior/multipartmaxparts:events +# TYPE go_godebug_non_default_behavior_multipartmaxparts_events_total counter +go_godebug_non_default_behavior_multipartmaxparts_events_total 0 +# HELP go_godebug_non_default_behavior_multipathtcp_events_total The number of non-default behaviors executed by the net package due to a non-default GODEBUG=multipathtcp=... setting. Sourced from /godebug/non-default-behavior/multipathtcp:events +# TYPE go_godebug_non_default_behavior_multipathtcp_events_total counter +go_godebug_non_default_behavior_multipathtcp_events_total 0 +# HELP go_godebug_non_default_behavior_netedns0_events_total The number of non-default behaviors executed by the net package due to a non-default GODEBUG=netedns0=... setting. Sourced from /godebug/non-default-behavior/netedns0:events +# TYPE go_godebug_non_default_behavior_netedns0_events_total counter +go_godebug_non_default_behavior_netedns0_events_total 0 +# HELP go_godebug_non_default_behavior_panicnil_events_total The number of non-default behaviors executed by the runtime package due to a non-default GODEBUG=panicnil=... setting. Sourced from /godebug/non-default-behavior/panicnil:events +# TYPE go_godebug_non_default_behavior_panicnil_events_total counter +go_godebug_non_default_behavior_panicnil_events_total 0 +# HELP go_godebug_non_default_behavior_randautoseed_events_total The number of non-default behaviors executed by the math/rand package due to a non-default GODEBUG=randautoseed=... setting. Sourced from /godebug/non-default-behavior/randautoseed:events +# TYPE go_godebug_non_default_behavior_randautoseed_events_total counter +go_godebug_non_default_behavior_randautoseed_events_total 0 +# HELP go_godebug_non_default_behavior_tarinsecurepath_events_total The number of non-default behaviors executed by the archive/tar package due to a non-default GODEBUG=tarinsecurepath=... setting. Sourced from /godebug/non-default-behavior/tarinsecurepath:events +# TYPE go_godebug_non_default_behavior_tarinsecurepath_events_total counter +go_godebug_non_default_behavior_tarinsecurepath_events_total 0 +# HELP go_godebug_non_default_behavior_tls10server_events_total The number of non-default behaviors executed by the crypto/tls package due to a non-default GODEBUG=tls10server=... setting. Sourced from /godebug/non-default-behavior/tls10server:events +# TYPE go_godebug_non_default_behavior_tls10server_events_total counter +go_godebug_non_default_behavior_tls10server_events_total 0 +# HELP go_godebug_non_default_behavior_tls3des_events_total The number of non-default behaviors executed by the crypto/tls package due to a non-default GODEBUG=tls3des=... setting. Sourced from /godebug/non-default-behavior/tls3des:events +# TYPE go_godebug_non_default_behavior_tls3des_events_total counter +go_godebug_non_default_behavior_tls3des_events_total 0 +# HELP go_godebug_non_default_behavior_tlsmaxrsasize_events_total The number of non-default behaviors executed by the crypto/tls package due to a non-default GODEBUG=tlsmaxrsasize=... setting. Sourced from /godebug/non-default-behavior/tlsmaxrsasize:events +# TYPE go_godebug_non_default_behavior_tlsmaxrsasize_events_total counter +go_godebug_non_default_behavior_tlsmaxrsasize_events_total 0 +# HELP go_godebug_non_default_behavior_tlsrsakex_events_total The number of non-default behaviors executed by the crypto/tls package due to a non-default GODEBUG=tlsrsakex=... setting. Sourced from /godebug/non-default-behavior/tlsrsakex:events +# TYPE go_godebug_non_default_behavior_tlsrsakex_events_total counter +go_godebug_non_default_behavior_tlsrsakex_events_total 0 +# HELP go_godebug_non_default_behavior_tlsunsafeekm_events_total The number of non-default behaviors executed by the crypto/tls package due to a non-default GODEBUG=tlsunsafeekm=... setting. Sourced from /godebug/non-default-behavior/tlsunsafeekm:events +# TYPE go_godebug_non_default_behavior_tlsunsafeekm_events_total counter +go_godebug_non_default_behavior_tlsunsafeekm_events_total 0 +# HELP go_godebug_non_default_behavior_winreadlinkvolume_events_total The number of non-default behaviors executed by the os package due to a non-default GODEBUG=winreadlinkvolume=... setting. Sourced from /godebug/non-default-behavior/winreadlinkvolume:events +# TYPE go_godebug_non_default_behavior_winreadlinkvolume_events_total counter +go_godebug_non_default_behavior_winreadlinkvolume_events_total 0 +# HELP go_godebug_non_default_behavior_winsymlink_events_total The number of non-default behaviors executed by the os package due to a non-default GODEBUG=winsymlink=... setting. Sourced from /godebug/non-default-behavior/winsymlink:events +# TYPE go_godebug_non_default_behavior_winsymlink_events_total counter +go_godebug_non_default_behavior_winsymlink_events_total 0 +# HELP go_godebug_non_default_behavior_x509keypairleaf_events_total The number of non-default behaviors executed by the crypto/tls package due to a non-default GODEBUG=x509keypairleaf=... setting. Sourced from /godebug/non-default-behavior/x509keypairleaf:events +# TYPE go_godebug_non_default_behavior_x509keypairleaf_events_total counter +go_godebug_non_default_behavior_x509keypairleaf_events_total 0 +# HELP go_godebug_non_default_behavior_x509negativeserial_events_total The number of non-default behaviors executed by the crypto/x509 package due to a non-default GODEBUG=x509negativeserial=... setting. Sourced from /godebug/non-default-behavior/x509negativeserial:events +# TYPE go_godebug_non_default_behavior_x509negativeserial_events_total counter +go_godebug_non_default_behavior_x509negativeserial_events_total 0 +# HELP go_godebug_non_default_behavior_x509sha1_events_total The number of non-default behaviors executed by the crypto/x509 package due to a non-default GODEBUG=x509sha1=... setting. Sourced from /godebug/non-default-behavior/x509sha1:events +# TYPE go_godebug_non_default_behavior_x509sha1_events_total counter +go_godebug_non_default_behavior_x509sha1_events_total 0 +# HELP go_godebug_non_default_behavior_x509usefallbackroots_events_total The number of non-default behaviors executed by the crypto/x509 package due to a non-default GODEBUG=x509usefallbackroots=... setting. Sourced from /godebug/non-default-behavior/x509usefallbackroots:events +# TYPE go_godebug_non_default_behavior_x509usefallbackroots_events_total counter +go_godebug_non_default_behavior_x509usefallbackroots_events_total 0 +# HELP go_godebug_non_default_behavior_x509usepolicies_events_total The number of non-default behaviors executed by the crypto/x509 package due to a non-default GODEBUG=x509usepolicies=... setting. Sourced from /godebug/non-default-behavior/x509usepolicies:events +# TYPE go_godebug_non_default_behavior_x509usepolicies_events_total counter +go_godebug_non_default_behavior_x509usepolicies_events_total 0 +# HELP go_godebug_non_default_behavior_zipinsecurepath_events_total The number of non-default behaviors executed by the archive/zip package due to a non-default GODEBUG=zipinsecurepath=... setting. Sourced from /godebug/non-default-behavior/zipinsecurepath:events +# TYPE go_godebug_non_default_behavior_zipinsecurepath_events_total counter +go_godebug_non_default_behavior_zipinsecurepath_events_total 0 +# HELP go_goroutines Number of goroutines that currently exist. +# TYPE go_goroutines gauge +go_goroutines 33 +# HELP go_info Information about the Go environment. +# TYPE go_info gauge +go_info{version="go1.23.1"} 1 +# HELP go_memory_classes_heap_free_bytes Memory that is completely free and eligible to be returned to the underlying system, but has not been. This metric is the runtime's estimate of free address space that is backed by physical memory. Sourced from /memory/classes/heap/free:bytes +# TYPE go_memory_classes_heap_free_bytes gauge +go_memory_classes_heap_free_bytes 3.489792e+06 +# HELP go_memory_classes_heap_objects_bytes Memory occupied by live objects and dead objects that have not yet been marked free by the garbage collector. Sourced from /memory/classes/heap/objects:bytes +# TYPE go_memory_classes_heap_objects_bytes gauge +go_memory_classes_heap_objects_bytes 1.4643024e+07 +# HELP go_memory_classes_heap_released_bytes Memory that is completely free and has been returned to the underlying system. This metric is the runtime's estimate of free address space that is still mapped into the process, but is not backed by physical memory. Sourced from /memory/classes/heap/released:bytes +# TYPE go_memory_classes_heap_released_bytes gauge +go_memory_classes_heap_released_bytes 2.392064e+06 +# HELP go_memory_classes_heap_stacks_bytes Memory allocated from the heap that is reserved for stack space, whether or not it is currently in-use. Currently, this represents all stack memory for goroutines. It also includes all OS thread stacks in non-cgo programs. Note that stacks may be allocated differently in the future, and this may change. Sourced from /memory/classes/heap/stacks:bytes +# TYPE go_memory_classes_heap_stacks_bytes gauge +go_memory_classes_heap_stacks_bytes 1.343488e+06 +# HELP go_memory_classes_heap_unused_bytes Memory that is reserved for heap objects but is not currently used to hold heap objects. Sourced from /memory/classes/heap/unused:bytes +# TYPE go_memory_classes_heap_unused_bytes gauge +go_memory_classes_heap_unused_bytes 3.297456e+06 +# HELP go_memory_classes_metadata_mcache_free_bytes Memory that is reserved for runtime mcache structures, but not in-use. Sourced from /memory/classes/metadata/mcache/free:bytes +# TYPE go_memory_classes_metadata_mcache_free_bytes gauge +go_memory_classes_metadata_mcache_free_bytes 1200 +# HELP go_memory_classes_metadata_mcache_inuse_bytes Memory that is occupied by runtime mcache structures that are currently being used. Sourced from /memory/classes/metadata/mcache/inuse:bytes +# TYPE go_memory_classes_metadata_mcache_inuse_bytes gauge +go_memory_classes_metadata_mcache_inuse_bytes 14400 +# HELP go_memory_classes_metadata_mspan_free_bytes Memory that is reserved for runtime mspan structures, but not in-use. Sourced from /memory/classes/metadata/mspan/free:bytes +# TYPE go_memory_classes_metadata_mspan_free_bytes gauge +go_memory_classes_metadata_mspan_free_bytes 1760 +# HELP go_memory_classes_metadata_mspan_inuse_bytes Memory that is occupied by runtime mspan structures that are currently being used. Sourced from /memory/classes/metadata/mspan/inuse:bytes +# TYPE go_memory_classes_metadata_mspan_inuse_bytes gauge +go_memory_classes_metadata_mspan_inuse_bytes 357280 +# HELP go_memory_classes_metadata_other_bytes Memory that is reserved for or used to hold runtime metadata. Sourced from /memory/classes/metadata/other:bytes +# TYPE go_memory_classes_metadata_other_bytes gauge +go_memory_classes_metadata_other_bytes 3.726896e+06 +# HELP go_memory_classes_os_stacks_bytes Stack memory allocated by the underlying operating system. In non-cgo programs this metric is currently zero. This may change in the future.In cgo programs this metric includes OS thread stacks allocated directly from the OS. Currently, this only accounts for one stack in c-shared and c-archive build modes, and other sources of stacks from the OS are not measured. This too may change in the future. Sourced from /memory/classes/os-stacks:bytes +# TYPE go_memory_classes_os_stacks_bytes gauge +go_memory_classes_os_stacks_bytes 0 +# HELP go_memory_classes_other_bytes Memory used by execution trace buffers, structures for debugging the runtime, finalizer and profiler specials, and more. Sourced from /memory/classes/other:bytes +# TYPE go_memory_classes_other_bytes gauge +go_memory_classes_other_bytes 2.115807e+06 +# HELP go_memory_classes_profiling_buckets_bytes Memory that is used by the stack trace hash map used for profiling. Sourced from /memory/classes/profiling/buckets:bytes +# TYPE go_memory_classes_profiling_buckets_bytes gauge +go_memory_classes_profiling_buckets_bytes 1.472137e+06 +# HELP go_memory_classes_total_bytes All memory mapped by the Go runtime into the current process as read-write. Note that this does not include memory mapped by code called via cgo or via the syscall package. Sum of all metrics in /memory/classes. Sourced from /memory/classes/total:bytes +# TYPE go_memory_classes_total_bytes gauge +go_memory_classes_total_bytes 3.2855304e+07 +# HELP go_memstats_alloc_bytes Number of bytes allocated in heap and currently in use. Equals to /memory/classes/heap/objects:bytes. +# TYPE go_memstats_alloc_bytes gauge +go_memstats_alloc_bytes 1.4643024e+07 +# HELP go_memstats_alloc_bytes_total Total number of bytes allocated in heap until now, even if released already. Equals to /gc/heap/allocs:bytes. +# TYPE go_memstats_alloc_bytes_total counter +go_memstats_alloc_bytes_total 3.2286016e+07 +# HELP go_memstats_buck_hash_sys_bytes Number of bytes used by the profiling bucket hash table. Equals to /memory/classes/profiling/buckets:bytes. +# TYPE go_memstats_buck_hash_sys_bytes gauge +go_memstats_buck_hash_sys_bytes 1.472137e+06 +# HELP go_memstats_frees_total Total number of heap objects frees. Equals to /gc/heap/frees:objects + /gc/heap/tiny/allocs:objects. +# TYPE go_memstats_frees_total counter +go_memstats_frees_total 179604 +# HELP go_memstats_gc_sys_bytes Number of bytes used for garbage collection system metadata. Equals to /memory/classes/metadata/other:bytes. +# TYPE go_memstats_gc_sys_bytes gauge +go_memstats_gc_sys_bytes 3.726896e+06 +# HELP go_memstats_heap_alloc_bytes Number of heap bytes allocated and currently in use, same as go_memstats_alloc_bytes. Equals to /memory/classes/heap/objects:bytes. +# TYPE go_memstats_heap_alloc_bytes gauge +go_memstats_heap_alloc_bytes 1.4643024e+07 +# HELP go_memstats_heap_idle_bytes Number of heap bytes waiting to be used. Equals to /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes. +# TYPE go_memstats_heap_idle_bytes gauge +go_memstats_heap_idle_bytes 5.881856e+06 +# HELP go_memstats_heap_inuse_bytes Number of heap bytes that are in use. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes +# TYPE go_memstats_heap_inuse_bytes gauge +go_memstats_heap_inuse_bytes 1.794048e+07 +# HELP go_memstats_heap_objects Number of currently allocated objects. Equals to /gc/heap/objects:objects. +# TYPE go_memstats_heap_objects gauge +go_memstats_heap_objects 136050 +# HELP go_memstats_heap_released_bytes Number of heap bytes released to OS. Equals to /memory/classes/heap/released:bytes. +# TYPE go_memstats_heap_released_bytes gauge +go_memstats_heap_released_bytes 2.392064e+06 +# HELP go_memstats_heap_sys_bytes Number of heap bytes obtained from system. Equals to /memory/classes/heap/objects:bytes + /memory/classes/heap/unused:bytes + /memory/classes/heap/released:bytes + /memory/classes/heap/free:bytes. +# TYPE go_memstats_heap_sys_bytes gauge +go_memstats_heap_sys_bytes 2.3822336e+07 +# HELP go_memstats_last_gc_time_seconds Number of seconds since 1970 of last garbage collection. +# TYPE go_memstats_last_gc_time_seconds gauge +go_memstats_last_gc_time_seconds 1.7317049496282802e+09 +# HELP go_memstats_mallocs_total Total number of heap objects allocated, both live and gc-ed. Semantically a counter version for go_memstats_heap_objects gauge. Equals to /gc/heap/allocs:objects + /gc/heap/tiny/allocs:objects. +# TYPE go_memstats_mallocs_total counter +go_memstats_mallocs_total 315654 +# HELP go_memstats_mcache_inuse_bytes Number of bytes in use by mcache structures. Equals to /memory/classes/metadata/mcache/inuse:bytes. +# TYPE go_memstats_mcache_inuse_bytes gauge +go_memstats_mcache_inuse_bytes 14400 +# HELP go_memstats_mcache_sys_bytes Number of bytes used for mcache structures obtained from system. Equals to /memory/classes/metadata/mcache/inuse:bytes + /memory/classes/metadata/mcache/free:bytes. +# TYPE go_memstats_mcache_sys_bytes gauge +go_memstats_mcache_sys_bytes 15600 +# HELP go_memstats_mspan_inuse_bytes Number of bytes in use by mspan structures. Equals to /memory/classes/metadata/mspan/inuse:bytes. +# TYPE go_memstats_mspan_inuse_bytes gauge +go_memstats_mspan_inuse_bytes 357280 +# HELP go_memstats_mspan_sys_bytes Number of bytes used for mspan structures obtained from system. Equals to /memory/classes/metadata/mspan/inuse:bytes + /memory/classes/metadata/mspan/free:bytes. +# TYPE go_memstats_mspan_sys_bytes gauge +go_memstats_mspan_sys_bytes 359040 +# HELP go_memstats_next_gc_bytes Number of heap bytes when next garbage collection will take place. Equals to /gc/heap/goal:bytes. +# TYPE go_memstats_next_gc_bytes gauge +go_memstats_next_gc_bytes 2.332124e+07 +# HELP go_memstats_other_sys_bytes Number of bytes used for other system allocations. Equals to /memory/classes/other:bytes. +# TYPE go_memstats_other_sys_bytes gauge +go_memstats_other_sys_bytes 2.115807e+06 +# HELP go_memstats_stack_inuse_bytes Number of bytes obtained from system for stack allocator in non-CGO environments. Equals to /memory/classes/heap/stacks:bytes. +# TYPE go_memstats_stack_inuse_bytes gauge +go_memstats_stack_inuse_bytes 1.343488e+06 +# HELP go_memstats_stack_sys_bytes Number of bytes obtained from system for stack allocator. Equals to /memory/classes/heap/stacks:bytes + /memory/classes/os-stacks:bytes. +# TYPE go_memstats_stack_sys_bytes gauge +go_memstats_stack_sys_bytes 1.343488e+06 +# HELP go_memstats_sys_bytes Number of bytes obtained from system. Equals to /memory/classes/total:byte. +# TYPE go_memstats_sys_bytes gauge +go_memstats_sys_bytes 3.2855304e+07 +# HELP go_sched_gomaxprocs_threads The current runtime.GOMAXPROCS setting, or the number of operating system threads that can execute user-level Go code simultaneously. Sourced from /sched/gomaxprocs:threads +# TYPE go_sched_gomaxprocs_threads gauge +go_sched_gomaxprocs_threads 12 +# HELP go_sched_goroutines_goroutines Count of live goroutines. Sourced from /sched/goroutines:goroutines +# TYPE go_sched_goroutines_goroutines gauge +go_sched_goroutines_goroutines 33 +# HELP go_sched_latencies_seconds Distribution of the time goroutines have spent in the scheduler in a runnable state before actually running. Bucket counts increase monotonically. Sourced from /sched/latencies:seconds +# TYPE go_sched_latencies_seconds histogram +go_sched_latencies_seconds_bucket{le="6.399999999999999e-08"} 200 +go_sched_latencies_seconds_bucket{le="6.399999999999999e-07"} 245 +go_sched_latencies_seconds_bucket{le="7.167999999999999e-06"} 309 +go_sched_latencies_seconds_bucket{le="8.191999999999999e-05"} 348 +go_sched_latencies_seconds_bucket{le="0.0009175039999999999"} 353 +go_sched_latencies_seconds_bucket{le="0.010485759999999998"} 353 +go_sched_latencies_seconds_bucket{le="0.11744051199999998"} 353 +go_sched_latencies_seconds_bucket{le="+Inf"} 353 +go_sched_latencies_seconds_sum 0.000732992 +go_sched_latencies_seconds_count 353 +# HELP go_sched_pauses_stopping_gc_seconds Distribution of individual GC-related stop-the-world stopping latencies. This is the time it takes from deciding to stop the world until all Ps are stopped. This is a subset of the total GC-related stop-the-world time (/sched/pauses/total/gc:seconds). During this time, some threads may be executing. Bucket counts increase monotonically. Sourced from /sched/pauses/stopping/gc:seconds +# TYPE go_sched_pauses_stopping_gc_seconds histogram +go_sched_pauses_stopping_gc_seconds_bucket{le="6.399999999999999e-08"} 0 +go_sched_pauses_stopping_gc_seconds_bucket{le="6.399999999999999e-07"} 0 +go_sched_pauses_stopping_gc_seconds_bucket{le="7.167999999999999e-06"} 10 +go_sched_pauses_stopping_gc_seconds_bucket{le="8.191999999999999e-05"} 12 +go_sched_pauses_stopping_gc_seconds_bucket{le="0.0009175039999999999"} 14 +go_sched_pauses_stopping_gc_seconds_bucket{le="0.010485759999999998"} 14 +go_sched_pauses_stopping_gc_seconds_bucket{le="0.11744051199999998"} 14 +go_sched_pauses_stopping_gc_seconds_bucket{le="+Inf"} 14 +go_sched_pauses_stopping_gc_seconds_sum 0.000184576 +go_sched_pauses_stopping_gc_seconds_count 14 +# HELP go_sched_pauses_stopping_other_seconds Distribution of individual non-GC-related stop-the-world stopping latencies. This is the time it takes from deciding to stop the world until all Ps are stopped. This is a subset of the total non-GC-related stop-the-world time (/sched/pauses/total/other:seconds). During this time, some threads may be executing. Bucket counts increase monotonically. Sourced from /sched/pauses/stopping/other:seconds +# TYPE go_sched_pauses_stopping_other_seconds histogram +go_sched_pauses_stopping_other_seconds_bucket{le="6.399999999999999e-08"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="6.399999999999999e-07"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="7.167999999999999e-06"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="8.191999999999999e-05"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="0.0009175039999999999"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="0.010485759999999998"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="0.11744051199999998"} 0 +go_sched_pauses_stopping_other_seconds_bucket{le="+Inf"} 0 +go_sched_pauses_stopping_other_seconds_sum 0 +go_sched_pauses_stopping_other_seconds_count 0 +# HELP go_sched_pauses_total_gc_seconds Distribution of individual GC-related stop-the-world pause latencies. This is the time from deciding to stop the world until the world is started again. Some of this time is spent getting all threads to stop (this is measured directly in /sched/pauses/stopping/gc:seconds), during which some threads may still be running. Bucket counts increase monotonically. Sourced from /sched/pauses/total/gc:seconds +# TYPE go_sched_pauses_total_gc_seconds histogram +go_sched_pauses_total_gc_seconds_bucket{le="6.399999999999999e-08"} 0 +go_sched_pauses_total_gc_seconds_bucket{le="6.399999999999999e-07"} 0 +go_sched_pauses_total_gc_seconds_bucket{le="7.167999999999999e-06"} 2 +go_sched_pauses_total_gc_seconds_bucket{le="8.191999999999999e-05"} 11 +go_sched_pauses_total_gc_seconds_bucket{le="0.0009175039999999999"} 14 +go_sched_pauses_total_gc_seconds_bucket{le="0.010485759999999998"} 14 +go_sched_pauses_total_gc_seconds_bucket{le="0.11744051199999998"} 14 +go_sched_pauses_total_gc_seconds_bucket{le="+Inf"} 14 +go_sched_pauses_total_gc_seconds_sum 0.00031155200000000004 +go_sched_pauses_total_gc_seconds_count 14 +# HELP go_sched_pauses_total_other_seconds Distribution of individual non-GC-related stop-the-world pause latencies. This is the time from deciding to stop the world until the world is started again. Some of this time is spent getting all threads to stop (measured directly in /sched/pauses/stopping/other:seconds). Bucket counts increase monotonically. Sourced from /sched/pauses/total/other:seconds +# TYPE go_sched_pauses_total_other_seconds histogram +go_sched_pauses_total_other_seconds_bucket{le="6.399999999999999e-08"} 0 +go_sched_pauses_total_other_seconds_bucket{le="6.399999999999999e-07"} 0 +go_sched_pauses_total_other_seconds_bucket{le="7.167999999999999e-06"} 0 +go_sched_pauses_total_other_seconds_bucket{le="8.191999999999999e-05"} 0 +go_sched_pauses_total_other_seconds_bucket{le="0.0009175039999999999"} 0 +go_sched_pauses_total_other_seconds_bucket{le="0.010485759999999998"} 0 +go_sched_pauses_total_other_seconds_bucket{le="0.11744051199999998"} 0 +go_sched_pauses_total_other_seconds_bucket{le="+Inf"} 0 +go_sched_pauses_total_other_seconds_sum 0 +go_sched_pauses_total_other_seconds_count 0 +# HELP go_sync_mutex_wait_total_seconds_total Approximate cumulative time goroutines have spent blocked on a sync.Mutex, sync.RWMutex, or runtime-internal lock. This metric is useful for identifying global changes in lock contention. Collect a mutex or block profile using the runtime/pprof package for more detailed contention data. Sourced from /sync/mutex/wait/total:seconds +# TYPE go_sync_mutex_wait_total_seconds_total counter +go_sync_mutex_wait_total_seconds_total 0.0007877439999999999 +# HELP go_threads Number of OS threads created. +# TYPE go_threads gauge +go_threads 17 +# HELP grpc_server_handled_total Total number of RPCs completed on the server, regardless of success or failure. +# TYPE grpc_server_handled_total counter +grpc_server_handled_total{grpc_code="OK",grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream"} 10 +grpc_server_handled_total{grpc_code="OK",grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary"} 1 +# HELP grpc_server_handling_seconds Histogram of response latency (seconds) of gRPC that had been application-level handled by the server. +# TYPE grpc_server_handling_seconds histogram +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.001"} 0 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.003"} 2 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.006"} 8 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.01"} 9 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.018"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.024"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.032"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.042"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.056"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.075"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.1"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.178"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.316"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="0.562"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="1"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="5"} 10 +grpc_server_handling_seconds_bucket{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream",le="+Inf"} 10 +grpc_server_handling_seconds_sum{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream"} 0.043256006 +grpc_server_handling_seconds_count{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream"} 10 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.001"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.003"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.006"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.01"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.018"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.024"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.032"} 0 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.042"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.056"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.075"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.1"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.178"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.316"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="0.562"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="1"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="5"} 1 +grpc_server_handling_seconds_bucket{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary",le="+Inf"} 1 +grpc_server_handling_seconds_sum{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary"} 0.036535555 +grpc_server_handling_seconds_count{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary"} 1 +# HELP grpc_server_msg_received_total Total number of RPC stream messages received on the server. +# TYPE grpc_server_msg_received_total counter +grpc_server_msg_received_total{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream"} 110 +grpc_server_msg_received_total{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary"} 1 +# HELP grpc_server_msg_sent_total Total number of gRPC stream messages sent by the server. +# TYPE grpc_server_msg_sent_total counter +grpc_server_msg_sent_total{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream"} 10 +grpc_server_msg_sent_total{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary"} 1 +# HELP grpc_server_started_total Total number of RPCs started on the server. +# TYPE grpc_server_started_total counter +grpc_server_started_total{grpc_method="ImportBulkRelationships",grpc_service="authzed.api.v1.PermissionsService",grpc_type="client_stream"} 10 +grpc_server_started_total{grpc_method="WriteSchema",grpc_service="authzed.api.v1.SchemaService",grpc_type="unary"} 1 +# HELP process_cpu_seconds_total Total user and system CPU time spent in seconds. +# TYPE process_cpu_seconds_total counter +process_cpu_seconds_total 0.21 +# HELP process_max_fds Maximum number of open file descriptors. +# TYPE process_max_fds gauge +process_max_fds 524288 +# HELP process_network_receive_bytes_total Number of bytes received by the process over the network. +# TYPE process_network_receive_bytes_total counter +process_network_receive_bytes_total 81639 +# HELP process_network_transmit_bytes_total Number of bytes sent by the process over the network. +# TYPE process_network_transmit_bytes_total counter +process_network_transmit_bytes_total 26309 +# HELP process_open_fds Number of open file descriptors. +# TYPE process_open_fds gauge +process_open_fds 8 +# HELP process_resident_memory_bytes Resident memory size in bytes. +# TYPE process_resident_memory_bytes gauge +process_resident_memory_bytes 4.8422912e+07 +# HELP process_start_time_seconds Start time of the process since unix epoch in seconds. +# TYPE process_start_time_seconds gauge +process_start_time_seconds 1.73170474039e+09 +# HELP process_virtual_memory_bytes Virtual memory size in bytes. +# TYPE process_virtual_memory_bytes gauge +process_virtual_memory_bytes 1.347796992e+09 +# HELP process_virtual_memory_max_bytes Maximum amount of virtual memory available in bytes. +# TYPE process_virtual_memory_max_bytes gauge +process_virtual_memory_max_bytes 1.8446744073709552e+19 +# HELP spicedb_cache_cost_added_bytes Cost of entries added to the cache +# TYPE spicedb_cache_cost_added_bytes counter +spicedb_cache_cost_added_bytes{cache="dispatch"} 0 +spicedb_cache_cost_added_bytes{cache="namespace"} 0 +# HELP spicedb_cache_cost_evicted_bytes Cost of entries evicted from the cache +# TYPE spicedb_cache_cost_evicted_bytes counter +spicedb_cache_cost_evicted_bytes{cache="dispatch"} 0 +spicedb_cache_cost_evicted_bytes{cache="namespace"} 0 +# HELP spicedb_cache_hits_total Number of cache hits +# TYPE spicedb_cache_hits_total counter +spicedb_cache_hits_total{cache="dispatch"} 0 +spicedb_cache_hits_total{cache="namespace"} 0 +# HELP spicedb_cache_misses_total Number of cache misses +# TYPE spicedb_cache_misses_total counter +spicedb_cache_misses_total{cache="dispatch"} 0 +spicedb_cache_misses_total{cache="namespace"} 0 +# HELP spicedb_check_direct_dispatch_query_count number of queries made per direct dispatch +# TYPE spicedb_check_direct_dispatch_query_count histogram +spicedb_check_direct_dispatch_query_count_bucket{le="1"} 0 +spicedb_check_direct_dispatch_query_count_bucket{le="2"} 0 +spicedb_check_direct_dispatch_query_count_bucket{le="+Inf"} 0 +spicedb_check_direct_dispatch_query_count_sum 0 +spicedb_check_direct_dispatch_query_count_count 0 +# HELP spicedb_check_dispatch_chunk_count number of chunks when dispatching in check +# TYPE spicedb_check_dispatch_chunk_count histogram +spicedb_check_dispatch_chunk_count_bucket{le="1"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="2"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="3"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="5"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="10"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="25"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="100"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="250"} 0 +spicedb_check_dispatch_chunk_count_bucket{le="+Inf"} 0 +spicedb_check_dispatch_chunk_count_sum 0 +spicedb_check_dispatch_chunk_count_count 0 +# HELP spicedb_datastore_crdb_watch_retries watch retry distribution +# TYPE spicedb_datastore_crdb_watch_retries histogram +spicedb_datastore_crdb_watch_retries_bucket{le="0"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="1"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="2"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="5"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="10"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="20"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="50"} 0 +spicedb_datastore_crdb_watch_retries_bucket{le="+Inf"} 0 +spicedb_datastore_crdb_watch_retries_sum 0 +spicedb_datastore_crdb_watch_retries_count 0 +# HELP spicedb_datastore_hedgeable_requests_total total number of datastore requests which are eligible for hedging +# TYPE spicedb_datastore_hedgeable_requests_total counter +spicedb_datastore_hedgeable_requests_total 0 +# HELP spicedb_datastore_hedged_requests_total total number of requests which have been hedged +# TYPE spicedb_datastore_hedged_requests_total counter +spicedb_datastore_hedged_requests_total 0 +# HELP spicedb_datastore_loaded_relationships_count total number of relationships loaded for a query +# TYPE spicedb_datastore_loaded_relationships_count histogram +spicedb_datastore_loaded_relationships_count_bucket{le="0"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="1"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="3"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="10"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="32"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="100"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="316"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="1000"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="3162"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="10000"} 0 +spicedb_datastore_loaded_relationships_count_bucket{le="+Inf"} 0 +spicedb_datastore_loaded_relationships_count_sum 0 +spicedb_datastore_loaded_relationships_count_count 0 +# HELP spicedb_datastore_query_latency response latency for a database query +# TYPE spicedb_datastore_query_latency histogram +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.0005"} 8 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.001"} 8 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.002"} 12 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.005"} 19 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.01"} 20 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.02"} 20 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.05"} 20 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.1"} 20 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.2"} 20 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="0.5"} 20 +spicedb_datastore_query_latency_bucket{operation="BulkLoad",le="+Inf"} 20 +spicedb_datastore_query_latency_sum{operation="BulkLoad"} 0.0360925 +spicedb_datastore_query_latency_count{operation="BulkLoad"} 20 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.0005"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.001"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.002"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.005"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.01"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.02"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.05"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.1"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.2"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="0.5"} 1 +spicedb_datastore_query_latency_bucket{operation="Features",le="+Inf"} 1 +spicedb_datastore_query_latency_sum{operation="Features"} 7.74e-07 +spicedb_datastore_query_latency_count{operation="Features"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.0005"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.001"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.002"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.005"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.01"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.02"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.05"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.1"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.2"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="0.5"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllCaveats",le="+Inf"} 1 +spicedb_datastore_query_latency_sum{operation="ListAllCaveats"} 0.000403808 +spicedb_datastore_query_latency_count{operation="ListAllCaveats"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.0005"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.001"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.002"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.005"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.01"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.02"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.05"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.1"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.2"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="0.5"} 1 +spicedb_datastore_query_latency_bucket{operation="ListAllNamespaces",le="+Inf"} 1 +spicedb_datastore_query_latency_sum{operation="ListAllNamespaces"} 1.365e-06 +spicedb_datastore_query_latency_count{operation="ListAllNamespaces"} 1 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.0005"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.001"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.002"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.005"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.01"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.02"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.05"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.1"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.2"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="0.5"} 10 +spicedb_datastore_query_latency_bucket{operation="LookupNamespacesWithNames",le="+Inf"} 10 +spicedb_datastore_query_latency_sum{operation="LookupNamespacesWithNames"} 0.000252936 +spicedb_datastore_query_latency_count{operation="LookupNamespacesWithNames"} 10 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.0005"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.001"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.002"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.005"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.01"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.02"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.05"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.1"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.2"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="0.5"} 1 +spicedb_datastore_query_latency_bucket{operation="ReadyState",le="+Inf"} 1 +spicedb_datastore_query_latency_sum{operation="ReadyState"} 6.79e-07 +spicedb_datastore_query_latency_count{operation="ReadyState"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.0005"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.001"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.002"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.005"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.01"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.02"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.05"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.1"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.2"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="0.5"} 1 +spicedb_datastore_query_latency_bucket{operation="Statistics",le="+Inf"} 1 +spicedb_datastore_query_latency_sum{operation="Statistics"} 8.347e-06 +spicedb_datastore_query_latency_count{operation="Statistics"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.0005"} 0 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.001"} 0 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.002"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.005"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.01"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.02"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.05"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.1"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.2"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="0.5"} 1 +spicedb_datastore_query_latency_bucket{operation="WriteNamespaces",le="+Inf"} 1 +spicedb_datastore_query_latency_sum{operation="WriteNamespaces"} 0.001155418 +spicedb_datastore_query_latency_count{operation="WriteNamespaces"} 1 +# HELP spicedb_datastore_spanner_watch_retries watch retry distribution +# TYPE spicedb_datastore_spanner_watch_retries histogram +spicedb_datastore_spanner_watch_retries_bucket{le="0"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="1"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="2"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="5"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="10"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="20"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="50"} 0 +spicedb_datastore_spanner_watch_retries_bucket{le="+Inf"} 0 +spicedb_datastore_spanner_watch_retries_sum 0 +spicedb_datastore_spanner_watch_retries_count 0 +# HELP spicedb_datastore_watching_schema_cache_caveats_fallback_mode value of 1 if the cache is in fallback mode and 0 otherwise +# TYPE spicedb_datastore_watching_schema_cache_caveats_fallback_mode gauge +spicedb_datastore_watching_schema_cache_caveats_fallback_mode 0 +# HELP spicedb_datastore_watching_schema_cache_namespaces_fallback_mode value of 1 if the cache is in fallback mode and 0 otherwise +# TYPE spicedb_datastore_watching_schema_cache_namespaces_fallback_mode gauge +spicedb_datastore_watching_schema_cache_namespaces_fallback_mode 0 +# HELP spicedb_datastore_watching_schema_cache_tracked_revision the currently tracked max revision for the schema cache +# TYPE spicedb_datastore_watching_schema_cache_tracked_revision gauge +spicedb_datastore_watching_schema_cache_tracked_revision 0 +# HELP spicedb_dispatch_client_check_from_cache_total +# TYPE spicedb_dispatch_client_check_from_cache_total counter +spicedb_dispatch_client_check_from_cache_total 0 +# HELP spicedb_dispatch_client_check_total +# TYPE spicedb_dispatch_client_check_total counter +spicedb_dispatch_client_check_total 0 +# HELP spicedb_dispatch_client_lookup_resources_from_cache_total +# TYPE spicedb_dispatch_client_lookup_resources_from_cache_total counter +spicedb_dispatch_client_lookup_resources_from_cache_total 0 +# HELP spicedb_dispatch_client_lookup_resources_total +# TYPE spicedb_dispatch_client_lookup_resources_total counter +spicedb_dispatch_client_lookup_resources_total 0 +# HELP spicedb_dispatch_client_lookup_subjects_from_cache_total +# TYPE spicedb_dispatch_client_lookup_subjects_from_cache_total counter +spicedb_dispatch_client_lookup_subjects_from_cache_total 0 +# HELP spicedb_dispatch_client_lookup_subjects_total +# TYPE spicedb_dispatch_client_lookup_subjects_total counter +spicedb_dispatch_client_lookup_subjects_total 0 +# HELP spicedb_dispatch_client_reachable_resources_from_cache_total +# TYPE spicedb_dispatch_client_reachable_resources_from_cache_total counter +spicedb_dispatch_client_reachable_resources_from_cache_total 0 +# HELP spicedb_dispatch_client_reachable_resources_total +# TYPE spicedb_dispatch_client_reachable_resources_total counter +spicedb_dispatch_client_reachable_resources_total 0 +# HELP spicedb_services_dispatches Histogram of cluster dispatches performed by the instance. +# TYPE spicedb_services_dispatches histogram +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="1"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="5"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="10"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="25"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="50"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="100"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="250"} 10 +spicedb_services_dispatches_bucket{cached="false",method="ImportBulkRelationships",le="+Inf"} 10 +spicedb_services_dispatches_sum{cached="false",method="ImportBulkRelationships"} 10 +spicedb_services_dispatches_count{cached="false",method="ImportBulkRelationships"} 10 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="1"} 0 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="5"} 1 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="10"} 1 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="25"} 1 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="50"} 1 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="100"} 1 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="250"} 1 +spicedb_services_dispatches_bucket{cached="false",method="WriteSchema",le="+Inf"} 1 +spicedb_services_dispatches_sum{cached="false",method="WriteSchema"} 2 +spicedb_services_dispatches_count{cached="false",method="WriteSchema"} 1 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="1"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="5"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="10"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="25"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="50"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="100"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="250"} 10 +spicedb_services_dispatches_bucket{cached="true",method="ImportBulkRelationships",le="+Inf"} 10 +spicedb_services_dispatches_sum{cached="true",method="ImportBulkRelationships"} 0 +spicedb_services_dispatches_count{cached="true",method="ImportBulkRelationships"} 10 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="1"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="5"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="10"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="25"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="50"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="100"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="250"} 1 +spicedb_services_dispatches_bucket{cached="true",method="WriteSchema",le="+Inf"} 1 +spicedb_services_dispatches_sum{cached="true",method="WriteSchema"} 0 +spicedb_services_dispatches_count{cached="true",method="WriteSchema"} 1 diff --git a/spicedb/tests/test_e2e.py b/spicedb/tests/test_e2e.py new file mode 100644 index 0000000000..faadfd7477 --- /dev/null +++ b/spicedb/tests/test_e2e.py @@ -0,0 +1,11 @@ +from .util import get_expected_histogram_metrics, get_expected_non_histogram_metrics + + +def test_metrics(dd_agent_check, instance): + aggregator = dd_agent_check(instance, rate=True) + + for metric in get_expected_non_histogram_metrics(): + aggregator.assert_metric(f"spicedb.{metric}", at_least=0) + + for metric in get_expected_histogram_metrics(): + aggregator.assert_metric(f"spicedb.{metric}", at_least=0) diff --git a/spicedb/tests/test_integration.py b/spicedb/tests/test_integration.py new file mode 100644 index 0000000000..4ee92f8789 --- /dev/null +++ b/spicedb/tests/test_integration.py @@ -0,0 +1,26 @@ +import pytest + +from datadog_checks.base.constants import ServiceCheck +from datadog_checks.dev.utils import assert_service_checks, get_metadata_metrics +from datadog_checks.spicedb import SpicedbCheck + +from .util import get_expected_histogram_metrics, get_expected_non_histogram_metrics + +# NOTE: this is the same as annotating all of the test functions in this file with the dd_environment fixture. +pytestmark = [pytest.mark.usefixtures("dd_environment")] + + +def test_metrics(aggregator, instance, dd_run_check): + check = SpicedbCheck("spicedb", {}, [instance]) + dd_run_check(check) + + for metric in get_expected_non_histogram_metrics(): + aggregator.assert_metric(f"spicedb.{metric}", at_least=0) + + for metric in get_expected_histogram_metrics(): + aggregator.assert_metric(f"spicedb.{metric}", at_least=0) + + aggregator.assert_service_check("spicedb.openmetrics.health", ServiceCheck.OK) + aggregator.assert_metrics_using_metadata(get_metadata_metrics(), check_submission_type=True) + + assert_service_checks(aggregator) diff --git a/spicedb/tests/test_unit.py b/spicedb/tests/test_unit.py new file mode 100644 index 0000000000..4de094c08b --- /dev/null +++ b/spicedb/tests/test_unit.py @@ -0,0 +1,36 @@ +from datadog_checks.base.constants import ServiceCheck +from datadog_checks.dev.utils import assert_service_checks, get_metadata_metrics +from datadog_checks.spicedb import SpicedbCheck + +from .util import get_expected_histogram_metrics, get_expected_non_histogram_metrics, get_fixture_path + + +def test_metrics(aggregator, instance, dd_run_check, mock_http_response): + mock_http_response(file_path=get_fixture_path("all_metrics.txt")) + check_instance = SpicedbCheck("spicedb", {}, [instance]) + dd_run_check(check_instance) + + tags = ["cluster:spicedb-cluster", "node:1"] + + # TODO: why are these failing? + for metric in get_expected_non_histogram_metrics(): + aggregator.assert_metric("spicedb.{}".format(metric)) + for tag in tags: + aggregator.assert_metric_has_tag("spicedb.{}".format(metric), tag) + + for metric in get_expected_histogram_metrics(): + aggregator.assert_metric("spicedb.{}".format(metric), metric_type=aggregator.HISTOGRAM) + for tag in tags: + aggregator.assert_metric_has_tag("spicedb.{}".format(metric), tag) + + aggregator.assert_service_check("spicedb.openmetrics.health", ServiceCheck.OK) + aggregator.assert_all_metrics_covered() + aggregator.assert_metrics_using_metadata(get_metadata_metrics(), check_submission_type=True) + + assert_service_checks(aggregator) + + +def test_emits_critical_service_check_when_service_is_down(dd_run_check, aggregator, instance): + check = SpicedbCheck("spicedb", {}, [instance]) + dd_run_check(check) + aggregator.assert_service_check("spicedb.openmetrics.health", SpicedbCheck.CRITICAL) diff --git a/spicedb/tests/util.py b/spicedb/tests/util.py new file mode 100644 index 0000000000..f8d2cde604 --- /dev/null +++ b/spicedb/tests/util.py @@ -0,0 +1,27 @@ +import os +from itertools import chain + +from datadog_checks.dev import get_docker_hostname, get_here +from datadog_checks.spicedb.metrics import COUNTER_METRICS, GAUGE_METRICS, HISTOGRAM_METRICS + +HOST = get_docker_hostname() +PORT = "9090" + + +def get_expected_non_histogram_metrics(): + return list( + chain( + # We add a .count suffix because datadog is going to append it before it's sent. + (f"{datadog_name}.count" for datadog_name in COUNTER_METRICS.values()), + # We pass through the other metrics straight. + GAUGE_METRICS.values(), + ) + ) + + +def get_expected_histogram_metrics(): + return HISTOGRAM_METRICS.values() + + +def get_fixture_path(filename): + return os.path.join(get_here(), "fixtures", filename)