examples/

directory
v1.162.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 19, 2026 License: Apache-2.0

README

groundcover Go SDK Examples

This directory contains practical examples demonstrating how to use the groundcover Go SDK for common monitoring use cases.

Getting Started

Before running any examples, make sure you have set the required environment variables:

export GC_API_KEY="your-api-key"
export GC_BACKEND_ID="your-backend-id"

Optionally, you can override the default base URL:

export GC_BASE_URL="https://your-custom-api.groundcover.com"

You can also set an optional traceparent for distributed tracing:

export GC_TRACEPARENT="your-traceparent-header"

Running Examples

Each example is a standalone Go program. To run an example:

cd examples/logs/read-to-console
go run main.go

Or build and run:

cd examples/logs/read-to-console
go build -o example
./example

Available Examples

client-options - Client configuration

Different ways to configure the groundcover SDK client with custom options, retry policies, and authentication.

logs - Search and filter logs
  • Read to console: Search logs with color-coded output formatting.
  • Download to file: Search logs and download to file in chunks to support larger amount of logs.
metrics - Query metrics using PromQL

Execute PromQL queries to get cluster metrics like node count.

events - Event detection

Monitor and display Kubernetes events with detailed metadata. This example demonstrates searching for OOM (Out of Memory) events.

dashboards - Dashboard management

Complete dashboard lifecycle management example demonstrating:

  • Create new dashboards with custom presets
  • Get and list dashboards
  • Update dashboard configurations
  • Archive and restore dashboards
  • Delete dashboards permanently
  • Comprehensive error handling

Prerequisites

  • Go 1.24 or higher
  • Valid groundcover API credentials
  • Access to a groundcover environment

Documentation

For more detailed information, refer to:

Directories

Path Synopsis
read-to-console command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL