Querying your data

groundcover provides a robust user interface that allows you to view and analyze all your observability data from inside the platform. However, there may be cases in which you need to query the data from outside our platform using API communication.

Our proprietary eBPF sensor automatically captures granular observability data, which is stored via our integrations with two best-of-breed technologies. VictoriaMetrics for metrics storage, and ClickHouse for storage of logs, traces, and Kubernetes events.

Read more about our architecture here.

Generate the API key

Run the following command in your CLI, and select tenant:

groundcover auth get-datasources-api-key

Querying ClickHouse

Example for querying ClickHouse database using POST HTTP Request:

curl 'https://ds.groundcover.com/' \
        --header "X-ClickHouse-Key: ${API_KEY}" \
        --data "SELECT count() from traces where start_timestamp > now() - interval '15 minutes' "

Command parameters

  • X-ClickHouse-Key (header): API Key you retrieved from the groundcover CLI. Replace ${API_KEY} with your actual API key, or set API_KEY as env parameter.

  • SELECT count() FROM traces WHERE start_timestamp > now() - interval '15 minutes' (data): The SQL query to execute. This query counts the number of traces where the start_timestamp is within the last 15 minutes.

Learn more about the ClickHouse query language here.

Querying VictoriaMetrics

Example for querying the VictoriaMetrics database using the query_range API:

curl 'https://ds.groundcover.com/datasources/prometheus/api/v1/query_range' \
    --get \
    --header "apikey: ${API_KEY}" \
    --data 'query=sum(rate(groundcover_resource_total_counter{type="http"}))' \
    --data 'start=1715760000' \
    --data 'end=1715763600'

Command parameters

  • apikey (header): API Key you retrieved from the groundcover CLI. Replace ${API_KEY} with your actual API key, or set API_KEY as env parameter.

  • query (data): The promql query to execute. In this case, it calculates the sum of the rate of groundcover_resource_total_counter with the type set to http.

  • start (data): The start timestamp for the query range in Unix time (seconds since epoch). Example: 1715760000.

  • end (data): The end timestamp for the query range in Unix time (seconds since epoch). Example: 1715763600.

Learn more about the promql syntax here.

Learn more about VictoriaMetrics HTTP API here.

Last updated