Skip to main content
Version: v2.x

Metadata API Reference: Observability Options

Introduction

The API to manage Observability related metadata configurations.

Logs and metrics configuration

Available on: Cloud Professional

These are the configurations that govern the metrics and logging output for debugging and analytics.

set_metrics_config

set_metrics_config is used to add/update logs and metrics configurations.

POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "set_metrics_config",
"args": {
"analyze_query_variables": false
}
}

Args syntax

KeyRequiredSchemaDescription
analyze_query_variablesfalsebooleanEnables logging of the values of the query variables provided for each request. Default is false.

Please see the corresponding feature documentation for the usage of these configurations.

remove_metrics_config

remove_metrics_config is used to remove all metrics configurations.

POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "remove_metrics_config",
"args": {}
}

OpenTelemetry Configuration

The OpenTelemetry configuration enables export of distributed traces and metrics to an to an OpenTelemetry compliant APM receiver.

set_opentelemetry_config

set_opentelemetry_config is used to add/update OpenTelemetry configuration.

Supported from

OpenTelemetry traces are supported for Hasura GraphQL Engine versions v2.18.0 and above.

POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "set_opentelemetry_config",
"args": {
"status": "enabled",
"data_types": [
"traces",
"metrics",
"logs"
],
"exporter_otlp": {
"otlp_traces_endpoint": "http://localhost:4318/v1/traces",
"otlp_metrics_endpoint": "http://localhost:4318/v1/metrics",
"otlp_logs_endpoint": "http://localhost:4318/v1/logs",
"protocol": "http/protobuf",
"traces_propagators": ["tracecontext"],
"headers": [
{
"name": "x-test-header",
"value": "testing"
},
{
"name": "x-header-from-env",
"value_from_env": "TEST_ENV_VAR"
}
],
"resource_attributes": [
{
"name": "stage",
"value": "production"
},
{
"name": "region",
"value": "us-east"
}
]
},
"batch_span_processor": {
"max_export_batch_size": 100
}
}
}

Args syntax

KeyRequiredSchemaDescription
statusfalseStringToggle to enable or disable the export. Allowed values are enabled and disabled. Default is disabled (If status is not explicitely passed, then the configuration gets disabled)
data_typesfalse[String]List of the types of observability data points to be exported. Allowed types: traces, metrics and logs only
exporter_otlpfalseOTLPExporter. This is required if status is enabledOpenTelemetry compliant receiver configuration
batch_span_processorfalseOpenTelemetryBatchSpanProcessorOpenTelemetry batch export configuration

set_opentelemetry_status

set_opentelemetry_status is used to set just the status field of the OpenTelemetry configuration, which enable/disable the export to the OpenTelemetry receiver. Other configuration settings are preserved.

Supported from

This is supported for versions v2.18.0 and above.

POST /v1/metadata HTTP/1.1
Content-Type: application/json
X-Hasura-Role: admin
{
"type": "set_opentelemetry_status",
"args": "enabled"
}

Allowed values of args are enabled and disabled