Go Kit · Schema
Go Kit Service Transport Configuration
JSON Schema representing Go Kit service transport configuration options for HTTP, gRPC, and other transport layers, including middleware, instrumentation, and service discovery.
Distributed SystemsDomain-Driven DesignFrameworksGoGolangMicroservices
Properties
| Name | Type | Description |
|---|---|---|
| service | object | Service-level configuration. |
| http | object | HTTP transport configuration. |
| grpc | object | gRPC transport configuration. |
| serviceDiscovery | object | Service discovery configuration for client-side load balancing. |
| loadBalancer | object | Client-side load balancer configuration. |
| rateLimit | object | Rate limiting middleware configuration. |
| circuitBreaker | object | Circuit breaker middleware configuration. |
| logging | object | Logging middleware configuration. |
| metrics | object | Metrics instrumentation configuration. |
| tracing | object | Distributed tracing configuration. |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/api-evangelist/go-kit/json-schema/go-kit-transport-config.json",
"title": "Go Kit Service Transport Configuration",
"description": "JSON Schema representing Go Kit service transport configuration options for HTTP, gRPC, and other transport layers, including middleware, instrumentation, and service discovery.",
"type": "object",
"properties": {
"service": {
"type": "object",
"description": "Service-level configuration.",
"properties": {
"name": {
"type": "string",
"description": "Service name for discovery and logging."
},
"version": {
"type": "string",
"description": "Service version."
}
},
"additionalProperties": true
},
"http": {
"type": "object",
"description": "HTTP transport configuration.",
"properties": {
"address": {
"type": "string",
"description": "Bind address for the HTTP server.",
"default": ":8080"
},
"readTimeout": {
"type": "string",
"description": "HTTP read timeout (e.g., 30s).",
"default": "30s"
},
"writeTimeout": {
"type": "string",
"description": "HTTP write timeout.",
"default": "30s"
},
"idleTimeout": {
"type": "string",
"description": "HTTP idle connection timeout.",
"default": "120s"
},
"tls": {
"type": "object",
"description": "TLS configuration for the HTTP transport.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"certFile": {
"type": "string",
"description": "Path to TLS certificate file."
},
"keyFile": {
"type": "string",
"description": "Path to TLS key file."
}
},
"additionalProperties": true
},
"cors": {
"type": "object",
"description": "CORS configuration.",
"properties": {
"allowedOrigins": {
"type": "array",
"items": { "type": "string" },
"default": ["*"]
},
"allowedMethods": {
"type": "array",
"items": { "type": "string" },
"default": ["GET", "POST", "PUT", "DELETE"]
},
"allowedHeaders": {
"type": "array",
"items": { "type": "string" }
},
"allowCredentials": {
"type": "boolean",
"default": false
}
},
"additionalProperties": true
}
},
"additionalProperties": true
},
"grpc": {
"type": "object",
"description": "gRPC transport configuration.",
"properties": {
"address": {
"type": "string",
"description": "Bind address for the gRPC server.",
"default": ":8081"
},
"tls": {
"type": "object",
"description": "TLS configuration for gRPC.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"certFile": {
"type": "string"
},
"keyFile": {
"type": "string"
},
"caFile": {
"type": "string",
"description": "CA certificate for mutual TLS."
}
},
"additionalProperties": true
},
"maxRecvMsgSize": {
"type": "integer",
"description": "Maximum receive message size in bytes.",
"default": 4194304
},
"maxSendMsgSize": {
"type": "integer",
"description": "Maximum send message size in bytes.",
"default": 4194304
},
"keepAlive": {
"type": "object",
"properties": {
"time": {
"type": "string",
"description": "Keepalive ping interval.",
"default": "2h"
},
"timeout": {
"type": "string",
"description": "Keepalive timeout.",
"default": "20s"
}
},
"additionalProperties": true
}
},
"additionalProperties": true
},
"serviceDiscovery": {
"type": "object",
"description": "Service discovery configuration for client-side load balancing.",
"properties": {
"type": {
"type": "string",
"description": "Discovery mechanism.",
"enum": ["consul", "etcd", "eureka", "zookeeper", "dns", "static"],
"default": "consul"
},
"addresses": {
"type": "array",
"description": "Discovery server addresses.",
"items": {
"type": "string"
}
},
"refreshInterval": {
"type": "string",
"description": "How often to refresh the service list.",
"default": "30s"
}
},
"additionalProperties": true
},
"loadBalancer": {
"type": "object",
"description": "Client-side load balancer configuration.",
"properties": {
"strategy": {
"type": "string",
"description": "Load balancing strategy.",
"enum": ["round-robin", "random", "least-connections"],
"default": "round-robin"
},
"retryMax": {
"type": "integer",
"description": "Maximum number of retries.",
"default": 3
},
"retryTimeout": {
"type": "string",
"description": "Per-retry timeout.",
"default": "500ms"
}
},
"additionalProperties": true
},
"rateLimit": {
"type": "object",
"description": "Rate limiting middleware configuration.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"requestsPerSecond": {
"type": "number",
"description": "Maximum requests per second."
},
"burst": {
"type": "integer",
"description": "Burst size for token bucket."
}
},
"additionalProperties": true
},
"circuitBreaker": {
"type": "object",
"description": "Circuit breaker middleware configuration.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"maxRequests": {
"type": "integer",
"description": "Max requests in half-open state.",
"default": 1
},
"interval": {
"type": "string",
"description": "Cyclic period for clearing counts.",
"default": "60s"
},
"timeout": {
"type": "string",
"description": "Open state timeout before transitioning to half-open.",
"default": "60s"
}
},
"additionalProperties": true
},
"logging": {
"type": "object",
"description": "Logging middleware configuration.",
"properties": {
"level": {
"type": "string",
"enum": ["debug", "info", "warn", "error"],
"default": "info"
},
"format": {
"type": "string",
"description": "Log format.",
"enum": ["logfmt", "json"],
"default": "logfmt"
}
},
"additionalProperties": true
},
"metrics": {
"type": "object",
"description": "Metrics instrumentation configuration.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"provider": {
"type": "string",
"description": "Metrics backend provider.",
"enum": ["prometheus", "statsd", "graphite", "influx", "dogstatsd"],
"default": "prometheus"
},
"address": {
"type": "string",
"description": "Metrics server address (for push-based backends)."
},
"prefix": {
"type": "string",
"description": "Metrics name prefix."
}
},
"additionalProperties": true
},
"tracing": {
"type": "object",
"description": "Distributed tracing configuration.",
"properties": {
"enabled": {
"type": "boolean",
"default": false
},
"provider": {
"type": "string",
"description": "Tracing backend provider.",
"enum": ["zipkin", "jaeger", "lightstep", "opentelemetry"],
"default": "zipkin"
},
"endpoint": {
"type": "string",
"description": "Tracing collector endpoint URL."
},
"sampleRate": {
"type": "number",
"description": "Sampling rate (0.0 - 1.0).",
"default": 1.0,
"minimum": 0.0,
"maximum": 1.0
}
},
"additionalProperties": true
}
},
"additionalProperties": true
}