### Download and run Node.js quickstart service Source: https://grafana.com/docs/beyla/latest/quickstart/nodejs Download the Node.js service files and install dependencies to start the service. ```bash curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/nodejs/package.json curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/nodejs/quickstart.js npm install && npm start ``` -------------------------------- ### Run example script Source: https://grafana.com/docs/agent/latest/flow/tutorials/collecting-prometheus-metrics This command downloads and executes a setup script for Grafana Agent, Mimir, and Grafana using Docker Compose. Ensure Docker is installed and running. ```bash curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/runt.sh -O && bash ./runt.sh agent.river ``` -------------------------------- ### Helm Installation Output Example Source: https://grafana.com/docs/helm-charts/tempo-distributed/next/get-started-helm-charts This is an example of the output you can expect after a successful Helm installation of Tempo. It includes deployment details and installed components. ```bash > helm -n tempo-test install tempo grafana-community/tempo-distributed -f custom.yaml W0210 15:02:09.901064 8613 warnings.go:70] spec.template.spec.topologySpreadConstraints[0].topologyKey: failure-domain.beta.kubernetes.io/zone is deprecated since v1.17; use "topology.kubernetes.io/zone" instead W0210 15:02:09.904082 8613 warnings.go:70] spec.template.spec.topologySpreadConstraints[0].topologyKey: failure-domain.beta.kubernetes.io/zone is deprecated since v1.17; use "topology.kubernetes.io/zone" instead W0210 15:02:09.906932 8613 warnings.go:70] spec.template.spec.topologySpreadConstraints[0].topologyKey: failure-domain.beta.kubernetes.io/zone is deprecated since v1.17; use "topology.kubernetes.io/zone" instead W0210 15:02:09.929946 8613 warnings.go:70] spec.template.spec.topologySpreadConstraints[0].topologyKey: failure-domain.beta.kubernetes.io/zone is deprecated since v1.17; use "topology.kubernetes.io/zone" instead W0210 15:02:09.930379 8613 warnings.go:70] spec.template.spec.topologySpreadConstraints[0].topologyKey: failure-domain.beta.kubernetes.io/zone is deprecated since v1.17; use "topology.kubernetes.io/zone" instead NAME: tempo LAST DEPLOYED: Fri May 31 15:02:08 2024 NAMESPACE: tempo-test STATUS: deployed REVISION: 1 TEST SUITE: None NOTES: *********************************************************************** Welcome to Grafana Tempo Chart version: 1.10.1 Tempo version: 2.6.1 *********************************************************************** Installed components: * ingester * distributor * querier * query-frontend * compactor * memcached ``` -------------------------------- ### Example output of kubectl get all Source: https://grafana.com/docs/grafana/v13.1/setup-grafana/installation/kubernetes Sample output showing the status of pods, services, deployments, and replicasets for a Grafana installation. ```text NAME READY STATUS RESTARTS AGE pod/grafana-69946c9bd6-kwjb6 1/1 Running 0 7m27s NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/grafana LoadBalancer 10.5.243.226 1.120.130.330 3000:31171/TCP 7m27s NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/grafana 1/1 1 1 7m29s NAME DESIRED CURRENT READY AGE replicaset.apps/grafana-69946c9bd6 1 1 1 7m30s ``` -------------------------------- ### Configure gateway readiness probe path Source: https://grafana.com/docs/enterprise-logs/latest/setup/gel-helm-reference Sets the HTTP GET path for the gateway readiness probe. ```yaml "/ ``` -------------------------------- ### Configure bloomPlanner affinity Source: https://grafana.com/docs/enterprise-logs/latest/setup/gel-helm-reference Example configuration for implementing hard node anti-affinity for bloom-planner pods. ```yaml affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - bloom-planner topologyKey: "kubernetes.io/hostname" ``` -------------------------------- ### Configure compactor affinity Source: https://grafana.com/docs/enterprise-logs/latest/setup/gel-helm-reference Example configuration for setting hard node anti-affinity for compactor pods. ```yaml Hard node anti-affinity ``` -------------------------------- ### Ingress Hosts Definition Source: https://grafana.com/docs/enterprise-logs/latest/setup/gel-helm-reference Example of the hosts list configuration for the ingress resource. ```yaml [ "loki.example.com" ] ``` -------------------------------- ### Configure Hard Node Anti-Affinity Source: https://grafana.com/docs/enterprise-logs/latest/setup/gel-helm-reference Example configuration for setting hard node anti-affinity on gateway pods. ```yaml gateway: affinity: podAntiAffinity: requiredDuringSchedulingIgnoredDuringExecution: - labelSelector: matchExpressions: - key: app operator: In values: - gel-gateway topologyKey: kubernetes.io/hostname ``` -------------------------------- ### Get Setup Data JSON Response Source: https://grafana.com/docs/k6/latest/reference/k6-rest-api Example JSON response for the setup data. It shows the structure of the setup data, including any custom data defined. ```json { "data": { "type": "setupData", "id": "default", "attributes": { "data": { "a": 1 } } } } ``` -------------------------------- ### Configure GET Helm chart values Source: https://grafana.com/docs/enterprise-traces/latest/setup/helm-chart A comprehensive example of a values.yaml file for a GET installation, including MinIO storage, multitenancy, and gateway settings. ```yaml # Specify the global domain for the cluster (in this case just local cluster mDNS) global: clusterDomain: "cluster.local" # Enable the Helm chart for GET installation # Configure the Helm chart for a Grafana Enterprise Traces installation. # We set the latest GET version as the image tag (2.8.4). enterprise: enabled: true image: tag: v2.8.4 # Enable multitenancy for GET (required) multitenancyEnabled: true # MinIO storage configuration # The installs a separate MinIO service/deployment into the same cluster and namespace as the GET install. # Note: MinIO should not be used for production environments. minio: enabled: true mode: standalone rootUser: grafana-tempo rootPassword: supersecret buckets: # Bucket for traces storage if enterprise.enabled is true - requires license. This is where all trace span information is stored. - name: enterprise-traces policy: none purge: false # Admin client bucket if enterprise.enabled is true - requires license. This is where tenant and administration information is stored. - name: enterprise-traces-admin policy: none purge: false # Changed the mc (the MinIO CLI client) config path to '/tmp' from '/etc' as '/etc' is only writable by root and OpenShift will not permit this. configPathmc: "/tmp/minio/mc/" storage: # Specifies traces storage location. # Uses the MinIO bucket configured for trace storage. trace: backend: s3 s3: access_key: "grafana-tempo" secret_key: "supersecret" bucket: "enterprise-traces" endpoint: "tempo-minio:9000" insecure: true # Specifies administration data storage location. # Uses the MinIO bucket configured for admin storage. admin: backend: s3 s3: access_key_id: "grafana-tempo" secret_access_key: "supersecret" bucket_name: "enterprise-traces-admin" endpoint: "tempo-minio:9000" insecure: true # Specifies which trace protocols to accept by the gateway. # Note: GET's Enterprise gateway will only accept OTLP over gRPC or HTTP. traces: otlp: http: enabled: true grpc: enabled: true # Configure the distributor component to log all received spans. distributor: config: log_received_spans: enabled: true # Specify the license. This is the base64 license text you have received from your Grafana Labs representative. license: contents: | LICENSEGOESHERE ``` -------------------------------- ### Initialize Go project Source: https://grafana.com/docs/learning-paths/build-dashboard-sdk/setup-project Commands to create a directory, initialize a Go module, install the SDK, and create the main entry file. ```bash mkdir my-dashboards && cd my-dashboards ``` ```bash go mod init my-dashboards ``` ```bash go get github.com/grafana/grafana-foundation-sdk/go@latest ``` ```bash touch main.go ``` -------------------------------- ### Quick vSphere Configuration Example Source: https://grafana.com/docs/agent/latest/static/configuration/integrations/integrations-next/vsphere-config A minimal example demonstrating how to configure the `vsphere_configs` integration, including essential connection details and autoscrape settings. ```yaml integrations: vsphere_configs: - vsphere_url: https://127.0.0.1:8989/sdk vsphere_user: user vsphere_password: pass request_chunk_size: 256 collect_concurrency: 8 instance: vsphere autoscrape: enable: true metrics_instance: default metrics: wal_directory: /tmp/grafana-agent-wal server: log_level: debug ``` -------------------------------- ### Sample Application Deployment Output Source: https://grafana.com/docs/loki/latest/get-started/quick-start/tutorial Example output indicating the successful startup of the sample application's containers. ```console ✔ Container greenhouse-websocket_service-1 Started 0.7s ✔ Container greenhouse-db-1 Started 0.7s ✔ Container greenhouse-user_service-1 Started 0.8s ✔ Container greenhouse-bug_service-1 Started 0.8s ✔ Container greenhouse-plant_service-1 Started 0.8s ✔ Container greenhouse-simulation_service-1 Started 0.7s ✔ Container greenhouse-main_app-1 Started 0.7s ``` -------------------------------- ### Clone and Open xk6-quickstart Repository Source: https://grafana.com/docs/k6/latest/extensions/create/quickstart Clone the repository to your local machine and open it in Visual Studio Code. This setup is necessary to begin developing your k6 extension. ```bash git clone https://github.com/USER/xk6-quickstart.git code xk6-quickstart ``` -------------------------------- ### Install and Run Netdata Source: https://grafana.com/docs/k6/latest/results-output/real-time/netdata Use the kickstart script to easily download and run Netdata on your system. This command fetches and executes the installation script. ```bash bash <(curl -Ss https://my-netdata.io/kickstart.sh) ``` -------------------------------- ### Tempo CLI Example List Blocks Source: https://grafana.com/docs/tempo/latest/operations/tempo_cli Example of listing blocks for a tenant, specifying a configuration file. ```bash tempo-cli list blocks -c ./tempo.yaml single-tenant ``` -------------------------------- ### Get Response Body as ArrayBuffer Source: https://grafana.com/docs/k6/latest/javascript-api/k6-browser/response/body This example demonstrates how to navigate to a URL and retrieve the response body as an ArrayBuffer using `res.body()`. It includes basic setup for a k6 browser test and proper page handling. ```javascript import { browser } from 'k6/browser'; export const options = { scenarios: { ui: { executor: 'shared-iterations', options: { browser: { type: 'chromium', }, }, }, }, }; export default async function () { const page = await browser.newPage(); try { const res = await page.goto('https://test.k6.io/'); const body = await res.body(); // Refer to https://github.com/grafana/k6/issues/2440 on decoding the body to a string. } finally { await page.close(); } } ``` -------------------------------- ### Example configuration settings Source: https://grafana.com/docs/grafana/v13.1/setup-grafana/configure-grafana Sample configuration sections used to demonstrate environment variable mapping. ```ini # default section instance_name = ${HOSTNAME} [security] admin_user = admin [auth.google] client_secret = 0ldS3cretKey [plugin.grafana-image-renderer] rendering_ignore_https_errors = true [feature_toggles] newNavigation = true ``` -------------------------------- ### Install or upgrade GET with Helm Source: https://grafana.com/docs/enterprise-traces/latest/setup/helm-chart Use this command to install or upgrade the GET deployment using a custom configuration file. ```shell helm -n enterprise-traces install tempo grafana/tempo-distributed --version 1.48.1 -f custom.yaml ``` -------------------------------- ### Get preceding siblings with Selection.prevAll() Source: https://grafana.com/docs/k6/latest/javascript-api/k6-html/selection/selection-prevall Use Selection.prevAll() to find all preceding sibling elements of an element, starting from the element itself and moving backward through the DOM tree. This example demonstrates finding all preceding siblings of an element with the class 'third-item'. ```javascript import { parseHTML } from 'k6/html'; import { sleep } from 'k6'; export default function () { const content = ` `; const doc = parseHTML(content); const sel = doc.find('li.third-item').prevAll(); console.log(sel.size()); sleep(1); } ``` -------------------------------- ### Run Example Script Source: https://grafana.com/docs/agent/latest/flow/tutorials/chaining Use this script to download and run the necessary configurations for Mimir, Grafana, and Grafana Agent to set up the example environment. ```bash curl https://raw.githubusercontent.com/grafana/agent/main/docs/sources/flow/tutorials/assets/runt.sh -O && bash ./runt.sh multiple-inputs.river ``` -------------------------------- ### Example Get Features Response Source: https://grafana.com/docs/enterprise-metrics/latest/api/admin-api An example response from the Get Features endpoint, showing product name, version, and available features. ```json { "name": "GEM", "version": "1.1", "features": { "debug_export": "v1", "editable_access_policies": "v1", "editable_tenants": "v1", "lbac": "v1", "self_monitoring": "v1", "federated_rules": "v1" } } ``` -------------------------------- ### Build and Install from Source Source: https://grafana.com/docs/k6/latest/set-up/configure-ai-assistant Clone the repository and use 'make install' to build and install the k6 AI assistant from source. This is an alternative to package installation. ```sh git clone https://github.com/grafana/mcp-k6 cd mcp-k6 make install ``` -------------------------------- ### Start Docker Compose for Mail-House Example Source: https://grafana.com/docs/alloy/latest/monitor/monitor-structured-logs Navigate to the mail-house example directory and start the Grafana stack using Docker Compose. ```shell cd alloy-scenarios/mail-house docker compose up -d ``` -------------------------------- ### GET Plugin License Information Example Source: https://grafana.com/docs/enterprise-traces/latest/setup/setup-get-plugin-grafana This is an example of the license information you should see after successfully configuring the GET plugin and connecting to the GET admin API endpoints. It displays issuer, issue date, expiration date, and products. ```text Issuer: https://grafana.com Issued at: 2026-01-29 13:06:11 Expires: 2026-02-05 13:06:11 Products: grafana-enterprise-traces ``` -------------------------------- ### Run a simple Go blog service with Docker Source: https://grafana.com/docs/beyla/latest/setup/docker Starts a Docker container for a simple Go blog service. This is a prerequisite for the Beyla instrumentation example. ```sh docker run -p 18443:8443 --name goblog mariomac/goblog:dev ``` -------------------------------- ### Start Standalone Grafana Server Source: https://grafana.com/docs/grafana/v13.1/setup-grafana/installation/mac Starts the Grafana server from the installation directory. ```bash ./bin/grafana server ``` -------------------------------- ### Quick Snowflake Configuration Example Source: https://grafana.com/docs/agent/latest/static/configuration/integrations/snowflake-config A minimal example demonstrating how to enable and configure the snowflake integration with essential credentials and connection details. ```yaml integrations: snowflake: enabled: true account_name: XXXXXXX-YYYYYYY username: snowflake-user password: snowflake-pass warehouse: SNOWFLAKE_WAREHOUSE role: ACCOUNTADMIN ``` -------------------------------- ### Get Section with Example ID Source: https://grafana.com/docs/plugins/volkovlabs-form-panel/latest/custom-code/context-parameters Example of retrieving a section by providing its ID. ```javascript context.panel.sectionsUtils.get("section-id"); ``` -------------------------------- ### Example Pods Output Source: https://grafana.com/docs/enterprise-logs/latest/manage/meta-monitoring/deploy Example output showing running pods in the 'meta' namespace after deployment. ```console NAME READY STATUS RESTARTS ... meta-loki-alloy-singleton-6d7f8d8b86-sg4wx 2/2 Running 0 ... meta-loki-kube-state-metrics-64bdcfcbd-5snqz 1/1 Running 0 ... meta-loki-node-exporter-855l5 1/1 Running 0 ... meta-loki-node-exporter-b976b 1/1 Running 0 ... meta-loki-node-exporter-vsm4s 1/1 Running 0 ... ``` -------------------------------- ### Example Service Output Source: https://grafana.com/docs/helm-charts/mimir-distributed/v5.8.x/migration-guides/migrate-to-unified-proxy-deployment Example output from 'kubectl get service' command. ```console NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE mimir-nginx ClusterIP 10.188.8.32 8080/TCP,9095/TCP 172d ``` -------------------------------- ### Example Ingress Output Source: https://grafana.com/docs/helm-charts/mimir-distributed/v5.8.x/migration-guides/migrate-to-unified-proxy-deployment Example output from 'kubectl get ingress' command. ```console NAME CLASS HOSTS ADDRESS PORTS AGE mimir-nginx mimir.example.com 10.0.0.1 80, 443 172d ``` -------------------------------- ### Navigate to Single-Binary Example Source: https://grafana.com/docs/tempo/latest/docker-example Change directory into the single-binary Docker Compose example within the cloned Tempo repository. ```bash cd tempo/example/docker-compose/single-binary ``` -------------------------------- ### Install MinIO from Source Source: https://grafana.com/docs/tempo/latest/configuration/hosted-storage/s3 Install the MinIO server from source using the Go toolchain. This is necessary as pre-compiled binaries are no longer published for the community edition. ```bash go install github.com/minio/minio@latest ``` -------------------------------- ### Get token example Source: https://grafana.com/docs/enterprise-traces/v2.8.x/admin-api Example command to retrieve details for a specific token. ```bash $ curl -u :$API_TOKEN http://localhost:3100/admin/api/v3/tokens/primarytoken | jq { "name": "primarytoken", "display_name": "Primary token", "created_at": "2023-10-24T19:31:49.183102304Z", "status": "active", "access_policy": "primary-policy", "expiration": "0001-01-01T00:00:00Z" } ``` -------------------------------- ### List and Get S3 Object Example Source: https://grafana.com/docs/k6/latest/javascript-api/jslib/aws/s3client/object This script lists objects in a specified S3 bucket and then retrieves and prints the content of a specific test file. It includes setup for AWS configuration and S3 client initialization. The script aborts if the test object is not found. ```javascript import exec from 'k6/execution'; import { // listBuckets, AWSConfig, S3Client, } from 'https://jslib.k6.io/aws/0.14.0/s3.js'; const awsConfig = new AWSConfig({ region: __ENV.AWS_REGION, accessKeyId: __ENV.AWS_ACCESS_KEY_ID, secretAccessKey: __ENV.AWS_SECRET_ACCESS_KEY, }); const s3 = new S3Client(awsConfig); const testBucketName = 'test-jslib-aws'; const testFileKey = 'bonjour.txt'; export default async function () { const objects = await s3.listObjects(testBucketName); // If our test object does not exist, abort the execution. if (objects.filter((o) => o.key === testFileKey).length == 0) { exec.test.abort(); } // Let's download our test object and print its content const object = await s3.getObject(testBucketName, testFileKey); console.log(JSON.stringify(object)); } ``` -------------------------------- ### Tempo CLI Example List Compaction Summary Source: https://grafana.com/docs/tempo/latest/operations/tempo_cli Example of listing the compaction summary for a tenant, specifying a configuration file. ```bash tempo-cli list compaction-summary -c ./tempo.yaml single-tenant ``` -------------------------------- ### Initialize Go Module for Extension Source: https://grafana.com/docs/k6/latest/extensions/create/output-extensions Set up a new directory and initialize a Go module for your k6 output extension. ```bash mkdir xk6-output-logger; cd xk6-output-logger; go mod init xk6-output-logger ``` -------------------------------- ### Get installed plugin info Source: https://grafana.com/docs/grafana/v13.1/developer-resources/api-reference/cloud-api Retrieves details for a specific plugin installed on an instance. ```http GET https://grafana.com/api/instances//plugins/ ``` -------------------------------- ### Get Setup Data Source: https://grafana.com/docs/k6/latest/reference/k6-rest-api Retrieves the current JSON-encoded setup data for the test. This endpoint is useful for inspecting the state of the setup stage. ```APIDOC ## GET /v1/setup ### Description Returns the current JSON-encoded setup data. ### Method GET ### Endpoint `http://localhost:6565/v1/setup` ### Response #### Success Response (200) - **data** (object) - Contains the setup data. - **type** (string) - The type of the resource, always "setupData". - **id** (string) - The identifier for the setup data, typically "default". - **attributes** (object) - Contains the actual setup data. - **data** (object) - The JSON-encoded setup data. ### Response Example ```json { "data": { "type": "setupData", "id": "default", "attributes": { "data": { "a": 1 } } } } ``` ``` -------------------------------- ### Inspect ExecStart configuration Source: https://grafana.com/docs/grafana/v13.1/fundamentals/getting-started/first-dashboards/get-started-grafana-prometheus Example of the ExecStart line within the systemd service file. ```bash ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/ ``` -------------------------------- ### Get Setup Data with cURL Source: https://grafana.com/docs/k6/latest/reference/k6-rest-api Retrieve the current JSON-encoded setup data for the test. This endpoint is used to inspect the setup configuration. ```bash curl -X GET \ http://localhost:6565/v1/setup \ -H 'Content-Type: application/json' ``` -------------------------------- ### Example CPU Metric Queries Source: https://grafana.com/docs/grafana/v13.1/visualizations/dashboards/variables/advanced-variables Sample queries demonstrating how variables resolve based on user selections. ```bash SHOW TAG VALUES WITH KEY = "cpu" WHERE "datacenter" =~ /^America/ AND "host" =~ /^server2/ SHOW TAG VALUES WITH KEY = "cpu" WHERE "datacenter" =~ /^Africa/ AND "host" =~ /^server/7/ SHOW TAG VALUES WITH KEY = "cpu" WHERE "datacenter" =~ /^Europe/ AND "host" =~ /^server3+server4/ ``` -------------------------------- ### Run Example Go HTTP Service Source: https://grafana.com/docs/beyla/latest/quickstart/golang Download and run a simple Go HTTP service for testing instrumentation. ```none curl -OL https://raw.githubusercontent.com/grafana/beyla/main/examples/quickstart/golang/quickstart.go go run quickstart.go ```