google-agents-cli-scaffold
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
aggregating-event-datasets
Aggregate and summarize event datasets (logs) using OPAL statsby. Use when you need to count, sum, or calculate statistics across log events. Covers make_col for derived columns, statsby for aggregation, group_by for grouping, aggregation functions (count, sum, avg, percentile), and topk for top ...
Full skill instructions
Event datasets (logs) can be aggregated to create summaries and statistics. This skill teaches you how to use statsby to aggregate log data into meaningful insights using OPAL.
Note: This skill covers statsby which returns one summary row per group across the entire time range. For time-series trends (multiple rows per group over time), see the time-series-analysis skill.
log interface (or any Event dataset)statsby is the primary aggregation verb for event datasets. It:
Syntax:
statsby aggregation_function(), group_by(dimension1, dimension2, ...)
count() - Count number of eventssum(field) - Sum values of a fieldavg(field) - Average value of a fieldmin(field) - Minimum valuemax(field) - Maximum valuepercentile(field, p) - Percentile (e.g., p=0.95 for 95th percentile)any_not_null(field) - Any non-null value from the grouptopk N, max(metric) - Get top N results by a specific metric (semantically correct for "top performers")sort desc(metric) | limit N - Alternative but less clear intentStart with dataset discovery (same as filtering-event-datasets):
Step 1: Find dataset
discover_context("kubernetes logs")
Step 2: Get schema
discover_context(dataset_id="YOUR_DATASET_ID")
Note fields you'll use for:
Use case: Count total events
statsby count()
Explanation: Counts all events in the time range. Returns single row with total count.
Output:
count
5831
Use case: Count events grouped by a field (e.g., namespace)
make_col namespace:string(resource_attributes."k8s.namespace.name")
| statsby count(), group_by(namespace)
| topk 10, max(count)
Explanation:
make_col creates a derived column namespace from nested fieldstatsby counts events, grouped by namespacetopk returns top 10 namespaces by countOutput:
namespace,count,_c_rank
default,5805,1
kube-system,648,2
observe,64,3
Use case: Count errors per namespace
filter contains(body, "error")
| make_col namespace:string(resource_attributes."k8s.namespace.name")
| statsby error_count:count(), group_by(namespace)
| topk 10, max(error_count)
Explanation: Filters for errors first, then counts by namespace. Notice we name the count error_count for clarity.
Use case: Count by namespace AND pod
make_col
namespace:string(resource_attributes."k8s.namespace.name"),
pod:pod
| statsby count(), group_by(namespace, pod)
| topk 20, max(count)
Explanation: Groups by multiple dimensions. Each unique (namespace, pod) combination gets one row.
Use case: Calculate multiple statistics in one query
filter stream = "stderr"
| make_col namespace:string(resource_attributes."k8s.namespace.name")
| statsby
stderr_count:count(),
group_by(namespace)
| topk 10, max(stderr_count)
Explanation: You can calculate multiple aggregations in a single statsby call.
End-to-end workflow for analyzing errors across your infrastructure.
Scenario: Find which services, namespaces, and pods are producing the most errors in the last 24 hours.
Step 1: Discovery
discover_context("kubernetes logs")
Found: Dataset "Kubernetes Explorer/Kubernetes Logs" (ID: 42161740)
Step 2: Build query
filter contains(body, "error") or contains(body, "ERROR")
| make_col
namespace:string(resource_attributes."k8s.namespace.name"),
pod:pod,
container:container
| statsby error_count:count(), group_by(namespace, pod, container)
| topk 20, max(error_count)
Step 3: Execute
execute_opal_query(
query="[query above]",
primary_dataset_id="42161740",
time_range="24h"
)
Step 4: Interpret results
namespace,pod,container,error_count,_c_rank
kube-system,calico-node-74d4r,calico-node,33,1
kube-system,calico-node-hhvbf,calico-node,31,2
kube-system,calico-node-ghk2s,calico-node,31,3
kube-system,calico-kube-controllers-759cd8b574-fzr49,calico-kube-controllers,31,4
Analysis:
kube-system namespacecalico-node pods are the primary error sourcecalico-node)Next steps: Investigate the specific calico-node errors to understand the root cause.
Use case: Count errors vs total, calculate error rate
make_col
namespace:string(resource_attributes."k8s.namespace.name"),
is_error:if(contains(body, "error"), 1, 0)
| statsby
total:count(),
error_count:sum(is_error),
group_by(namespace)
| make_col error_rate:float64(error_count)/float64(total)
| topk 10, max(error_rate)
Explanation:
is_error (1 or 0)Note: OPAL doesn't have count_if(), so use if() + sum() pattern.
Use case: Safely handle type conversions for nested fields
make_col
namespace:string(resource_attributes."k8s.namespace.name"),
pod:string(pod),
container:string(container)
| statsby count(), group_by(namespace, pod, container)
| topk 20, max(count)
Explanation: Wrap fields in string(), int64(), float64() for type safety, especially with nested fields.
❌ Wrong:
statsby count(), group_by(resource_attributes."k8s.namespace.name")
# Error: Can't group by nested field directly
✅ Correct:
make_col namespace:string(resource_attributes."k8s.namespace.name")
| statsby count(), group_by(namespace)
Why: statsby group_by needs simple column names. Use make_col to extract nested fields first.
❌ Wrong:
align options(bins: 1), count:count()
aggregate total:sum(count)
# align is for METRICS only!
✅ Correct:
statsby count()
# statsby is for EVENTS
Why: align is only for metric datasets. Events use statsby for aggregation.
❌ Wrong (less clear):
statsby error_count:count(), group_by(namespace)
| sort desc(error_count)
| limit 10
✅ Correct:
statsby error_count:count(), group_by(namespace)
| topk 10, max(error_count)
Why: topk explicitly states "top N by this metric" - clearer intent than arbitrary limit.
❌ Wrong (if you want summary):
timechart 1h, count(), group_by(namespace)
# Returns multiple rows per namespace (time-series)
✅ Correct (for summary):
statsby count(), group_by(namespace)
# Returns one row per namespace (total)
Why:
statsby = Single summary across time rangetimechart = Time-series with multiple rows per grouperror_count:count() instead of just count()statsby for better performancestring() for safetyCounting:
count() - Count all events in groupNumeric:
sum(field) - Sum valuesavg(field) - Averagemin(field) - Minimummax(field) - Maximumpercentile(field, p) - Percentile (0.0 to 1.0)String/Any:
any_not_null(field) - Any non-null value from groupFor more details, see:
Last Updated: November 14, 2025 Version: 1.0 Tested With: Observe OPAL v2.x
Project scaffolding, deployment configuration, and CI/CD setup for Google ADK agents.
Set up tracing, logging, and monitoring for deployed ADK agents across Cloud Trace, BigQuery, and third-party platforms.
Enterprise Azure infrastructure architect generating Bicep or Terraform from workload descriptions.
Plan and configure production-ready Azure Kubernetes Service clusters with Day-0 and Day-1 best practices.
Raw mechanical interfaces fusing Swiss typographic print with military terminal aesthetics. Rigid grids, extreme type scale contrast, utilitarian color, analog degradation effects. For data-heavy dashboards, portfolios, or editorial sites that need to feel like declassified blueprints.
Web search, scraping, extraction, crawling, and monitoring via ScrapeGraph AI CLI.
Skill for working with Firebase Hosting (Classic). Use this when you want to deploy static web apps, Single Page Apps (SPAs), or simple microservices. Do NOT use for Firebase App Hosting.
Deploy and manage web apps with Firebase App Hosting. Use this skill when deploying Next.js/Angular apps with backends.
Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".
Build SEO-optimized pages at scale using templates, data, and proven playbook patterns.
Design and build isolated, reusable Convex backend components with clear boundaries and app-facing wrappers.
Deploy and manage projects on Vercel using token-based authentication. Use when working with Vercel CLI using access tokens rather than interactive login — e.g. "deploy to vercel", "set up vercel", "add environment variables to vercel".
Opus.ai: Revolutionize Your Web Experience
Build a no-code AI app in minutes.
An IDE for code migration from legacy to modern frameworks through coding agents.
Automate CGI animation in live-action scenes
Branded artistic QR-code concepts
Launch a website in seconds with AI.
Streamline Your Coding Experience with AI Code Helper
Convert any screenshot or design to clean code.