Dataway¶
Introduction¶
Dataway is the data gateway of Guance. Data reported by collectors to Guance must pass through the Dataway gateway.
Dataway Installation¶
- Create Dataway
In the Guance management console, on the Data Gateway page, click Create Dataway. Enter a name and bind address, and then click Create.
After successful creation, a new Dataway is automatically created and its installation script is generated.
Info
The bind address is the Dataway gateway address. You must enter a complete HTTP address, for example http(s)://1.2.3.4:9528, including the protocol, host address, and port. The host address can generally be the IP address of the machine where Dataway is deployed, or it can be a domain name. The domain name must be properly resolved.
Note: Ensure that collectors can access this address; otherwise, data collection will fail.
- Install Dataway
DW_KODO=http://kodo_ip:port \
DW_TOKEN=<tkn_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX> \
DW_UUID=<YOUR_UUID> \
bash -c "$(curl https://static.guance.com/dataway/install.sh)"
Host installation is no longer recommended. Install Dataway directly using a Kubernetes StatefulSet.
After installation, dataway.yaml is generated in the installation directory. Its example content is as follows. You can modify it manually and restart the service for the changes to take effect.
dataway.yaml (click to expand)
# ============= DATAWAY CONFIG =============
# Dataway UUID, we can get it on during create a new dataway
uuid:
# It's the workspace token, most of the time, it's
# system worker space's token.
token:
# secret_token used under sinker mode, and to check if incomming datakit
# requests are valid.
secret_token:
# If __internal__ token allowed? If ok, the data/request will direct to
# the workspace with the token above
enable_internal_token: false
# is empty token allowed? If ok, the data/request will direct to
# the workspace with the token above
enable_empty_token: false
# Is dataway cascaded? For cascaded Dataway, it's remote_host is
# another Dataway and not Kodo.
cascaded: false
# kodo(next dataway) related configures
remote_host:
http_timeout: 3s
# Inbound HTTP deadline, independent of downstream request timeout
http_read_timeout: 5m
http_write_timeout: 10m
http_idle_timeout: 2m
http_max_idle_conn_perhost: 0 # default to CPU cores
http_max_conn_perhost: 0 # default no limit
kodo_queue:
enabled: true
# Also limits the number of HTTP requests admitted for processing before reading the Body
workers: 256
queue_size: 1024
queue_max_bytes: 1073741824 # 1GB
enqueue_timeout: 100ms
insecure_skip_verify: false
http_client_trace: false
sni: ""
# dataway API configures
# IPv4 and IPv6 use independent listeners to avoid relying on the operating system's bindv6only behavior
bind: 0.0.0.0:9528
# IPv6 is disabled by default; explicitly set it to "[::]:9528" when needed
bind_ipv6: ""
# Only requests from trusted proxies use forwarding headers for IP allowlist checks
# trusted_proxies:
# - 10.0.0.0/8
# - 2001:db8:ffff::/48
# disable 404 page
disable_404page: false
# dataway TLS file path
tls_crt:
tls_key:
# pprof is disabled by default; only loopback listen addresses are allowed
pprof_bind: ""
api_limit_rate : 100000 # 100K
max_http_body_bytes : 67108864 # 64MB
copy_buffer_drop_size : 262144 # 256KB, if copy buffer memory larger than this, this memory released
reserved_pool_size: 4096 # reserved pool size for better GC
within_docker: false
log_level: info
log: log
gin_log: gin.log # Set to an empty string to disable HTTP access logs
ip_black_list:
ttl: "1m"
clean_interval: "1h"
cache_cfg:
# cache disk path
dir: "disk_cache"
# disable cache
disabled: false
clean_interval: "1s"
# in MB, max single data package size in disk cache, such as HTTP body
max_data_size: 100
# in MB, single disk-batch(single file) size
batch_size: 128
# in MB, max disk size allowed to cache data
max_disk_size: 65535
# expire duration, default 7 days
expire_duration: "168h"
prometheus:
listen: "localhost:9090"
url: "/metrics"
enable: true
#sinker:
# cache_options:
# prealloc: true
# reserved_capacity: 10000000 # max cached items
# buckets: 64
# ttl: 10m # clear unactive matches
# etcd:
# urls:
# - http://localhost:2379 # one or multiple etcd host
# dial_timeout: 30s
# key_space: "/dw_sinker" # subscribe to the etcd key
# username: "dataway"
# password: "<PASSWORD>"
# file:
# path: /path/to/sinker.json
The Dataway Pod YAML is as follows:
dataway-statefulset.yaml (click to expand)
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: sts-utils-dataway
name: dataway
namespace: utils
spec:
replicas: 2
selector:
matchLabels:
app: sts-utils-dataway
serviceName: dataway
template:
metadata:
annotations:
datakit/logs: |
[
{
"disable": false,
"source": "dataway",
"service": "dataway",
"multiline_match": "^\\d{4}|^\\[GIN\\]"
}
]
datakit/prom.instances: |
[[inputs.prom]]
url = "http://$IP:9090/metrics"
source = "dataway"
measurement_name = "dw"
interval = "10s"
disable_instance_tag = true
[inputs.prom.tags]
service = "dataway"
instance = "$PODNAME" # we can set as "xxx-$PODNAME"
labels:
app: sts-utils-dataway
spec:
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- sts-utils-dataway
topologyKey: kubernetes.io/hostname
containers:
- env:
- name: DW_REMOTE_HOST
value: http://kodo.forethought-kodo:9527
- name: DW_BIND
value: 0.0.0.0:9528
# To listen on IPv6, uncomment the following two lines
# - name: DW_BIND_IPV6
# value: "[::]:9528"
- name: DW_UUID
value: agnt_xxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Dataway UUID
- name: DW_TOKEN
value: tkn_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx # Dataway token
- name: DW_PROM_LISTEN
value: 0.0.0.0:9090
- name: DW_LOG
value: stdout
- name: DW_LOG_LEVEL
value: info
- name: DW_GIN_LOG
value: stdout
- name: DW_DISKCACHE_DIR
value: cache
- name: DW_HTTP_TIMEOUT
value: '3s'
- name: DW_ENABLE_INTERNAL_TOKEN
value: 'false'
- name: DW_MAX_HTTP_BODY_BYTES
value: '67108864'
- name: DW_HTTP_CLIENT_TRACE
value: 'on'
- name: DW_RESERVED_POOL_SIZE
value: '0'
- name: DW_COPY_BUFFER_DROP_SIZE
value: '262144'
- name: DW_DISKCACHE_CAPACITY_MB
value: 102400
image: pubrepo.guance.com/dataflux/dataway:1.22.2
imagePullPolicy: IfNotPresent
name: dataway
ports:
- containerPort: 9528
name: 9528tcp01
protocol: TCP
resources:
limits:
cpu: '4'
memory: 4Gi
requests:
cpu: 100m
memory: 512Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /usr/local/cloudcare/dataflux/dataway/cache
name: dataway-cache
dnsPolicy: ClusterFirst
imagePullSecrets: []
#nodeSelector:
# nodepool: dataway
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
#tolerations:
# - effect: NoSchedule
# key: nodepool
# operator: Equal
# value: dataway
updateStrategy:
rollingUpdate:
partition: 0
type: RollingUpdate
volumeClaimTemplates:
- apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: dataway-cache
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Gi
storageClassName: xxxxxx # High-Performance Storage StorageClass
volumeMode: Filesystem
status:
phase: Pending
---
apiVersion: v1
kind: Service
metadata:
name: dataway
namespace: utils
spec:
ipFamilyPolicy: SingleStack # For dual-stack mode, change to PreferDualStack
# ipFamilies:
# - IPv4
# - IPv6
ports:
- name: 9528tcp02
nodePort: 30928
port: 9528
protocol: TCP
targetPort: 9528
selector:
app: sts-utils-dataway
type: NodePort
The default example uses IPv4 single-stack. To enable dual-stack, confirm that the Kubernetes cluster and CNI support IPv4/IPv6 dual-stack, and then modify the following configurations at the same time:
- In the Dataway container environment variables, uncomment
DW_BIND_IPV6and set it to[::]:9528so that Dataway listens on both IPv4 and IPv6. - Change the Service
ipFamilyPolicyfromSingleStacktoPreferDualStack, and uncommentIPv4andIPv6underipFamilies.
Both items must be enabled at the same time. If you modify only the Service without setting DW_BIND_IPV6, Dataway will not receive IPv6 requests.
You can modify Dataway configuration through environment variables in dataway-statefulset.yaml. See here.
You can also mount an external dataway.yaml through a ConfigMap, but it must be mounted as /usr/local/cloudcare/dataflux/dataway/dataway.yaml:
The environment variables required for container installation are the same as those for Kubernetes. Use the following Docker command to start a Dataway container:
docker run -d \
--name <YOUR-DW-IN-DOCKER> \
-p 19528:9528 -p 19090:9090 \
--mount type=bind,source=<host/path/for/diskcache>,target=/usr/local/cloudcare/dataflux/dataway/cache \
--memory=2g --memory-reservation=256m \
--cpus="2" \
-e DW_UUID=<YOUR-AGNT_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX> \
-e DW_TOKEN=<YOUR-TKN_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX> \
-e DW_REMOTE_HOST=http://kodo.forethought-kodo:9527 \
-e DW_BIND=0.0.0.0:9528 \
-e DW_PROM_LISTEN=0.0.0.0:9090 \
-e DW_HTTP_CLIENT_TRACE=true \
-e DW_LOG_LEVEL=info \
-e DW_LOG=stdout \
-e DW_GIN_LOG=stdout \
-e DW_DISKCACHE_CAPACITY_MB=65536 \
pubrepo.guance.com/dataflux/dataway:1.22.2
Notes
- Dataway can run only on Linux (currently only Linux arm64/amd64 binaries are released).
- For host installation, the Dataway installation path is /usr/local/cloudcare/dataflux/dataway.
- Under Kubernetes, a resource limit of 4000m/4Gi is set by default and can be adjusted as needed. The minimum requirement is 100m/512Mi.
- Verify Dataway Installation
After installation, wait a moment and refresh the Data Gateway page. If you see a version number in the Version Information column of the Dataway you just added, the Dataway has successfully connected to the Guance center, and frontend users can use it to ingest data.
After Dataway successfully connects to the Guance center, log in to the Guance console. On the Integrations / DataKit page, you can view all Dataway addresses. Select the required Dataway gateway address, obtain the DataKit installation command, and run it on the server to start collecting data.
Manage Dataway¶
Delete Dataway¶
In the Guance management console, on the Data Gateway page, select the Dataway to delete, click Configure, and in the Edit Dataway dialog that appears, click the Delete button in the lower left corner.
Warning
After deleting the Dataway, you must also log in to the server where the Dataway gateway is deployed, stop Dataway, and then delete the installation directory to completely remove Dataway.
Upgrade Dataway¶
In the Guance management console, on the Data Gateway page, if a Dataway upgrade is available, an upgrade prompt appears in Version Information.
Dataway Service Management¶
For host installation of Dataway, you can use the following commands to manage the Dataway service.
# Start
$ systemctl start dataway
# Restart
$ systemctl restart dataway
# Stop
$ systemctl stop dataway
For Kubernetes, restart the corresponding Pod.
Environment Variables¶
Image Environment Variables¶
When Dataway runs in a Kubernetes environment, it supports the following environment variables.
Compatibility with Existing dataway.yaml
Some older Dataways inject configuration through a ConfigMap (the file mounted into the container is usually named dataway.yaml).
If the Dataway image detects a file mounted from a ConfigMap in the installation directory after startup, the following DW_* environment variables will not take effect.
These environment variables take effect only after you remove the existing ConfigMap mount.
If the environment variables take effect, a hidden .dataway.yaml file appears in the Dataway installation directory (view it with ls -a). You can cat
this file to confirm whether the environment variables have taken effect.
HTTP Server Settings¶
HTTP requests are concurrency-limited before the body is read. The upper limit reuses kodo_queue.workers (environment variable DW_KODO_QUEUE_WORKERS), default 256; the default value is used when it is unset or not a positive number. After the limit is reached, at most 128 additional requests can wait, for up to 1s, and the body is not read during the wait. The concurrency slot is released after request processing ends. When the wait queue is full or the wait times out, registered DK-compatible endpoints return 503, and other endpoints return 429; all include Retry-After: 1. These requests do not enter the disk cache. This status code distinction applies only to HTTP concurrency admission rejection and does not change the error responses of subsequent forwarding and caching. All requests with a body share the same concurrency limit; requests without a body are not counted. The HTTP concurrency limit shares the configured value with Kodo workers but is not bound to specific workers. Disabling the Kodo dispatch queue does not disable the HTTP concurrency limit. This limit does not guarantee total Pod memory.
When an HTTP/1.x request is rejected by the concurrency limit, Dataway stops reading the remaining body and closes the connection after returning the response; the client must establish a new connection when retrying.
Inbound HTTP requests use the following deadlines, all independent of the downstream http_timeout:
| Configuration Item | Default Value | Description |
|---|---|---|
http_read_timeout |
5m |
Limits the total body upload duration. For HTTP/1.x, this also includes the time to read request headers. Continuously sending a small amount of data does not extend the deadline. |
http_write_timeout |
10m |
Limits the response write deadline, including upload and request processing time. |
http_idle_timeout |
2m |
Limits the idle time a persistent connection waits for the next request. |
A request body read timeout returns a retryable 503 (dataway.httpBodyReadTimeout), releases the concurrency slot, and does not cache data that was not fully received. A downstream receiving streamed forwarding may have already received part of the data, so the client still needs to retry.
The request header read deadline remains 10s. The write deadline should be greater than the read deadline plus the expected processing time. The above are network read/write deadlines and do not forcibly terminate CPU computation.
RUM performs local token validation before reading the first byte. A missing token or a token rejected by local configuration immediately returns the corresponding authentication error; for HTTP/1.x, Dataway stops reading the remaining body and closes the connection without waiting for the upload timeout. The compatibility rules for allowing empty tokens, internal tokens, and the secret token for non-sinker requests remain unchanged. In proxy mode for aggregation and tail sampling, a backend connection failure returns 502 (dataway.proxyFailed); responses already returned by the backend retain their status codes, including empty responses.
All three configurations must be positive numbers. A non-positive value in YAML, or an invalid or non-positive value in ENV, triggers a warning and keeps the default deadline. An invalid YAML duration causes configuration loading to fail. For normal large packets or slow networks, you can increase the read and write deadlines appropriately. It is recommended to adjust them based on the actual upload duration first. For semantics, see the Go HTTP Server documentation.
DK-compatible endpoints are matched according to the following list. Client identity is not determined by token, query, or User-Agent; third-party calls to the same endpoints also receive 503. When adding DK endpoints, you must maintain the list accordingly. Do not treat all /v1/write/* as DK endpoints.
Endpoint Type Returning 503 |
Path |
|---|---|
| DK data write categories | /v1/write/{metric,metrics,network,keyevent,object,object_change,custom_object,logging,tracing,rum,security,profiling,dialtesting,siem_logging,langfuse-v2,agent_llm,dynamic_dw}; reuses the category definitions in cliutils/point, including compatible and reserved categories |
| DK special writes | /v1/write/{heartbeat,bugreport,remote_job,dialtesting_browser_screenshot} |
| Replay and Profiling | /v1/write/rum/replay, /v1/write/rum/replay_assets, /v1/check/rum/replay_assets, /v1/upload/profiling |
| Aggregation and tail sampling | /v1/aggregate, /v1/tail_sampling, /v1/tail_sampling_v2, /v1/tail_sampling_config, /v2/tail_sampling |
| OCSF ingestion | /v1/ocsf_ingest |
| DK control endpoints | /v1/datakit/usage_trace, /v1/datakit/pull, /v1/election, /v1/election/heartbeat, /v1/query/raw, /v1/workspace, /v1/object/labels, /v1/check/token/:token, /v1/env_variable, /v1/ntp, /v1/ping |
Cloudflare's /v1/write/cf-logpush, AWS Firehose's /v1/input/firehose, OTLP's /otel/v1/*, Langfuse's /api/public/*, and other endpoints not listed return 429 when admission is rejected. Requests without a body, such as health checks and configuration pulls, are still allowed directly.
| Env | Description |
|---|---|
| DW_REMOTE_HOST type: string required: Y |
Kodo address, or the next Dataway address, in the form http://host:port |
| DW_WHITE_LIST type: string required: N |
Dataway client IP allowlist, comma-separated (,) |
| DW_TRUSTED_PROXIES type: string required: N |
Trusted proxy IPs/CIDRs, comma-separated; only requests from trusted proxies use X-Forwarded-For or X-Real-IP for allowlist checks |
| DW_HTTP_TIMEOUT type: string required: N |
Timeout for Dataway requests to Kodo or the next Dataway, default 3s |
| DW_HTTP_MAX_IDLE_CONN_PERHOST type: int required: N |
Maximum idle connections for Dataway requests to Kodo Version-1.6.2 Default is 1000 Version-1.11.2 |
| DW_HTTP_READ_TIMEOUT type: string required: N |
Inbound request read deadline, corresponding to http_read_timeout, default 5m |
| DW_HTTP_WRITE_TIMEOUT type: string required: N |
Inbound response write deadline, including upload and processing time, corresponding to http_write_timeout, default 10m |
| DW_HTTP_IDLE_TIMEOUT type: string required: N |
Idle deadline for inbound connections waiting for the next request, corresponding to http_idle_timeout, default 2m |
| DW_HTTP_MAX_CONN_PERHOST type: int required: N |
Maximum connections for Dataway requests to Kodo, unlimited by default Version-1.6.2 |
| DW_KODO_QUEUE_ENABLED type: boolean required: N |
Enable the bounded dispatch queue before write/upload/OTLP HTTP requests are sent to Kodo or the next Dataway, default true |
| DW_KODO_QUEUE_WORKERS type: int required: N |
Number of workers in the Kodo dispatch queue, default 256 |
| DW_KODO_QUEUE_SIZE type: int required: N |
Maximum number of requests waiting in the Kodo dispatch queue, default 1024 |
| DW_KODO_QUEUE_MAX_BYTES type: int/string required: N |
Upper limit on the total bytes of bodies queued, being sent, and waiting to be enqueued in the Kodo queue. Supports 1073741824, 1GB, 1024MB, etc. Default 1GB |
| DW_KODO_QUEUE_ENQUEUE_TIMEOUT type: string required: N |
Maximum time a request waits for a slot in the Kodo queue. After timeout, requests that can be cached are written to the Dataway cache; when cache is unavailable, returns 503. Default 100ms |
| DW_TOKEN_NEGATIVE_CACHE_ENABLED type: boolean required: N |
Whether to enable negative caching for invalid tokens; the cache is isolated by token, write API path, and main/headless mode. Default true |
| DW_TOKEN_NEGATIVE_CACHE_TTL type: string required: N |
Time to live for the invalid token negative cache, default 5m |
| DW_TOKEN_NEGATIVE_CACHE_MAX_KEYS type: int required: N |
Maximum number of scope keys stored in the invalid token negative cache, default 1000 |
| DW_BIND type: string required: N |
Dataway HTTP API IPv4 bind address, default 0.0.0.0:9528 |
| DW_BIND_IPV6 type: string required: N |
Dataway HTTP API IPv6 bind address, not listened by default; set to [::]:9528 to explicitly enable IPv6 listening |
| DW_API_LIMIT type: int required: N |
Dataway API rate limit setting. For example, if set to 1000, each specific API allows only 1000 requests within 1s. Default 100K |
| DW_HEARTBEAT type: string required: N |
Heartbeat interval between Dataway and the center, default 60s |
| DW_MAX_HTTP_BODY_BYTES type: int required: N |
Maximum HTTP body allowed by the Dataway API (in bytes), default 64MB |
| DW_TLS_INSECURE_SKIP_VERIFY type: boolean required: N |
Ignore HTTPS/TLS certificate errors |
| DW_HTTP_CLIENT_TRACE type: boolean required: N |
Dataway acts as an HTTP client and can enable related metric collection; these metrics are ultimately exposed in its Prometheus metrics |
| DW_ENABLE_TLS type: boolean required: N |
Enable HTTPS Version-1.4.1 |
| DW_TLS_CRT type: file-path required: N |
Specify the HTTPS/TLS crt file directory Version-1.4.0 |
| DW_TLS_KEY type: file-path required: N |
Specify the HTTPS/TLS key file directory Version-1.4.0 |
| DW_SNI type: string required: N |
Specify the current Dataway SNI information Version-1.6.0 |
| DW_DISABLE_404PAGE type: boolean required: N |
Disable the 404 page Version-1.6.1 |
| DW_HTTP_IP_BLACKLIST_TTL type: string required: N |
Set the IP blacklist TTL, default 1m Version-1.11.0 |
| DW_HTTP_IP_BLACKLIST_CLEAN_INTERVAL type: string required: N |
Set the IP blacklist cleanup interval, default 1h Version-1.11.0 |
HTTP TLS Settings¶
To generate a TLS certificate valid for one year, you can use the following OpenSSL command:
# Generate a TLS certificate valid for one year
$ openssl req -new -newkey rsa:4096 -x509 -sha256 -days 365 -nodes -out tls.crt -keyout tls.key
...
After you run this command, the system prompts you to enter required information, including your country, region, city, organization name, department name, and email address. This information is included in your certificate.
After you enter the information, two files are generated: tls.crt (certificate file) and tls.key (private key file). Keep your private key file safe and secure.
To enable the application to use these TLS certificates, set the absolute paths of the two files in the application's environment variables. The following is an example of setting the environment variables:
DW_ENABLE_TLSmust be enabled first for the other two ENVs (DW_TLS_CRT/DW_TLS_KEY) to take effect. Version-1.4.1
env:
- name: DW_ENABLE_TLS
value: "true"
- name: DW_TLS_CRT
value: "/path/to/your/tls.crt"
- name: DW_TLS_KEY
value: "/path/to/your/tls.key"
Replace /path/to/your/tls.crt and /path/to/your/tls.key with the actual paths where tls.crt and tls.key are stored.
After setting them, use the following command to test whether TLS takes effect:
If successful, an It's working! ASCII art message is displayed. If the certificate does not exist, a similar error appears in the Dataway logs:
In this case, Dataway cannot start, and the above curl command also reports an error:
$ curl -vvv -k http://localhost:9528
curl: (7) Failed to connect to localhost port 9528 after 6 ms: Couldn't connect to server
Logging Settings¶
| Env | Description |
|---|---|
| DW_LOG type: string required: N |
Log path, default log. To output logs to stdout for easier log collection, set it to stdout. |
| DW_LOG_LEVEL type: string required: N |
Default info; debug is also available. |
| DW_GIN_LOG type: string required: N |
Default gin.log; you can also set it to stdout for easier collection. |
| DW_LOG_PKG_ID type: bool required: N |
Version-1.12.0 Whether to record the package ID in logs. Default true. |
Token/UUID Settings¶
| Env | Description |
|---|---|
| DW_UUID type: string required: Y |
Dataway UUID. The system workspace generates it when you create a Dataway. |
| DW_TOKEN type: string required: Y |
Usually the data upload token of the system workspace. |
| DW_SECRET_TOKEN type: string required: N |
When Sinker is enabled, you can set this token. |
| DW_ENABLE_INTERNAL_TOKEN type: boolean required: N |
Allow __internal__ as the client token; in this case, the system workspace token is used by default. |
| DW_ENABLE_EMPTY_TOKEN type: boolean required: N |
Allow data upload without a token; in this case, the system workspace token is used by default. |
Sinker Settings¶
| Env | Description |
|---|---|
| DW_SECRET_TOKEN type: string required: N |
When Sinker is enabled, you can set this token. |
| DW_CASCADED type: string required: N |
Whether Dataway is cascaded. |
| DW_SINKER_ETCD_URLS type: string required: N |
etcd address list, separated by ,, for example http://1.2.3.4:2379,http://1.2.3.4:2380 |
| DW_SINKER_ETCD_DIAL_TIMEOUT type: string required: N |
etcd connection timeout, default 30s |
| DW_SINKER_ETCD_KEY_SPACE type: string required: N |
Name of the etcd key where the Sinker configuration is located (default /dw_sinker) |
| DW_SINKER_ETCD_USERNAME type: string required: N |
etcd username |
| DW_SINKER_ETCD_PASSWORD type: string required: N |
etcd password |
| DW_SINKER_FILE_PATH type: file-path required: N |
Specify the Sinker rule configuration through a local file. |
| DW_SINKER_CACHE_BUCKETS type: int required: N |
Version-1.12.0 Specify the number of Sinker cache buckets, default 64 |
| DW_SINKER_CACHE_RESERVED_CAPACITY type: int required: N |
Version-1.12.0 Specify the maximum number of Sinker cache entries, default 1 million (1<<20) |
| DW_SINKER_CACHE_TTL type: int required: N |
Version-1.12.0 Specify the TTL of Sinker cache entries, default 10m (10 minutes) |
| DW_SINKER_CACHE_PREALLOC type: bool required: N |
Version-1.12.0 Preallocate cache memory, default false |
Warning
If both a local file and etcd are specified, the Sinker rules in the local file take precedence. If neither is specified, Sinker is effectively disabled.
Prometheus Metrics Exposure¶
| Env | Description |
|---|---|
| DW_PROM_URL type: string required: N |
URL path for Prometheus metrics (default /metrics) |
| DW_PROM_LISTEN type: string required: N |
Prometheus metrics exposure address (default localhost:9090) |
| DW_PROM_DISABLED type: boolean required: N |
Disable Prometheus metrics exposure |
| DW_PPROF_BIND type: string required: N |
pprof listen address; disabled by default, accepts only loopback addresses, for example localhost:6060 |
Disk Cache Settings¶
| Env | Description |
|---|---|
| DW_DISKCACHE_DIR type: file-path required: N |
Set the cache directory. This directory is usually backed by external storage. |
| DW_DISKCACHE_DISABLE type: boolean required: N |
Disable disk cache. If you do not want to disable the cache, delete this environment variable. |
| DW_DISKCACHE_CLEAN_INTERVAL type: string required: N |
Cache cleanup interval, default 1s |
| DW_DISKCACHE_EXPIRE_DURATION type: string required: N |
Cache expiration time, default 168h (7d) |
| DW_DISKCACHE_CAPACITY_MB type: int required: N |
Version-1.6.0 Set the available disk space in MB, default 20GB |
| DW_DISKCACHE_BATCH_SIZE_MB type: int required: N |
Version-1.6.0 Set the maximum size of a single disk cache file in MB, default 64MB |
| DW_DISKCACHE_MAX_DATA_SIZE_MB type: int required: N |
Version-1.6.0 Set the maximum size of a single cached item (such as a single HTTP body) in MB, default 64MB. Individual packets larger than this size are discarded. |
Tips
Set DW_DISKCACHE_DISABLE to disable disk cache.
Performance-related Settings¶
| Env | Description |
|---|---|
| DW_COPY_BUFFER_DROP_SIZE type: int required: N |
An HTTP body buffer larger than the specified size (in bytes) is immediately cleared to avoid consuming too much memory. Default 256KB. |
Dataway API List¶
Except for diagnostic and local processing endpoints, forwarding endpoints forward requests to Kodo or the next-hop Dataway according to their respective token validation rules; see below for the authentication behavior of Langfuse-compatible endpoints.
GET /v1/ping¶
- API description: Get the current Dataway version and release date, and return the egress IP of the client request.
If Dataway disables the 404 page (
disable_404page), this endpoint will not be available.
GET /v1/ntp¶
- API description: Get the current Unix timestamp of Dataway (in seconds).
POST /v1/write/:category¶
- API description: Receive various types of collected data uploaded by Datakit.
- Downstream 4xx: Normal writes, OpenLineage, and OCSF forwarding share error handling and preserve the HTTP status code. 404 returns
{}. For other 4xx responses,error_codeis extracted from a parsable JSON error body, and other error details are not forwarded. If the response body is empty, is not JSON, orerror_codecannot be parsed,{}is returned. A 4xx is no longer changed to 500 because of an error body parsing failure. Downstream 4xx responses do not enter the disk cache.
POST /v1/write/openlineage¶
- API description: Receive a single OpenLineage
RunEvent,JobEvent, orDatasetEventJSON, and forward the request as-is to Kodo or the next-hop Dataway. - Request requirements:
Content-Typemust beapplication/json; media type parameters (such asapplication/json; charset=utf-8) are allowed.- The workspace token can be passed through the
tokenquery, theX-Tokenheader, orAuthorization: Bearer <token>. Priority order:token,X-Token, Bearer. - The Bearer token is converted into the query
tokenandX-Tokenused downstream; the originalAuthorizationis not passed through. - The request can use
Content-Encoding: gzip; Dataway does not decompress or parse the JSON. The compressed body and related headers enter the forwarding chain as-is. - Except for gzip and uncompressed requests, other
Content-Encodingvalues return HTTP 415; an empty body returns HTTP 400. - On downstream failure, the request shares the disk cache, capacity limit, FIFO eviction, and replay policy with other
/v1/write/*data. The cache stores the URL, headers, and body as the original values of the forwarded request. The querytokenandX-Tokenare written to disk in plaintext; no encryption key is required.dataway.cachedis returned only when this cache write succeeds. When the cache reaches its capacity limit, earlier records may be evicted; records that fail to replay are re-enqueued according to the normal cache policy and are discarded when the cache expiration time is exceeded. - If the downstream connection fails and the request is not cached, HTTP 503 is returned without the target URL/token, with
Retry-After: 1. Downstream 4xx responses share error handling with normal writes and OCSF. Sinker rewriting the target path does not change this rule.
- When ingesting through DataKit's
ddtracecollector, the client usesPOST /openlineage/api/v1/lineage. DataKit uses the configured Dataway token; the token passing methods above apply to direct connections to Dataway. - HTTP 2xx means Dataway has received or cached the request (
error_code=dataway.cachedin the200response body). It does not mean Kodo has completed asynchronous validation or that LN has been stored. OpenLineage structure validation, post-decompression resource limits, workspace binding, and event idempotency are handled by the downstream Lineage ingest.
POST /v1/ocsf_ingest¶
Receive OCSF JSON, convert it to log points in the current Dataway, and write them to the fixed ocsf index through /v1/write/logging, without enabling aggregation or tail sampling.
- The request uses
Content-Type: application/json, and the charset parameter is allowed; uncompressed,Content-Encoding: identity, orgzipis supported. NDJSON and other compression encodings are not supported. - Single event objects, event arrays, and
{"events":[...]}batch wrappers are supported. A top-level object is treated as a single event ifclass_uidis present; otherwise, it is treated as a bundle. Metadata at the bundle level does not generate points, and the number of points is based on the actual number of events. - Authentication is performed before reading the body. Token extraction priority: query
token,X-Token,X-Amz-Firehose-Access-Key; empty tokens, internal tokens, and secret tokens are handled according to existing configuration and sink compatibility rules. - Each event must contain
metadata.versionwith SemVer1.x, a non-negative integerclass_uid, and an integer millisecondtime. After conversion,timein nanoseconds must be within the int64 range. A batch can mix different 1.x versions and categories; full OCSF Schema validation is not performed, and no external Schema service is requested. - The request body, the JSON after gzip decompression, and the entire converted protobuf batch are subject to
max_http_body_bytes(DW_MAX_HTTP_BODY_BYTES), default 64 MiB. If the limit is exceeded, the entire batch returns413; the sender must reduce the batch size, and Dataway does not automatically split the batch.
Data Point Mapping and Field Limits¶
Each event generates one point. The measurement/source is fixed to ocsf, the time is taken from the event time, and the log status is fixed to info. The original OCSF severity and event result do not change the log level.
| Input | Output |
|---|---|
| Complete original event JSON | message |
Top-level message/status/source/date |
ocsf_message/ocsf_status/ocsf_source/ocsf_date |
Top-level time |
The point's nanosecond time; the original millisecond value remains in message |
| Other strings, booleans, and numbers | Field with the same name; integers are kept as int64, non-negative large integers can use uint64, and decimals or exponential forms use float64; values outside the representable range return 400 |
| Nested objects | Dot-path fields, for example src_endpoint.ip; dots in key names are preserved |
| Arrays | JSON string field |
| null, empty objects | No separate field is generated; they are retained in the original text |
Each point has at most 1024 fields, including the generated message and status; the final field name is at most 256 bytes, and a single string value is at most 32 MiB, including message. If exceeded, the entire batch returns 413; fields or field values are not automatically truncated.
Request and Response¶
Example OCSF 1.3.0 Authentication event:
curl -X POST 'https://dataway.example.com/v1/ocsf_ingest?token=<token>' \
-H 'Content-Type: application/json' \
--data-binary '{"metadata":{"version":"1.3.0","product":{"name":"example","vendor_name":"example"}},"class_uid":3002,"category_uid":3,"type_uid":300201,"activity_id":1,"severity_id":1,"time":1713632701123,"user":{"name":"alice"},"service":{"name":"ssh"}}'
This request generates a point named ocsf with time 1713632701123000000, containing user.name=alice, service.name=ssh, and the complete message. If the caller specifies another X-Storage-Index-Name, it is overridden to ocsf, and cache replay also maintains this index.
The entire batch is sent synchronously only after conversion validation passes, reusing the existing Kodo sending, sink, signing, cache, and replay chain:
| Status Code | Meaning |
|---|---|
200 |
Downstream send succeeded; when the downstream response is empty, the body is empty. |
200 + {"error_code":"dataway.cached"} |
Successfully written to cache and will be replayed later; does not mean the downstream has written the data. |
400 |
Empty body/batch, invalid JSON/event, numeric out-of-range, or field mapping conflict. |
413 |
Request body, protobuf, or field limit exceeded. |
415 |
Unsupported media type or compression encoding. |
503 |
Concurrency admission rejected or request body read timeout. |
Authentication errors and errors when sending fails and cannot be cached follow the existing chain. The endpoint does not add an asynchronous receive queue and does not guarantee deduplication or atomicity of downstream batch writes. Ingress status and latency use existing HTTP metrics, and send and cache metrics are counted under /v1/write/logging.
Duplicate JSON Keys and Field Conflicts¶
When duplicate keys occur within the same JSON object, the last occurrence is retained in the order of the original request. The duplicate key itself does not cause 400. This rule applies to the bundle outer layer, event objects, nested objects, and objects within arrays; different objects do not overwrite each other. Key names are compared as JSON-unescaped strings, for example class_uid and class\u005fuid are considered the same name. If the value of a duplicate key is an object or array, the later value replaces the earlier value entirely and is not merged.
Field validation and point mapping are based on the last retained value. The point's message retains the complete original event JSON, including duplicate keys and their original values; the original text is not replaced with deduplicated JSON. If the last retained value does not meet field requirements (for example, class_uid is negative), the entire batch still returns 400 as an invalid event.
The following single-event request passes conversion validation and generates 1 point, where class_uid=4001 and user.name=bob; message still retains the complete original text below:
{
"metadata": {"version": "1.3.0"},
"class_uid": 3002,
"class_uid": 4001,
"time": 1713632701123,
"user": {"name": "alice", "name": "bob"}
}
Field conflicts caused by renaming or dot-path expansion still cause the entire batch to return 400, and no points are sent. For example, in {"a.b":1,"a":{"b":2}}, two different paths both expand to a.b, which is a field mapping conflict. The error message provides the conflicting field path and the event sequence number starting from 1.
POST /v1/aggregate¶
- API description: Receive metric aggregation data. Registered only when the aggregation feature is initialized successfully.
- For detailed working modes, configurations, and request requirements, see Dataway Metric Aggregation.
POST /v1/tail_sampling、POST /v1/tail_sampling_v2、POST /v2/tail_sampling and POST /v1/tail_sampling_config¶
- API description:
/v1/tail_samplingreceives raw tail sampling data packets and is compatible with the non-negotiated-header zstd packets sent by Datakit 2.10; the legacy path/v1/tail_sampling_v2receives only raw data packets;/v2/tail_samplingreceives zstd data packets with compression negotiation headers;/v1/tail_sampling_configreceives tail sampling configuration. Registered only when the tail sampling feature is initialized successfully. - For detailed working modes, configurations, and request requirements, see Dataway Tail Sampling.
POST /otel/v1/{traces,metrics,logs}¶
- API description: Receive OpenTelemetry OTLP HTTP/protobuf data and forward it as-is to the corresponding Kodo path.
- Supported paths:
POST /otel/v1/tracesPOST /otel/v1/metricsPOST /otel/v1/logs
-
Request requirements:
Content-Typemust beapplication/x-protobuf; media type parameters (such asapplication/x-protobuf; charset=utf-8) are allowed.- The workspace token can be passed through the
tokenquery, theX-Tokenheader, orAuthorization: Bearer <token>; the Bearer token is converted toX-Tokenbefore forwarding. - When using OpenTelemetry SDK/Agent environment variables, it is recommended to explicitly configure OTLP HTTP/protobuf and set the base endpoint to Dataway's
/otelprefix; OpenTelemetry automatically appends/v1/traces,/v1/metrics, and/v1/logsby signal:
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf export OTEL_EXPORTER_OTLP_LOGS_ENDPOINT=https://dataway.example.com/otel/v1/logs export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://dataway.example.com/otel/v1/traces export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://dataway.example.com/otel/v1/metrics export OTEL_EXPORTER_OTLP_HEADERS="Authorization=Bearer%20{token}"- Startup parameters have the same meaning as environment variables. For example, with the Java Agent, you can configure
-Dotel.exporter.otlp.protocol=http/protobuf,-Dotel.exporter.otlp.endpoint=https://dataway.example.com/otel, and-Dotel.exporter.otlp.headers=Authorization=Bearer%20{token}. If the implementation has inconsistent compatibility with space encoding in theAuthorizationheader, you can also useOTEL_EXPORTER_OTLP_HEADERS="X-Token={token}"or the corresponding startup parameter. - Dataway does not parse or rewrite the OTLP body;
/otel/v1/metricsis not converted to/v1/write/metricline protocol. Kodo parses according to DataKit's default OTLP metrics rules, the measurement isotel_service, and metric field names retain the original OTLP metric name (for example,runtime.jvm.memoryis not rewritten toruntime_jvm_memory). - The original OTLP response status, response body, and necessary response headers returned by Kodo are passed through; if forwarding fails and the disk cache policy is satisfied, the request enters the Dataway disk cache replay chain.
GET /v1/datakit/pull¶
- API description: Handle Datakit requests to pull center configuration (blacklist/Pipeline).
POST /v1/datakit/usage_trace¶
- API description: Receive Datakit usage tracking data.
POST /v1/write/rum/replay¶
- API description: Receive Session Replay data uploaded by Datakit.
POST /v1/write/rum/replay_assets¶
- API description: Receive upload requests for Session Replay associated assets.
POST /v1/check/rum/replay_assets¶
- API description: Check whether Session Replay associated assets already exist.
POST /v1/upload/profiling¶
- API description: Receive Profiling data uploaded by Datakit.
POST /v1/input/firehose¶
- API description: Receive Firehose input data.
POST /v1/election¶
- API description: Handle Datakit election requests.
POST /v1/election/heartbeat¶
- API description: Handle Datakit election heartbeat requests.
POST /v1/query/raw¶
Handle DQL query requests. A simple example is as follows:
POST /v1/query/raw?token=<workspace-token> HTTP/1.1
Content-Type: application/json
{
"token": "workspace-token",
"queries": [
{
"query": "M::cpu LIMIT 1"
}
],
"echo_explain": <true/false>
}
Response example:
{
"content": [
{
"series": [
{
"name": "cpu",
"columns": [
"time",
"usage_iowait",
"usage_total",
"usage_user",
"usage_guest",
"usage_system",
"usage_steal",
"usage_guest_nice",
"usage_irq",
"load5s",
"usage_idle",
"usage_nice",
"usage_softirq",
"global_tag1",
"global_tag2",
"host",
"cpu"
],
"values": [
[
1709782208662,
0,
7.421875,
3.359375,
0,
4.0625,
0,
0,
0,
1,
92.578125,
0,
0,
null,
null,
"WIN-JCHUL92N9IP",
"cpu-total"
]
]
}
],
"points": null,
"cost": "24.558375ms",
"is_running": false,
"async_id": "",
"query_parse": {
"namespace": "metric",
"sources": {
"cpu": "exact"
},
"fields": {},
"funcs": {}
},
"index_name": "",
"index_store_type": "",
"query_type": "guancedb",
"complete": false,
"index_names": "",
"scan_completed": false,
"scan_index": "",
"next_cursor_time": -1,
"sample": 1,
"interval": 0,
"window": 0
}
]
}
Response description:
- The actual data is in the inner
seriesfield. nameindicates the measurement name (the query here is for CPU metrics; for log data, this field is absent).columnsindicates the returned result column names.valuescontains the corresponding column results incolumns.
Info
- The token in the URL request parameter can differ from the token in the JSON body. The former is used to verify whether the query request is valid, and the latter is used to determine the workspace where the target data resides.
- The
queriesfield can contain multiple queries, and each query can carry additional fields. For the specific field list, see here.
POST /v1/workspace¶
- API description: Handle workspace query requests initiated by Datakit.
GET /v1/env_variable¶
- API description: Get workspace environment variables.
POST /v1/dataway/heartbeat¶
- API description: Receive Dataway heartbeat report requests.
POST /v1/object/labels¶
- API description: Handle requests to modify object labels.
DELETE /v1/object/labels¶
- API description: Handle requests to delete object labels.
GET /v1/check/token/:token¶
- API description: Check whether a token is valid.
Langfuse-Compatible Endpoints¶
The following endpoints are compatible with Langfuse clients. Requests are forwarded directly to upstream, and Dataway does not validate tokens:
POST /api/public/otel/v1/traces: Receive Langfuse OTLP Trace data.GET /api/public/projects: Get Langfuse project information.POST /api/public/ingestion: Receive Langfuse ingestion data. When upstream succeeds but returns no response body, Dataway returns a Langfuse SDK 4.x-compatiblesuccesses/errorsJSON response based on the event IDs in the request batch.
Dataway Metrics Collection¶
HTTP Client Metrics Collection
To collect metrics for Dataway HTTP requests to Kodo (or the next-hop Dataway), you need to manually enable the http_client_trace configuration, or specify the environment variable DW_HTTP_CLIENT_TRACE=true.
Dataway exposes Prometheus metrics itself. You can collect its metrics through the prom collector built into Datakit. An example collector configuration is as follows:
If Datakit is deployed in the cluster (version Datakit 1.14.2 or later is required), you can enable Prometheus metrics exposure in Dataway (this is already included in the default Dataway Pod YAML):
annotations: # The following annotations are added by default
datakit/prom.instances: |
[[inputs.prom]]
url = "http://$IP:9090/metrics" # This port (default 9090) depends on the actual configuration
source = "dataway"
measurement_name = "dw" # Fixed to this measurement
interval = "10s"
disable_instance_tag = true
[inputs.prom.tags]
service = "dataway"
instance = "$PODNAME"
...
env:
- name: DW_PROM_LISTEN
value: "0.0.0.0:9090" # Keep this port consistent with the port in the URL above
If collection succeeds, search for dataway in Guance Scenes / Built-in Views to see the corresponding monitoring view.
Cache and Kodo Queue Troubleshooting¶
After tail_sampling_spill is enabled, its send failures are retried by itself and do not enter the HTTP failure cache; for capacity and retry metrics, see Spill Troubleshooting.
When Kodo returns 5xx, a Dataway request to Kodo fails, or the Kodo dispatch queue is full, Dataway attempts to write cacheable requests to the disk cache; Kodo 4xx responses do not enter the cache.
During troubleshooting, prioritize the following metrics:
dataway_http_api_cached_bytes{reason=...}: The request has been written to cache. Commonreasonvalues include the Kodo 5xx status text,httpCliDoFailed, andkodoQueueFull.dataway_http_api_dropped_cache{reason=...}: The request attempted to cache but was not written. Commonreasonvalues includefeat-disabled,expected-api-drop,body-md5-not-matched,body-length-not-matched,expired,put-failed, andsendopt-nil.dataway_kodo_queue_full_total{action=...}: Result after the Kodo queue is full.action="cache"means the request was moved to cache;action="reject"means cache was unavailable or writing failed and503was returned.dataway_http_concurrency_in_flight/dataway_http_concurrency_waiting: Number of requests currently admitted for processing and still waiting before reading the body.dataway_http_concurrency_requests_total{result=...}: HTTP concurrency limit results, includingadmitted,waiting_full,wait_timeout, andcanceled.
Dataway Metrics List¶
The following are metrics exposed by Dataway. You can obtain these metrics by requesting http://localhost:9090/metrics, and you can view a specific metric in real time (every 3s) with the following command:
If some metrics cannot be queried, the related business module may not be running yet. Some new metrics exist only in the latest version. Version information for each metric is no longer listed here; refer to the metric list returned by the
/metricsendpoint.
| TYPE | NAME | LABELS | HELP |
|---|---|---|---|
| SUMMARY | dataway_kodo_queue_wait_seconds |
api,method |
Kodo queue wait duration before worker dispatch |
| SUMMARY | dataway_http_concurrency_wait_seconds |
api,method,result |
HTTP concurrency wait duration |
| GAUGE | dataway_http_concurrency_in_flight |
N/A |
Current HTTP requests being processed |
| GAUGE | dataway_http_concurrency_waiting |
N/A |
Current HTTP requests waiting before their request bodies are read |
| COUNTER | dataway_http_concurrency_requests_total |
api,method,result |
HTTP concurrency results |
| SUMMARY | dataway_http_api_elapsed_seconds |
api,method,sinked,status |
API request latency |
| SUMMARY | dataway_http_api_body_buffer_utilization |
api |
API body buffer utillization(Len/Cap) |
| SUMMARY | dataway_http_api_body_copy |
api |
API body copy |
| SUMMARY | dataway_http_api_body_copy_seconds |
api |
API body copy latency |
| SUMMARY | dataway_http_api_body_copy_enlarge |
api |
API body copy enlarged pooled buffer |
| SUMMARY | dataway_http_api_resp_size_bytes |
api,method,status |
API response size |
| SUMMARY | dataway_http_api_req_size_bytes |
api,method,status |
API request size |
| COUNTER | dataway_http_api_body_too_large_dropped_total |
api,method |
API request too large dropped |
| COUNTER | dataway_http_api_with_inner_token |
api,method |
API request with inner token |
| COUNTER | dataway_http_api_dropped_total |
api,method |
API request dropped when sinker rule match failed |
| COUNTER | dataway_ip_blacklist_blocked_total |
api,method |
IP blacklist blocked requests total |
| COUNTER | dataway_ip_blacklist_missed_total |
api,method |
IP blacklist missed total |
| COUNTER | dataway_ip_blacklist_added_total |
api,method,reason |
IP blacklist added total |
| COUNTER | dataway_syncpool_stats |
name,type |
sync.Pool usage stats |
| COUNTER | dataway_http_api_copy_body_failed_total |
api |
API copy body failed count |
| COUNTER | dataway_http_api_signed_total |
api,method |
API signature count |
| SUMMARY | dataway_http_api_cached_bytes |
api,cache_type,method,reason |
API cached body bytes |
| SUMMARY | dataway_http_api_reusable_body_read_bytes |
api,method |
API re-read body on forking request |
| SUMMARY | dataway_http_api_recv_points |
api |
API /v1/write/:category recevied points |
| SUMMARY | dataway_http_api_send_points |
api |
API /v1/write/:category send points |
| SUMMARY | dataway_http_api_cache_points |
api,cache_type |
Disk cached /v1/write/:category points |
| SUMMARY | dataway_http_api_cache_cleaned_points |
api,cache_type,status |
Disk cache cleaned /v1/write/:category points |
| COUNTER | dataway_http_api_forked_total |
api,method,token |
API request forked total |
| GAUGE | dataway_http_cli_info |
max_conn_per_host,max_idle_conn,max_idle_conn_per_host,timeout |
Dataway as client settings |
| GAUGE | dataway_http_info |
cascaded,docker,http_client_trace,listen,max_body,release_date,remote,version |
Dataway API basic info |
| GAUGE | dataway_kodo_queue_depth |
N/A |
Current Kodo dispatch queue depth including in-flight tasks |
| GAUGE | dataway_kodo_queue_bytes |
N/A |
Current Kodo dispatch queue body bytes including in-flight tasks |
| COUNTER | dataway_kodo_queue_enqueued_total |
api,method |
Kodo queue enqueued tasks |
| COUNTER | dataway_kodo_queue_full_total |
api,method,action |
Kodo queue full events |
| COUNTER | dataway_kodo_queue_dispatch_total |
api,method,status |
Kodo queue dispatch results |
| COUNTER | dataway_token_negative_cache_added_total |
api,method,error_code |
Token negative cache added total |
| COUNTER | dataway_token_negative_cache_blocked_total |
api,method,error_code |
Token negative cache blocked requests total |
| GAUGE | dataway_last_heartbeat_time |
N/A |
Dataway last heartbeat with Kodo timestamp |
| SUMMARY | dataway_http_api_copy_buffer_drop_total |
max |
API copy buffer dropped(too large cached buffer) count |
| GAUGE | dataway_cpu_usage |
N/A |
Dataway CPU usage(%) |
| GAUGE | dataway_mem_stat |
type |
Dataway memory usage stats |
| GAUGE | dataway_open_files |
N/A |
Dataway open files |
| GAUGE | dataway_open_files_by_type |
type |
Dataway open files grouped by fd type |
| GAUGE | dataway_tcp_connections |
direction,port,state |
Dataway TCP connections grouped by direction, port and state(Linux only) |
| GAUGE | dataway_cpu_cores |
N/A |
Dataway CPU cores |
| GAUGE | dataway_uptime |
N/A |
Dataway uptime |
| COUNTER | dataway_process_ctx_switch_total |
type |
Dataway process context switch count(Linux only) |
| COUNTER | dataway_process_io_count_total |
type |
Dataway process IO count |
| COUNTER | dataway_process_io_bytes_total |
type |
Dataway process IO bytes count |
| SUMMARY | dataway_http_api_dropped_cache |
api,method,reason |
Dropped cache data dur to various reasons |
| COUNTER | dataway_http_api_body_size_bytes_total |
api,token |
Accumulated API body bytes for aggregate or tailSampling |
| COUNTER | dataway_http_aggr_point_total |
api,token |
point count of aggregate or tailSampling |
| COUNTER | dataway_http_tail_sampling_trace_total |
token |
tailSampling trace count |
| COUNTER | dataway_http_tail_sampling_span_total |
token |
tailSampling span count |
| COUNTER | dataway_http_tail_sampling_packet_send_total |
token,data_type,result |
tailSampling packet send result count |
| GAUGE | dataway_httpcli_dns_resolved_address |
api,coalesced,host,server |
HTTP DNS resolved address |
| SUMMARY | dataway_httpcli_dns_cost_seconds |
api,coalesced,host,server |
HTTP DNS cost |
| SUMMARY | dataway_httpcli_tls_handshake_seconds |
api,server |
HTTP TLS handshake cost |
| SUMMARY | dataway_httpcli_http_connect_cost_seconds |
api,server |
HTTP connect cost |
| SUMMARY | dataway_httpcli_got_first_resp_byte_cost_seconds |
api,server |
Got first response byte cost |
| SUMMARY | http_latency |
api,server |
HTTP latency |
| COUNTER | dataway_httpcli_tcp_conn_total |
api,server,remote,type |
HTTP TCP connection count |
| COUNTER | dataway_httpcli_conn_reused_from_idle_total |
api,server |
HTTP connection reused from idle count |
| SUMMARY | dataway_httpcli_conn_idle_time_seconds |
api,server |
HTTP connection idle time |
| GAUGE | dataway_sinker_rule_cache_size |
name |
Sinker rule cache size |
| GAUGE | dataway_sinker_rule_error |
error |
Rule errors |
| GAUGE | dataway_sinker_default_rule_hit |
info |
Default sinker rule hit count |
| GAUGE | dataway_sinker_rule_last_applied_time |
source,version |
Rule last applied time(Unix timestamp) |
| SUMMARY | dataway_sinker_rule_cost_seconds |
type |
Rule cost time seconds |
| SUMMARY | dataway_sinker_lru_cache_cleaned |
name |
Sinker LRU cache cleanup removed entries |
| COUNTER | dataway_sinker_lru_cache_dropped_total |
bucket,name,reason |
Total number of entries evicted from the Sinker LRU cache |
| HISTOGRAM | dataway_sinker_lru_cache_expired_delay_seconds |
bucket,name |
Cleanup delay for expired entries in the Sinker LRU cache |
| HISTOGRAM | dataway_sinker_lru_cache_evicted_remaining_ttl_seconds |
bucket,name |
Remaining TTL of entries evicted due to capacity in the Sinker LRU cache |
| COUNTER | dataway_sinker_pull_total |
event,source |
Sinker pulled or pushed total |
| GAUGE | dataway_sinker_rule_count |
type,with_default |
Sinker rule count |
| GAUGE | dataway_sinker_rule_cache_get_total |
name,type |
Sinker rule cache get hit/miss count |
| COUNTER | diskcache_rotate_total |
path |
Cache rotate count, mean file rotate from data to data.0000xxx |
| COUNTER | diskcache_remove_total |
path |
Removed file count, if some file read EOF, remove it from un-read list |
| COUNTER | diskcache_wakeup_total |
path |
Wakeup count on sleeping write file |
| COUNTER | diskcache_pos_updated_total |
op,path |
.pos file updated count |
| COUNTER | diskcache_seek_back_total |
path |
Seek back when Get() got any error |
| GAUGE | diskcache_capacity |
path |
Current capacity(in bytes) |
| GAUGE | diskcache_max_data |
path |
Max data to Put(in bytes), default 0 |
| GAUGE | diskcache_batch_size |
path |
Data file size(in bytes) |
| GAUGE | diskcache_size |
path |
Current cache size that waiting to be consumed(get). The size include header bytes |
| GAUGE | diskcache_open_time |
no_fallback_on_error,no_lock,no_pos,no_sync,path |
Current cache Open time in unix timestamp(second) |
| GAUGE | diskcache_last_close_time |
path |
Current cache last Close time in unix timestamp(second) |
| GAUGE | diskcache_datafiles |
path |
Current un-read data files |
| HISTOGRAM | diskcache_lock_wait_seconds |
lock_type,path |
Time spent waiting for locks by lock type |
| COUNTER | diskcache_lock_contention_total |
lock_type,path |
Number of lock contention events |
| SUMMARY | diskcache_get_latency |
path |
Get() cost seconds |
| SUMMARY | diskcache_put_latency |
path |
Put() cost seconds |
| SUMMARY | diskcache_put_bytes |
path |
Cache Put() bytes |
| SUMMARY | diskcache_get_bytes |
path |
Cache Get() bytes |
| SUMMARY | diskcache_dropped_data |
path,reason |
Dropped data during Put() when capacity reached. |
Metrics Collection in Docker Mode¶
Host installation has two modes: installation on the host machine and installation through Docker. This section separately describes the differences in metrics collection when installing through Docker.
When installing through Docker, the HTTP port for metrics exposure is mapped to port 19090 on the host machine by default. In this case, the metrics collection address is http://localhost:19090/metrics.
If a different port is specified separately, Docker installation adds 10000 to that port. Therefore, the port specified here must not exceed 45535.
pprof is disabled by default, and Docker installation does not publish the profile port to the host machine. For temporary troubleshooting, you can explicitly set pprof_bind or DW_PPROF_BIND to localhost:6060 and collect through docker exec, kubectl exec, or controlled port forwarding; configurations with a non-loopback address are rejected.
Dataway Log Collection and Processing¶
Dataway's own logs fall into two categories: gin logs and application logs. The following Pipeline separates them:
# Pipeline for dataway logging
# Testing sample loggin
'''
2023-12-14T11:27:06.744+0800 DEBUG apis apis/api_upload_profile.go:272 save profile file to disk [ok] /v1/upload/profiling?token=****************a4e3db8481c345a94fe5a
[GIN] 2021/10/25 - 06:48:07 | 200 | 30.890624ms | 114.215.200.73 | POST "/v1/write/logging?token=tkn_5c862a11111111111111111111111111"
'''
add_pattern("TOKEN", "tkn_\\w+")
add_pattern("GINTIME", "%{YEAR}/%{MONTHNUM}/%{MONTHDAY}%{SPACE}-%{SPACE}%{HOUR}:%{MINUTE}:%{SECOND}")
grok(_,"\\[GIN\\]%{SPACE}%{GINTIME:timestamp}%{SPACE}\\|%{SPACE}%{NUMBER:dataway_code}%{SPACE}\\|%{SPACE}%{NOTSPACE:cost_time}%{SPACE}\\|%{SPACE}%{NOTSPACE:client_ip}%{SPACE}\\|%{SPACE}%{NOTSPACE:method}%{SPACE}%{GREEDYDATA:http_url}")
# gin logging
if cost_time != nil {
if http_url != nil {
grok(http_url, "%{TOKEN:token}")
cover(token, [5, 15])
replace(message, "tkn_\\w{0,5}\\w{6}", "****************$4")
replace(http_url, "tkn_\\w{0,5}\\w{6}", "****************$4")
}
group_between(dataway_code, [200,299], "info", status)
group_between(dataway_code, [300,399], "notice", status)
group_between(dataway_code, [400,499], "warning", status)
group_between(dataway_code, [500,599], "error", status)
if sample(0.1) { # drop 90% debug log
drop()
exit()
} else {
set_tag(sample_rate, "0.1")
}
parse_duration(cost_time)
duration_precision(cost_time, "ns", "ms")
set_measurement('gin', true)
set_tag(service,"dataway")
exit()
}
# app logging
if cost_time == nil {
grok(_,"%{TIMESTAMP_ISO8601:timestamp}%{SPACE}%{NOTSPACE:status}%{SPACE}%{NOTSPACE:module}%{SPACE}%{NOTSPACE:code}%{SPACE}%{GREEDYDATA:msg}")
if level == nil {
grok(message,"Error%{SPACE}%{DATA:errormsg}")
if errormsg != nil {
add_key(status,"error")
drop_key(errormsg)
}
}
lowercase(level)
# if debug level enabled, drop most of them
if status == 'debug' {
if sample(0.1) { # drop 90% debug log
drop()
exit()
} else {
set_tag(sample_rate, "0.1")
}
}
group_in(status, ["error", "panic", "dpanic", "fatal","err","fat"], "error", status) # mark them as 'error'
if msg != nil {
grok(msg, "%{TOKEN:token}")
cover(token, [5, 15])
replace(message, "tkn_\\w{0,5}\\w{6}", "****************$4")
replace(msg, "tkn_\\w{0,5}\\w{6}", "****************$4")
}
set_measurement("dataway-log", true)
set_tag(service,"dataway")
}
Dataway Bug Report¶
Dataway exposes metrics and can temporarily enable the profiling collection endpoint as needed for troubleshooting. pprof is disabled by default. Before collection, explicitly set pprof_bind to a loopback address, and disable it again after collection is complete.
The following information collection is based on the actually configured port and address.
br_dir="dw-br-$(date +%s)"
mkdir -p $br_dir
echo "save bug report to ${br_dir}"
# Modify the configuration here according to your actual environment
dw_ip="localhost" # IP address where Dataway metrics/profile are exposed
metric_port=9090 # Port for metrics exposure
profile_port=6060 # You must first explicitly enable pprof listening on localhost:6060
dw_yaml_conf="/usr/local/cloudcare/dataflux/dataway/dataway.yaml"
dw_dot_yaml_conf="/usr/local/cloudcare/dataflux/dataway/.dataway.yaml" # This file exists for container installation
# Collect runtime metrics
curl -v "http://${dw_ip}:${metric_port}/metrics" -o $br_dir/metrics
# Collect profiling information
curl -v "http://${dw_ip}:${profile_port}/debug/pprof/allocs" -o $br_dir/allocs
curl -v "http://${dw_ip}:${profile_port}/debug/pprof/heap" -o $br_dir/heap
curl -v "http://${dw_ip}:${profile_port}/debug/pprof/profile" -o $br_dir/profile # This command runs for about 30s
cp $dw_yaml_conf $br_dir/dataway.yaml.copy
cp $dw_dot_yaml_conf $br_dir/.dataway.yaml.copy
tar czvf ${br_dir}.tar.gz ${br_dir}
rm -rf ${br_dir}
Run the script:
After execution, a file similar to dw-br-1721188604.tar.gz is generated. Save this file.
FAQ¶
Request Body Too Large¶
Dataway has a default request body size limit (64MB by default). If the request body is too large, the client receives an HTTP 413 error (Request Entity Too Large). If the request body is within a reasonable range, you can increase this value appropriately (in bytes):
- Set the environment variable
DW_MAX_HTTP_BODY_BYTES. - Set
max_http_body_bytesin dataway.yaml.
If oversized request packets occur during operation, they are reflected in both metrics and logs:
- The metric
dataway_http_too_large_dropped_totalexposes the number of dropped large requests. - Search the Dataway logs with
cat log | grep 'drop too large request'; the logs output HTTP request header details to help you further understand the client situation.
Warning
The disk cache module also has a maximum data block write limit (64MB by default). If you increase the maximum request body configuration, you must also adjust this configuration (ENV_DISKCACHE_MAX_DATA_SIZE) to ensure that large requests can be correctly written to the disk cache.
-
This limit prevents the Dataway container/Pod from being able to use only about 20,000 connections due to system limits at runtime. Increasing the limit affects Dataway data upload efficiency. When Dataway traffic is high, consider increasing the CPU count of a single Dataway or horizontally scaling Dataway instances. ↩