-
Notifications
You must be signed in to change notification settings - Fork 6.3k
Use PromQL info function instead of resource attribute promotion #2869
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a510a64
Use PromQL info() function instead of resource attribute promotion
aknuds1 3f3ce80
Update Grafana dashboards and alerts to use info() function
aknuds1 8779cbc
Add Kubernetes/Kind deployment support for info() function
aknuds1 88a0c65
Add CHANGELOG entry for info() function migration
aknuds1 141d013
Merge PostgreSQL into single metrics pipeline
aknuds1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| #!/bin/sh | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Deploy OpenTelemetry Demo to a local Kind cluster | ||
| # | ||
| # This script creates a Kind cluster and delegates the actual deployment | ||
| # to deploy.sh with Kind-specific values. | ||
| # | ||
| # Prerequisites: | ||
| # - kind: https://kind.sigs.k8s.io/docs/user/quick-start/#installation | ||
| # - kubectl | ||
| # - helm | ||
|
|
||
| set -e | ||
|
|
||
| CLUSTER_NAME="${CLUSTER_NAME:-otel-demo}" | ||
| KUBE_CONTEXT="kind-${CLUSTER_NAME}" | ||
| export NAMESPACE="${NAMESPACE:-otel-demo}" | ||
| export RELEASE_NAME="${RELEASE_NAME:-opentelemetry-demo}" | ||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
|
|
||
| # Check prerequisites | ||
| command -v kind >/dev/null 2>&1 || { echo "Error: kind is not installed. See https://kind.sigs.k8s.io/docs/user/quick-start/#installation"; exit 1; } | ||
| command -v kubectl >/dev/null 2>&1 || { echo "Error: kubectl is not installed."; exit 1; } | ||
| command -v helm >/dev/null 2>&1 || { echo "Error: helm is not installed."; exit 1; } | ||
|
|
||
| echo "=== OpenTelemetry Demo on Kind ===" | ||
| echo "Cluster: $CLUSTER_NAME" | ||
| echo "" | ||
|
|
||
| # Create Kind cluster if it doesn't exist | ||
| if ! kind get clusters 2>/dev/null | grep -q "^${CLUSTER_NAME}$"; then | ||
| echo "Creating Kind cluster '$CLUSTER_NAME'..." | ||
| kind create cluster --config "$SCRIPT_DIR/kind-config.yaml" --name "$CLUSTER_NAME" | ||
| echo "" | ||
| else | ||
| echo "Kind cluster '$CLUSTER_NAME' already exists." | ||
| echo "" | ||
| fi | ||
|
|
||
| # Deploy using the shared script with Kind-specific values | ||
| "$SCRIPT_DIR/deploy.sh" \ | ||
| --context "$KUBE_CONTEXT" \ | ||
| -f "$SCRIPT_DIR/values-kind.yaml" \ | ||
| --timeout 10m | ||
|
|
||
| # Wait for pods | ||
| echo "" | ||
| echo "Waiting for pods to be ready..." | ||
| kubectl --context "$KUBE_CONTEXT" wait --for=condition=ready \ | ||
| pod -l app.kubernetes.io/instance="$RELEASE_NAME" \ | ||
| --namespace "$NAMESPACE" --timeout=5m 2>/dev/null || true | ||
|
|
||
| echo "" | ||
| echo "Access the demo:" | ||
| echo " Frontend: http://localhost:8080 (via Kind NodePort)" | ||
| echo "" | ||
| echo "For Grafana, Prometheus, Jaeger use port-forward:" | ||
| echo " kubectl --context $KUBE_CONTEXT port-forward svc/grafana 3000:80 -n $NAMESPACE" | ||
| echo " kubectl --context $KUBE_CONTEXT port-forward svc/prometheus 9090:9090 -n $NAMESPACE" | ||
| echo " kubectl --context $KUBE_CONTEXT port-forward svc/jaeger 16686:16686 -n $NAMESPACE" | ||
| echo "" | ||
| echo "View pods:" | ||
| echo " kubectl --context $KUBE_CONTEXT get pods -n $NAMESPACE" | ||
| echo "" | ||
| echo "Delete cluster when done:" | ||
| echo " kind delete cluster --name $CLUSTER_NAME" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| #!/bin/sh | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Deploy OpenTelemetry Demo to a Kubernetes cluster | ||
| # | ||
| # This script: | ||
| # 1. Installs/upgrades the Helm chart with info() function values | ||
| # 2. Deploys custom Grafana dashboards that use the info() function | ||
| # | ||
| # Usage: | ||
| # kubernetes/deploy.sh --context kind-otel-demo | ||
| # kubernetes/deploy.sh --context kind-otel-demo -f kubernetes/values-kind.yaml | ||
| # | ||
| # The --context argument is required and passed to both kubectl and helm. | ||
| # All other arguments are passed to helm upgrade. | ||
| # | ||
| # Environment variables: | ||
| # NAMESPACE - Kubernetes namespace (default: otel-demo) | ||
| # RELEASE_NAME - Helm release name (default: opentelemetry-demo) | ||
|
|
||
| set -e | ||
|
|
||
| NAMESPACE="${NAMESPACE:-otel-demo}" | ||
| RELEASE_NAME="${RELEASE_NAME:-opentelemetry-demo}" | ||
| SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| REPO_ROOT="$(dirname "$SCRIPT_DIR")" | ||
|
|
||
| # Parse --context argument | ||
| KUBE_CONTEXT="" | ||
| HELM_ARGS="" | ||
| while [ $# -gt 0 ]; do | ||
| case "$1" in | ||
| --context) | ||
| KUBE_CONTEXT="$2" | ||
| shift 2 | ||
| ;; | ||
| *) | ||
| HELM_ARGS="$HELM_ARGS $1" | ||
| shift | ||
| ;; | ||
| esac | ||
| done | ||
|
|
||
| if [ -z "$KUBE_CONTEXT" ]; then | ||
| echo "Error: --context is required" | ||
| echo "Usage: $0 --context <kube-context> [helm args...]" | ||
| exit 1 | ||
| fi | ||
|
|
||
| KUBECTL="kubectl --context $KUBE_CONTEXT" | ||
| HELM_CONTEXT="--kube-context $KUBE_CONTEXT" | ||
|
|
||
| echo "=== Deploying OpenTelemetry Demo ===" | ||
| echo "Namespace: $NAMESPACE" | ||
| echo "Release: $RELEASE_NAME" | ||
| echo "Context: $KUBE_CONTEXT" | ||
| echo "" | ||
|
|
||
| # Add Helm repo if not already added | ||
| echo "Adding Helm repository..." | ||
| helm repo add --force-update open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts | ||
|
|
||
| # Create namespace if it doesn't exist | ||
| $KUBECTL create namespace "$NAMESPACE" --dry-run=client -o yaml | $KUBECTL apply -f - | ||
|
|
||
| # Install/upgrade the Helm chart | ||
| echo "" | ||
| echo "Installing/upgrading Helm chart..." | ||
| # shellcheck disable=SC2086 | ||
| helm upgrade --install "$RELEASE_NAME" open-telemetry/opentelemetry-demo \ | ||
| $HELM_CONTEXT \ | ||
| --namespace "$NAMESPACE" \ | ||
| -f "$SCRIPT_DIR/values.yaml" \ | ||
| $HELM_ARGS \ | ||
| --wait | ||
|
|
||
| # Deploy custom dashboards as ConfigMaps. | ||
| # Delete conflicting dashboards from Helm chart that don't use info() function. | ||
| echo "" | ||
| echo "Deploying custom Grafana dashboards..." | ||
| echo " - Removing default Helm chart dashboards..." | ||
| $KUBECTL delete configmap grafana-dashboard-apm-dashboard --namespace "$NAMESPACE" --ignore-not-found | ||
| $KUBECTL delete configmap grafana-dashboard-postgresql-dashboard --namespace "$NAMESPACE" --ignore-not-found | ||
| $KUBECTL delete configmap grafana-dashboard-opentelemetry-collector --namespace "$NAMESPACE" --ignore-not-found | ||
|
|
||
| echo " - APM Dashboard" | ||
| $KUBECTL create configmap apm-dashboard \ | ||
| --from-file=apm-dashboard.json="$REPO_ROOT/src/grafana/provisioning/dashboards/demo/apm-dashboard.json" \ | ||
| --namespace "$NAMESPACE" \ | ||
| --dry-run=client -o yaml | $KUBECTL apply -f - | ||
| $KUBECTL label configmap apm-dashboard grafana_dashboard=1 --namespace "$NAMESPACE" --overwrite | ||
|
|
||
| echo " - PostgreSQL Dashboard" | ||
| $KUBECTL create configmap postgresql-dashboard \ | ||
| --from-file=postgresql-dashboard.json="$REPO_ROOT/src/grafana/provisioning/dashboards/demo/postgresql-dashboard.json" \ | ||
| --namespace "$NAMESPACE" \ | ||
| --dry-run=client -o yaml | $KUBECTL apply -f - | ||
| $KUBECTL label configmap postgresql-dashboard grafana_dashboard=1 --namespace "$NAMESPACE" --overwrite | ||
|
|
||
| echo " - OpenTelemetry Collector Dashboard" | ||
| $KUBECTL create configmap otel-collector-dashboard \ | ||
| --from-file=opentelemetry-collector.json="$REPO_ROOT/src/grafana/provisioning/dashboards/demo/opentelemetry-collector.json" \ | ||
| --namespace "$NAMESPACE" \ | ||
| --dry-run=client -o yaml | $KUBECTL apply -f - | ||
| $KUBECTL label configmap otel-collector-dashboard grafana_dashboard=1 --namespace "$NAMESPACE" --overwrite | ||
|
|
||
| # Restart Grafana to pick up the new dashboards | ||
| echo "" | ||
| echo "Restarting Grafana to load dashboards..." | ||
| $KUBECTL rollout restart deployment/grafana --namespace "$NAMESPACE" 2>/dev/null || \ | ||
| $KUBECTL rollout restart deployment/"$RELEASE_NAME"-grafana --namespace "$NAMESPACE" 2>/dev/null || \ | ||
| echo " (Could not restart Grafana - dashboards will load on next restart)" | ||
|
|
||
| echo "" | ||
| echo "=== Deployment complete ===" | ||
| echo "" | ||
| echo "Access the demo:" | ||
| echo " kubectl --context $KUBE_CONTEXT port-forward svc/frontend-proxy 8080:8080 -n $NAMESPACE" | ||
| echo " Open http://localhost:8080" | ||
| echo "" | ||
| echo "Access Grafana:" | ||
| echo " kubectl --context $KUBE_CONTEXT port-forward svc/grafana 3000:80 -n $NAMESPACE" | ||
| echo " Open http://localhost:3000 (admin/admin)" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Kind cluster configuration for OpenTelemetry Demo | ||
| # Creates a cluster with port mapping for the frontend proxy | ||
| # | ||
| # Usage: | ||
| # kind create cluster --config kubernetes/kind-config.yaml --name otel-demo | ||
| # | ||
| kind: Cluster | ||
| apiVersion: kind.x-k8s.io/v1alpha4 | ||
| nodes: | ||
| - role: control-plane | ||
| extraPortMappings: | ||
| # Frontend proxy (main entry point) - exposed via NodePort | ||
| - containerPort: 30080 | ||
| hostPort: 8080 | ||
| protocol: TCP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Copyright The OpenTelemetry Authors | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| # Additional Helm values for Kind deployment | ||
| # Use with: -f values.yaml -f values-kind.yaml | ||
| # | ||
| # This configures the frontend-proxy service as NodePort for Kind access | ||
| # and increases memory limits for services that need more than the defaults | ||
|
|
||
| components: | ||
| frontend-proxy: | ||
| service: | ||
| type: NodePort | ||
| nodePort: 30080 | ||
| # Increase memory limits for services that OOMKill with defaults | ||
| product-catalog: | ||
| resources: | ||
| limits: | ||
| memory: 100Mi | ||
| flagd: | ||
| resources: | ||
| limits: | ||
| memory: 500Mi | ||
| # Disable flagd-ui sidecar - it OOMKills even with 1Gi limit | ||
| sidecarContainers: [] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these files in Kubernetes should be removed. Ultimately we are moving all K8s support to be based on using our Helm chart. The existing manifest file here also needs to be removed since this folder really just causes overall confusion to other contributors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, thanks for making me aware.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought about it. The kubernetes/deploy-kind.sh script is useful for me to install into a local k8s cluster and test my changes. It's already based around Helm, what's the argument against it? One would think it's generally useful for testing OTel demo in k8s mode?