Configuration¶
SkyWalkingConfig holds every setting of a client. It is immutable after construction,
validated when it is built (invalid values raise a CONFIG error) and its string/debug form
redacts every credential. OAP has no API token for queries: the only credential is the
authentication token of OAP's gRPC receivers (SW_AUTHENTICATION), sent with OTLP exports. When
a gateway protects the query API, put its credentials in headers (values are redacted). The
SkyWalking-specific settings (graphqlPath, otlpEndpoint, otlpProtocol, otlpHeaders,
authentication, zipkinUrl, traceBackend) are listed under Service settings.
Common settings¶
| Setting | Default | Environment variable |
|---|---|---|
url — OAP REST/GraphQL base URL |
http://127.0.0.1:12800 |
GROW_APACHE_SKYWALKING_URL, GROW_SKYWALKING_URL, SW_GRAPHQL_URL, SW_OAP_ADDRESS |
authentication — OAP gRPC token (secret) |
none | GROW_APACHE_SKYWALKING_AUTHENTICATION, SW_AUTHENTICATION, SW_AGENT_AUTHENTICATION |
connectTimeout — connection setup |
10 s | GROW_APACHE_SKYWALKING_CONNECT_TIMEOUT |
requestTimeout — per attempt (headers + body) |
30 s | GROW_APACHE_SKYWALKING_REQUEST_TIMEOUT |
totalTimeout — whole call incl. retries and backoff |
120 s | GROW_APACHE_SKYWALKING_TOTAL_TIMEOUT |
retry — retry policy (below) |
3 retries | GROW_APACHE_SKYWALKING_MAX_RETRIES |
tls.caCertPath / tls.caCertPem — extra CA |
none | GROW_APACHE_SKYWALKING_CA_CERT (path) |
tls.clientCertPath + tls.clientKeyPath — mutual TLS |
none | GROW_APACHE_SKYWALKING_CLIENT_CERT, GROW_APACHE_SKYWALKING_CLIENT_KEY |
tls.insecureSkipVerify — tests only, logs a warning once |
false |
GROW_APACHE_SKYWALKING_INSECURE_SKIP_VERIFY |
proxy — proxy URL |
none (environment proxies are ignored) | GROW_APACHE_SKYWALKING_PROXY |
headers — extra request headers |
{} |
— |
userAgentSuffix — appended to the User-Agent |
none | — |
hooks — request/response callbacks (Hooks) |
none | — |
logger — diagnostic logger (Hooks) |
silent | — |
Every request sends User-Agent: grow-codes-apache-skywalking/<version> (<language>).
From the environment¶
fromEnv resolves each setting with this precedence:
- the value passed in code (overrides),
GROW_APACHE_SKYWALKING_<NAME>,- the vendor variables of Apache SkyWalking (see Functions), in their documented order,
- the default.
Parsing rules:
- Durations accept integer milliseconds (
1500) or Go-style units:500ms,10s,2m,1h, combinations such as1m30s. - Booleans accept
true/false,1/0,yes/no,on/off(any case). - An empty variable counts as unset.
- A present but invalid value raises a
CONFIGerror that names the variable, never its value.
import { SkyWalkingClient, SkyWalkingConfig } from "@grow-codes/apache-skywalking";
// Environment only
const client = SkyWalkingClient.fromEnv();
// Environment with explicit overrides (explicit values win)
const config = SkyWalkingConfig.fromEnv({ requestTimeoutMs: 5_000 });
// Everything in code
const explicit = new SkyWalkingConfig({
url: "https://apache-skywalking.example.com",
authentication: process.env.OAP_TOKEN,
connectTimeoutMs: 5_000,
requestTimeoutMs: 15_000,
totalTimeoutMs: 60_000,
retry: { maxRetries: 5, initialBackoffMs: 200 },
tls: { caCertPath: "/etc/ssl/internal-ca.pem" },
proxy: "http://proxy.internal:3128",
headers: { "x-team": "payments" },
userAgentSuffix: "my-app/1.4",
});
const custom = new SkyWalkingClient(explicit);
console.log(String(explicit)); // authentication shown as [REDACTED]
use std::time::Duration;
use grow_apache_skywalking::{SkyWalkingClient, SkyWalkingConfig, RetryPolicy};
// Environment only
let client = SkyWalkingClient::from_env()?;
// Environment with explicit overrides (explicit values win)
let config = SkyWalkingConfig::builder()
.request_timeout(Duration::from_secs(5))
.build_from_env()?;
// Everything in code
let explicit = SkyWalkingConfig::builder()
.url("https://apache-skywalking.example.com")
.authentication(std::env::var("OAP_TOKEN").unwrap_or_default())
.connect_timeout(Duration::from_secs(5))
.request_timeout(Duration::from_secs(15))
.total_timeout(Duration::from_secs(60))
.retry(RetryPolicy::default().with_max_retries(5))
.ca_cert_path("/etc/ssl/internal-ca.pem")
.proxy("http://proxy.internal:3128")
.header("x-team", "payments")
.user_agent_suffix("my-app/1.4")
.build()?;
let custom = SkyWalkingClient::new(explicit)?;
println!("{:?}", custom.config()); // authentication shown as [REDACTED]
// Environment only
client, err := skywalking.NewClientFromEnv()
// Everything in code: zero values mean "use the default"
cfg := skywalking.Config{
CommonConfig: skywalking.CommonConfig{
URL: "https://apache-skywalking.example.com",
ConnectTimeout: 5 * time.Second,
RequestTimeout: 15 * time.Second,
TotalTimeout: time.Minute,
Retry: &skywalking.RetryPolicy{MaxRetries: 5, InitialBackoff: 200 * time.Millisecond},
TLS: skywalking.TLSConfig{CACertPath: "/etc/ssl/internal-ca.pem"},
Proxy: "http://proxy.internal:3128",
Headers: map[string]string{"x-team": "payments"},
UserAgentSuffix: "my-app/1.4",
},
Authentication: skywalking.NewSecret(os.Getenv("OAP_TOKEN")),
}
if err := cfg.Validate(); err != nil {
log.Fatal(err) // errors.Is(err, skywalking.ErrConfig)
}
custom, err := skywalking.NewClient(cfg)
// Environment with explicit overrides (explicit values win; nil env = process environment)
merged, err := skywalking.ConfigFromEnvWith(skywalking.Config{
CommonConfig: skywalking.CommonConfig{RequestTimeout: 5 * time.Second},
}, nil)
fmt.Println(merged) // authentication shown as [REDACTED]
import os
from grow_apache_skywalking import RetryPolicy, TlsConfig, SkyWalkingClient, SkyWalkingConfig
# Environment only
client = SkyWalkingClient.from_env()
# Environment with explicit overrides (explicit values win)
config = SkyWalkingConfig.from_env(request_timeout=5.0)
# Everything in code: durations are float seconds (datetime.timedelta also works)
explicit = SkyWalkingConfig(
url="https://apache-skywalking.example.com",
authentication=os.environ.get("OAP_TOKEN"),
connect_timeout=5.0,
request_timeout=15.0,
total_timeout=60.0,
retry=RetryPolicy(max_retries=5, initial_backoff=0.2),
tls=TlsConfig(ca_cert_path="/etc/ssl/internal-ca.pem"),
proxy="http://proxy.internal:3128",
headers={"x-team": "payments"},
user_agent_suffix="my-app/1.4",
)
custom = SkyWalkingClient(explicit)
print(repr(explicit)) # authentication shown as [REDACTED]
import java.time.Duration;
import codes.grow.packages.skywalking.SkyWalkingClient;
import codes.grow.packages.skywalking.SkyWalkingConfig;
import codes.grow.packages.skywalking.core.RetryPolicy;
// Environment only
SkyWalkingClient client = SkyWalkingClient.fromEnv();
// Everything in code
SkyWalkingConfig config = SkyWalkingConfig.builder()
.url("https://apache-skywalking.example.com")
.authentication(System.getenv("OAP_TOKEN"))
.connectTimeout(Duration.ofSeconds(5))
.requestTimeout(Duration.ofSeconds(15))
.totalTimeout(Duration.ofMinutes(1))
.retry(RetryPolicy.builder().maxRetries(5).initialBackoff(Duration.ofMillis(200)).build())
.proxy("http://proxy.internal:3128")
.header("x-team", "payments")
.userAgentSuffix("my-app/1.4")
.build();
SkyWalkingClient custom = SkyWalkingClient.create(config);
System.out.println(config); // authentication shown as [REDACTED]
Service settings¶
| Setting | Default | Environment variables (precedence order) |
|---|---|---|
graphqlPath |
/graphql |
GROW_APACHE_SKYWALKING_GRAPHQL_PATH |
otlpEndpoint — OTLP gRPC receiver for initTracing |
http://<url host>:11800 |
GROW_APACHE_SKYWALKING_OTLP_ENDPOINT, GROW_SKYWALKING_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_ENDPOINT, SW_AGENT_COLLECTOR_BACKEND_SERVICES (host:port[,…], first entry) |
otlpProtocol — grpc or http/protobuf (collector only) |
grpc |
GROW_APACHE_SKYWALKING_OTLP_PROTOCOL, GROW_SKYWALKING_OTLP_PROTOCOL, OTEL_EXPORTER_OTLP_TRACES_PROTOCOL, OTEL_EXPORTER_OTLP_PROTOCOL |
otlpHeaders — extra exporter headers / gRPC metadata |
none | GROW_APACHE_SKYWALKING_OTLP_HEADERS, OTEL_EXPORTER_OTLP_TRACES_HEADERS, OTEL_EXPORTER_OTLP_HEADERS (k=v,k2=v2, URL-decoded) |
zipkinUrl — Zipkin query API (OTLP spans) |
http://<url host>:9412/zipkin |
GROW_APACHE_SKYWALKING_ZIPKIN_URL, GROW_SKYWALKING_ZIPKIN_URL, SW_ZIPKIN_ADDRESS (/zipkin appended) |
traceBackend — auto, zipkin, native (Trace queries) |
auto |
GROW_APACHE_SKYWALKING_TRACE_BACKEND, GROW_SKYWALKING_TRACE_BACKEND |
GROW_SKYWALKING_<NAME> (the short prefix from the stack catalog) is accepted after
GROW_APACHE_SKYWALKING_<NAME> for URL, OTLP_ENDPOINT, OTLP_PROTOCOL, AUTHENTICATION,
ZIPKIN_URL, TRACE_BACKEND, CA_CERT, CLIENT_CERT, CLIENT_KEY, INSECURE_SKIP_VERIFY and
PROXY. Field names follow each language (otlp_endpoint in Rust and Python, OTLPEndpoint in
Go).
Retry policy¶
| Field | Default | Meaning |
|---|---|---|
maxRetries |
3 | retries after the first attempt (so up to 4 attempts) |
initialBackoff |
100 ms | backoff cap of the first retry |
maxBackoff |
10 s | cap of every backoff |
multiplier |
2 | growth of the cap per retry |
maxRetryAfter |
60 s | longest server-requested Retry-After the client waits for |
Backoff for retry n (0-based) is full jitter: a random wait between 0 and
min(maxBackoff, initialBackoff × multiplier^n).
Requests are retried on HTTP 429, 408, 502, 503, 504 and on network errors. Idempotent
requests (GET HEAD OPTIONS PUT DELETE, or marked idempotent) are also retried on HTTP 500.
Other requests (for example POST) are retried only on 429 and on connection errors that happened
before the request was sent, never after an uncertain send.
On 429 and 503 the client honours Retry-After (seconds or HTTP date) and waits
max(retryAfter, backoff). When that wait exceeds maxRetryAfter or the remaining
totalTimeout, it stops at once with RATE_LIMITED/UNAVAILABLE and sets retryAfter on the
error. Set maxRetries to 0 to turn retries off.
Timeouts and cancellation¶
connectTimeoutbounds connection setup,requestTimeouteach attempt,totalTimeoutthe whole call including backoff sleeps. An exhausted timeout raisesTIMEOUT.- Cancellation is honoured during requests and backoff sleeps and raises
CANCELLED: TypeScript{ signal }(AbortSignal), Rust dropping the future, Goctx, Pythoncancel=(CancelToken) or task cancellation, Java…Asyncfutures (cancel(true)).
TLS and proxies¶
- Add a private CA with
tls.caCertPath(or the PEM text intls.caCertPem). - Mutual TLS needs
tls.clientCertPathandtls.clientKeyPathtogether. tls.insecureSkipVerifydisables certificate checks. Use it for local tests only; the client logs a warning once.HTTP_PROXY/HTTPS_PROXYare ignored so that credentials never leave through an unexpected proxy. Setproxy(orGROW_APACHE_SKYWALKING_PROXY) to use one.