9.2. 配置 APIcast 进行追踪
为确保 3scale API 的可扩展且可靠的网关基础架构,您可以手动配置 APIcast 进行追踪。这将有助于确保 API 服务的可靠且可扩展的网关基础架构。
流程
为 APIcast 工具创建配置文件:
配置文件规格在 NGINX 检测库存储库中定义。
$ oc apply -f - <<EOF
apiVersion: v1 kind: Secret metadata: name: otel-config type: Opaque stringData: config.json: | # "otlp" is the only supported exporter in APIcast exporter = "otlp" processor = "simple" [exporters.otlp] # Alternatively the OTEL_EXPORTER_OTLP_ENDPOINT environment variable can also be used. host = "${COLLECTOR_HOST}" port = ${COLLECTOR_PORT} # Optional: enable SSL, for endpoints that support it # use_ssl = true # Optional: set a filesystem path to a pem file to be used for SSL encryption # (when use_ssl = true) # ssl_cert_path = "/path/to/cert.pem" [processors.batch] max_queue_size = 2048 schedule_delay_millis = 5000 max_export_batch_size = 512 [service] name = "apicast" # Opentelemetry resource name EOF
定义指定
openTelemetry
属性的 APIcast 自定义资源(CR)。在 CR 定义中,将openTelemetry.tracingConfigSecretRef.name
属性设置为包含 openTelemetry 配置详情的 secret 的名称。以下示例显示有关配置 openTelemetry 的内容:apiVersion: apps.3scale.net/v1alpha1 kind: APIcast metadata: name: apicast1 spec: ... openTelemetry: enabled: true tracingConfigSecretRef: name: "$NAME_OF_SECRET"