diff --git a/.betterer.results b/.betterer.results index 74c1c477bbd..c61b1819cc9 100644 --- a/.betterer.results +++ b/.betterer.results @@ -794,50 +794,12 @@ exports[`better eslint`] = { [0, 0, 0, "Do not re-export imported variable (\`notifyApp\`)", "2"], [0, 0, 0, "Do not re-export imported variable (\`hideAppNotification\`)", "3"] ], - "public/app/core/components/AccessControl/PermissionListItem.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], "public/app/core/components/AccessControl/index.ts:5381": [ [0, 0, 0, "Do not use export all (\`export * from ...\`)", "0"] ], - "public/app/core/components/AppChrome/AppChrome.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/AppChrome/TopBar/SignInLink.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/AppChrome/TopBar/TopSearchBarCommandPaletteTrigger.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/AppNotifications/AppNotificationItem.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], "public/app/core/components/DynamicImports/SafeDynamicImport.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], - "public/app/core/components/EmptyListCTA/EmptyListCTA.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/FolderFilter/FolderFilter.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/ForgottenPassword/ChangePassword.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], - "public/app/core/components/ForgottenPassword/ForgottenPassword.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"] - ], - "public/app/core/components/FormPrompt/FormPrompt.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] - ], "public/app/core/components/GraphNG/GraphNG.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], @@ -849,79 +811,14 @@ exports[`better eslint`] = { "public/app/core/components/LocalStorageValueProvider/index.tsx:5381": [ [0, 0, 0, "Do not re-export imported variable (\`./LocalStorageValueProvider\`)", "0"] ], - "public/app/core/components/Login/LoginLayout.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/Login/LoginServiceButtons.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/NestedFolderPicker/NestedFolderList.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/PageNotFound/EntityNotFound.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"] - ], - "public/app/core/components/PanelTypeFilter/PanelTypeFilter.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/PluginHelp/PluginHelp.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], - "public/app/core/components/RolePicker/BuiltinRoleSelector.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/RolePicker/RolePickerInput.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/RolePicker/RolePickerMenu.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"] - ], - "public/app/core/components/RolePicker/RolePickerSubMenu.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/Select/OldFolderPicker.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/core/components/Signup/SignupPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], - "public/app/core/components/Signup/VerifyEmail.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"] - ], "public/app/core/components/TagFilter/TagFilter.tsx:5381": [ - [0, 0, 0, "Unexpected any. Specify a different type.", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] + [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], "public/app/core/components/TimeSeries/utils.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"], [0, 0, 0, "Unexpected any. Specify a different type.", "2"] ], - "public/app/core/components/Upgrade/UpgradeBox.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"] - ], - "public/app/core/components/help/HelpModal.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], "public/app/core/config.ts:5381": [ [0, 0, 0, "Do not re-export imported variable (\`config\`)", "0"], [0, 0, 0, "Do not re-export imported variable (\`Settings\`)", "1"] @@ -936,15 +833,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not re-export imported variable (\`TimeSeries\`)", "6"], [0, 0, 0, "Do not re-export imported variable (\`updateLegendValues\`)", "7"] ], - "public/app/core/navigation/GrafanaRouteError.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] - ], - "public/app/core/navigation/RouterDebugger.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], "public/app/core/navigation/types.ts:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -1035,161 +923,18 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Do not use any type assertions.", "1"] ], - "public/app/features/actions/ActionEditorModalContent.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], - "public/app/features/actions/ActionsInlineEditor.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], "public/app/features/actions/ParamsEditor.tsx:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], - "public/app/features/admin/AdminEditOrgPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"] - ], - "public/app/features/admin/AdminFeatureTogglesPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] - ], "public/app/features/admin/AdminFeatureTogglesTable.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] ], - "public/app/features/admin/AdminListOrgsPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/AdminOrgsTable.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"] - ], - "public/app/features/admin/AdminSettings.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/ServerStats.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"] - ], "public/app/features/admin/UpgradePage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "6"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "7"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "8"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "9"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "10"] - ], - "public/app/features/admin/UserCreatePage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/UserLdapSyncInfo.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "6"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "7"] - ], - "public/app/features/admin/UserListAdminPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/UserListPublicDashboardPage/DashboardsListModalButton.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/UserListPublicDashboardPage/UserListPublicDashboardPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/UserOrgs.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "6"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "7"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "8"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "9"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "10"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "11"] - ], - "public/app/features/admin/UserPermissions.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"] - ], - "public/app/features/admin/UserProfile.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"] - ], - "public/app/features/admin/UserSessions.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "4"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "5"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "6"] - ], - "public/app/features/admin/Users/AnonUsersTable.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/Users/OrgUsersTable.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "3"] - ], - "public/app/features/admin/Users/UsersTable.tsx:5381": [ [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] ], - "public/app/features/admin/ldap/LdapConnectionStatus.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], - "public/app/features/admin/ldap/LdapPage.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"] - ], - "public/app/features/admin/ldap/LdapSyncInfo.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/ldap/LdapUserGroups.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/ldap/LdapUserInfo.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"] - ], - "public/app/features/admin/ldap/LdapUserPermissions.tsx:5381": [ - [0, 0, 0, "No untranslated strings. Wrap text with ", "0"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "1"], - [0, 0, 0, "No untranslated strings. Wrap text with ", "2"] - ], "public/app/features/alerting/routes.tsx:5381": [ [0, 0, 0, "Unexpected any. Specify a different type.", "0"] ], @@ -6011,22 +5756,6 @@ exports[`no gf-form usage`] = { [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] ], - "public/app/features/admin/partials/edit_org.html:5381": [ - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] - ], - "public/app/features/admin/partials/styleguide.html:5381": [ - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], - [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"] - ], "public/app/features/annotations/partials/event_editor.html:5381": [ [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], [0, 0, 0, "gf-form usage has been deprecated. Use a component from @grafana/ui or custom CSS instead.", "5381"], diff --git a/.drone.yml b/.drone.yml index d010b7598b2..055db278c6c 100644 --- a/.drone.yml +++ b/.drone.yml @@ -184,12 +184,27 @@ steps: - yarn-install image: node:20.9.0-alpine name: betterer-frontend +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - is_fork=$(curl --retry 5 "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" + - GITHUB_TOKEN=$(cat /github-app/token) + - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork) - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -199,12 +214,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - yarn run ci:test-frontend depends_on: @@ -230,6 +247,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -248,12 +267,27 @@ platform: os: linux services: [] steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - is_fork=$(curl --retry 5 "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" + - GITHUB_TOKEN=$(cat /github-app/token) + - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork) - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -263,12 +297,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - echo $DRONE_RUNNER_NAME image: alpine:3.20.3 @@ -318,6 +354,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -336,12 +374,27 @@ platform: os: linux services: [] steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - is_fork=$(curl --retry 5 "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" + - GITHUB_TOKEN=$(cat /github-app/token) + - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork) - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -351,12 +404,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - echo $DRONE_RUNNER_NAME image: alpine:3.20.3 @@ -426,6 +481,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -455,12 +512,27 @@ steps: CGO_ENABLED: 0 image: golang:1.23.1-alpine name: compile-build-cmd +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - is_fork=$(curl --retry 5 "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" + - GITHUB_TOKEN=$(cat /github-app/token) + - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork) - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -470,12 +542,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - apk add --update make - make gen-go @@ -515,6 +589,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -533,6 +609,20 @@ platform: os: linux services: [] steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - echo $DRONE_RUNNER_NAME image: alpine:3.20.3 @@ -736,10 +826,12 @@ steps: image: cypress/included:13.10.0 name: end-to-end-tests-old-arch/various-suite - commands: + - GITHUB_TOKEN=$(cat /github-app/token) - cd / - ./cpp-e2e/scripts/ci-run.sh azure ${DRONE_SOURCE_BRANCH} depends_on: - grafana-server + - github-app-generate-token environment: AZURE_SP_APP_ID: from_secret: azure_sp_app_id @@ -748,11 +840,12 @@ steps: AZURE_TENANT: from_secret: azure_tenant CYPRESS_CI: "true" - GITHUB_TOKEN: - from_secret: github_token HOST: grafana-server image: us-docker.pkg.dev/grafanalabs-dev/cloud-data-sources/e2e-13.10.0:1.0.0 name: end-to-end-tests-cloud-plugins-suite-azure + volumes: + - name: github-app + path: /github-app when: paths: include: @@ -795,6 +888,7 @@ steps: - success - failure - commands: + - GITHUB_TOKEN=$(cat /github-app/token) - if [ ! -d ./playwright-report/trace ]; then echo 'all tests passed'; exit 0; fi - export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html - 'curl -L -X POST https://api.github.com/repos/grafana/grafana/issues/${DRONE_PULL_REQUEST}/comments @@ -806,17 +900,19 @@ steps: \"}"' depends_on: - playwright-e2e-report-upload - environment: - GITHUB_TOKEN: - from_secret: github_token + - github-app-generate-token failure: ignore image: byrnedo/alpine-curl:0.1.8 name: playwright-e2e-report-post-link + volumes: + - name: github-app + path: /github-app when: status: - success - failure - commands: + - export GITHUB_TOKEN=$(cat /github-app/token) - if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'missing videos'; false; fi - apt-get update @@ -836,15 +932,17 @@ steps: - end-to-end-tests-panels-suite - end-to-end-tests-smoke-tests-suite - end-to-end-tests-various-suite + - github-app-generate-token environment: E2E_TEST_ARTIFACTS_BUCKET: releng-pipeline-artifacts-dev GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY: from_secret: gcp_upload_artifacts_key - GITHUB_TOKEN: - from_secret: github_token failure: ignore image: google/cloud-sdk:431.0.0 name: e2e-tests-artifacts-upload + volumes: + - name: github-app + path: /github-app when: status: - success @@ -889,6 +987,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -953,12 +1053,27 @@ services: image: memcached:1.6.9-alpine name: memcached steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - is_fork=$(curl --retry 5 "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" + - GITHUB_TOKEN=$(cat /github-app/token) + - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork) - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -968,12 +1083,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - mkdir -p bin - curl -fL -o bin/grabpl https://grafana-downloads.storage.googleapis.com/grafana-build-pipeline/v3.1.1/grabpl @@ -1158,6 +1275,8 @@ volumes: - name: mysql80 temp: medium: memory +- name: github-app + temp: {} --- clone: retries: 3 @@ -1287,12 +1406,27 @@ platform: os: linux services: [] steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - is_fork=$(curl --retry 5 "https://$GITHUB_TOKEN@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" + - GITHUB_TOKEN=$(cat /github-app/token) + - is_fork=$(curl --retry 5 "https://$${GITHUB_TOKEN}@api.github.com/repos/grafana/grafana/pulls/$DRONE_PULL_REQUEST" | jq .head.repo.fork) - if [ "$is_fork" != false ]; then return 1; fi - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -1302,12 +1436,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - apk add --update git make - make swagger-clean && make openapi3-gen @@ -1318,9 +1454,6 @@ steps: && return 1; fi depends_on: - clone-enterprise - environment: - GITHUB_TOKEN: - from_secret: github_token image: golang:1.23.1-alpine name: swagger-gen trigger: @@ -1331,6 +1464,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -1395,9 +1530,24 @@ services: image: memcached:1.6.9-alpine name: memcached steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - apk add --update curl jq bash - - git clone "https://$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" + - GITHUB_TOKEN=$(cat /github-app/token) + - git clone "https://x-access-token:$${GITHUB_TOKEN}@github.com/grafana/grafana-enterprise.git" ../grafana-enterprise - cd ../grafana-enterprise - if git checkout ${DRONE_SOURCE_BRANCH}; then echo "checked out ${DRONE_SOURCE_BRANCH}"; @@ -1407,12 +1557,14 @@ steps: - ln -s src grafana - cd ./grafana-enterprise - ./build.sh - environment: - GITHUB_TOKEN: - from_secret: github_token + depends_on: + - github-app-generate-token failure: ignore image: alpine/git:2.40.1 name: clone-enterprise + volumes: + - name: github-app + path: /github-app - commands: - go build -o ./bin/build -ldflags '-extldflags -static' ./pkg/build/cmd depends_on: [] @@ -1509,6 +1661,8 @@ volumes: - name: mysql80 temp: medium: memory +- name: github-app + temp: {} --- clone: retries: 3 @@ -1933,6 +2087,20 @@ platform: os: linux services: [] steps: +- commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app - commands: - echo $DRONE_RUNNER_NAME image: alpine:3.20.3 @@ -2139,10 +2307,12 @@ steps: image: cypress/included:13.10.0 name: end-to-end-tests-old-arch/various-suite - commands: + - GITHUB_TOKEN=$(cat /github-app/token) - cd / - ./cpp-e2e/scripts/ci-run.sh azure ${DRONE_SOURCE_BRANCH} depends_on: - grafana-server + - github-app-generate-token environment: AZURE_SP_APP_ID: from_secret: azure_sp_app_id @@ -2151,11 +2321,12 @@ steps: AZURE_TENANT: from_secret: azure_tenant CYPRESS_CI: "true" - GITHUB_TOKEN: - from_secret: github_token HOST: grafana-server image: us-docker.pkg.dev/grafanalabs-dev/cloud-data-sources/e2e-13.10.0:1.0.0 name: end-to-end-tests-cloud-plugins-suite-azure + volumes: + - name: github-app + path: /github-app when: paths: include: @@ -2198,6 +2369,7 @@ steps: - success - failure - commands: + - GITHUB_TOKEN=$(cat /github-app/token) - if [ ! -d ./playwright-report/trace ]; then echo 'all tests passed'; exit 0; fi - export E2E_PLAYWRIGHT_REPORT_URL=https://storage.googleapis.com/releng-pipeline-artifacts-dev/${DRONE_BUILD_NUMBER}/playwright-report/index.html - 'curl -L -X POST https://api.github.com/repos/grafana/grafana/issues/${DRONE_PULL_REQUEST}/comments @@ -2209,17 +2381,19 @@ steps: \"}"' depends_on: - playwright-e2e-report-upload - environment: - GITHUB_TOKEN: - from_secret: github_token + - github-app-generate-token failure: ignore image: byrnedo/alpine-curl:0.1.8 name: playwright-e2e-report-post-link + volumes: + - name: github-app + path: /github-app when: status: - success - failure - commands: + - export GITHUB_TOKEN=$(cat /github-app/token) - if [ -z `find ./e2e -type f -name *spec.ts.mp4` ]; then echo 'missing videos'; false; fi - apt-get update @@ -2239,15 +2413,17 @@ steps: - end-to-end-tests-panels-suite - end-to-end-tests-smoke-tests-suite - end-to-end-tests-various-suite + - github-app-generate-token environment: E2E_TEST_ARTIFACTS_BUCKET: releng-pipeline-artifacts-dev GCP_GRAFANA_UPLOAD_ARTIFACTS_KEY: from_secret: gcp_upload_artifacts_key - GITHUB_TOKEN: - from_secret: github_token failure: ignore image: google/cloud-sdk:431.0.0 name: e2e-tests-artifacts-upload + volumes: + - name: github-app + path: /github-app when: status: - success @@ -2404,6 +2580,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -3534,6 +3712,7 @@ platform: services: [] steps: - commands: + - export GITHUB_TOKEN=$(cat /github-app/token) - apk add perl - v_target=`echo $${TAG} | perl -pe 's/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/v\1.\2.x/'` - curl -L $${GH_CLI_URL} | tar -xz --strip-components=1 -C /usr @@ -3542,10 +3721,11 @@ steps: depends_on: [] environment: GH_CLI_URL: https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_linux_amd64.tar.gz - GITHUB_TOKEN: - from_secret: github_token image: byrnedo/alpine-curl:0.1.8 name: create-release-pr + volumes: + - name: github-app + path: /github-app trigger: event: - promote @@ -3555,6 +3735,8 @@ volumes: - host: path: /var/run/docker.sock name: docker +- name: github-app + temp: {} --- clone: retries: 3 @@ -3604,6 +3786,21 @@ steps: image: grafana/grafana-ci-deploy:1.3.3 name: publish-storybook - commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app +- commands: + - export GITHUB_TOKEN=$(cat /github-app/token) - apk add perl - v_target=`echo $${TAG} | perl -pe 's/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/v\1.\2.x/'` - curl -L $${GH_CLI_URL} | tar -xz --strip-components=1 -C /usr @@ -3611,12 +3808,14 @@ steps: -f latest=$${LATEST} --repo=grafana/grafana release-pr.yml depends_on: - publish-artifacts + - github-app-generate-token environment: GH_CLI_URL: https://github.com/cli/cli/releases/download/v2.50.0/gh_2.50.0_linux_amd64.tar.gz - GITHUB_TOKEN: - from_secret: github_token image: byrnedo/alpine-curl:0.1.8 name: create-release-pr + volumes: + - name: github-app + path: /github-app trigger: event: - promote @@ -4118,6 +4317,7 @@ services: [] steps: - commands: - export GRAFANA_DIR=$$(pwd) + - export GITHUB_TOKEN=$(cat /github-app/token) - cd /src && ./scripts/drone_build_main.sh environment: _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: @@ -4137,8 +4337,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GO_VERSION: 1.23.1 GPG_PASSPHRASE: from_secret: packages_gpg_passphrase @@ -4157,6 +4355,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: github-app + path: /github-app trigger: branch: main event: @@ -4192,6 +4392,7 @@ services: [] steps: - commands: - export GRAFANA_DIR=$$(pwd) + - export GITHUB_TOKEN=$(cat /github-app/token) - cd /src && ./scripts/drone_build_tag_grafana.sh environment: _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: @@ -4211,8 +4412,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GO_VERSION: 1.23.1 GPG_PASSPHRASE: from_secret: packages_gpg_passphrase @@ -4231,6 +4430,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: github-app + path: /github-app trigger: event: exclude: @@ -4353,6 +4554,7 @@ services: [] steps: - commands: - export GRAFANA_DIR=$$(pwd) + - export GITHUB_TOKEN=$(cat /github-app/token) - cd /src && ./scripts/drone_build_tag_grafana.sh environment: _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: @@ -4372,8 +4574,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GO_VERSION: 1.23.1 GPG_PASSPHRASE: from_secret: packages_gpg_passphrase @@ -4392,6 +4592,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: github-app + path: /github-app trigger: ref: - refs/heads/v[0-9]* @@ -4589,6 +4791,7 @@ services: [] steps: - commands: - export GRAFANA_DIR=$$(pwd) + - export GITHUB_TOKEN=$(cat /github-app/token) - cd /src && ./scripts/drone_build_nightly_grafana.sh environment: _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: @@ -4608,8 +4811,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GO_VERSION: 1.23.1 GPG_PASSPHRASE: from_secret: packages_gpg_passphrase @@ -4628,6 +4829,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: github-app + path: /github-app - commands: - mkdir -p $${DESTINATION}/$${DRONE_BUILD_EVENT} - printenv GCP_KEY_BASE64 | base64 -d > /tmp/key.json @@ -4652,8 +4855,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GPG_PASSPHRASE: from_secret: packages_gpg_passphrase GPG_PRIVATE_KEY: @@ -4718,8 +4919,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GPG_PASSPHRASE: from_secret: packages_gpg_passphrase GPG_PRIVATE_KEY: @@ -4734,6 +4933,7 @@ steps: name: rgm-copy - commands: - export GRAFANA_DIR=$$(pwd) + - export GITHUB_TOKEN=$(cat /github-app/token) - cd /src && ./scripts/drone_publish_nightly_grafana.sh depends_on: - rgm-copy @@ -4755,8 +4955,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GO_VERSION: 1.23.1 GPG_PASSPHRASE: from_secret: packages_gpg_passphrase @@ -4775,6 +4973,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: github-app + path: /github-app - depends_on: - rgm-publish image: us.gcr.io/kubernetes-dev/package-publish:latest @@ -4844,9 +5044,26 @@ platform: services: [] steps: - commands: + - echo $(/usr/bin/github-app-external-token) > /github-app/token + environment: + GITHUB_APP_ID: + from_secret: github-app-app-id + GITHUB_APP_INSTALLATION_ID: + from_secret: github-app-installation-id + GITHUB_APP_PRIVATE_KEY: + from_secret: github-app-private-key + image: us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 + name: github-app-generate-token + volumes: + - name: github-app + path: /github-app +- commands: + - export GITHUB_TOKEN=$(cat /github-app/token) - 'dagger run --silent /src/grafana-build artifacts -a $${ARTIFACTS} --grafana-ref=$${GRAFANA_REF} --enterprise-ref=$${ENTERPRISE_REF} --grafana-repo=$${GRAFANA_REPO} --version=$${VERSION} ' - --go-version=1.23.1 + depends_on: + - github-app-generate-token environment: _EXPERIMENTAL_DAGGER_CLOUD_TOKEN: from_secret: dagger_token @@ -4865,8 +5082,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GO_VERSION: 1.23.1 GPG_PASSPHRASE: from_secret: packages_gpg_passphrase @@ -4885,6 +5100,8 @@ steps: volumes: - name: docker path: /var/run/docker.sock + - name: github-app + path: /github-app - commands: - printenv GCP_KEY_BASE64 | base64 -d > /tmp/key.json - gcloud auth activate-service-account --key-file=/tmp/key.json @@ -4906,8 +5123,6 @@ steps: from_secret: grafana_api_key GCP_KEY_BASE64: from_secret: gcp_key_base64 - GITHUB_TOKEN: - from_secret: github_token GPG_PASSPHRASE: from_secret: packages_gpg_passphrase GPG_PRIVATE_KEY: @@ -5471,6 +5686,7 @@ steps: - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM koalaman/shellcheck:stable - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM rockylinux:9 - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM scottyhardy/docker-wine:stable-9.0 + - trivy --exit-code 0 --severity UNKNOWN,LOW,MEDIUM us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 depends_on: - authenticate-gcr image: aquasec/trivy:0.21.0 @@ -5509,6 +5725,7 @@ steps: - trivy --exit-code 1 --severity HIGH,CRITICAL koalaman/shellcheck:stable - trivy --exit-code 1 --severity HIGH,CRITICAL rockylinux:9 - trivy --exit-code 1 --severity HIGH,CRITICAL scottyhardy/docker-wine:stable-9.0 + - trivy --exit-code 1 --severity HIGH,CRITICAL us-docker.pkg.dev/grafanalabs-global/docker-deployment-tools-prod/github-app-secret-writer:2024-11-05-v11688112090.1-83920c59 depends_on: - authenticate-gcr environment: @@ -5541,6 +5758,24 @@ volumes: - name: config temp: {} --- +get: + name: app-id + path: ci/data/repo/grafana/grafana/github-app +kind: secret +name: github-app-app-id +--- +get: + name: app-installation-id + path: ci/data/repo/grafana/grafana/github-app +kind: secret +name: github-app-installation-id +--- +get: + name: private-key + path: ci/data/repo/grafana/grafana/github-app +kind: secret +name: github-app-private-key +--- get: name: credentials.json path: infra/data/ci/grafana-release-eng/grafanauploads @@ -5571,12 +5806,6 @@ get: kind: secret name: gar --- -get: - name: pat - path: ci/data/repo/grafana/grafana/grafanabot -kind: secret -name: github_token ---- get: name: machine-user-token path: infra/data/ci/drone @@ -5740,6 +5969,6 @@ kind: secret name: gcr_credentials --- kind: signature -hmac: bb28bcd274c9d2ce724db12659ed6e3dcc461f8a07ae0eb9385a64ca5daad4de +hmac: b164dd562488c482f2e670688fca02ae20dcd2e7841ec80c95838472842b4b5e ... diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 99a3971e3e4..3e2d5aa5f7b 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -40,6 +40,7 @@ /docs/sources/alerting/ @brendamuir /docs/sources/dashboards/ @imatwawana +/docs/sources/datasources/ @lwandz13 /docs/sources/panels-visualizations/ @imatwawana /docs/sources/release-notes/ @irenerl24 @GrafanaWriter /docs/sources/upgrade-guide/ @imatwawana @@ -664,6 +665,7 @@ playwright.config.ts @grafana/plugins-platform-frontend /pkg/services/caching/ @grafana/grafana-operator-experience-squad /pkg/services/cloudmigration/ @grafana/grafana-operator-experience-squad /pkg/services/gcom/ @grafana/grafana-operator-experience-squad +/pkg/services/authapi/ @grafana/grafana-operator-experience-squad # Feature toggles /pkg/services/featuremgmt/ @grafana/grafana-backend-services-squad diff --git a/Dockerfile b/Dockerfile index 9c71569fc58..563a75e954a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,6 @@ # syntax=docker/dockerfile:1 -ARG BASE_IMAGE=alpine:3.19.1 +ARG BASE_IMAGE=alpine:3.20 ARG JS_IMAGE=node:20-alpine ARG JS_PLATFORM=linux/amd64 ARG GO_IMAGE=golang:1.23.1-alpine diff --git a/devenv/dev-dashboards/transforms/config-from-query.json b/devenv/dev-dashboards/transforms/config-from-query.json index c9dd139a501..cb65f966667 100644 --- a/devenv/dev-dashboards/transforms/config-from-query.json +++ b/devenv/dev-dashboards/transforms/config-from-query.json @@ -1,552 +1,810 @@ { - "annotations": { - "list": [ - { - "builtIn": 1, - "datasource": "-- Grafana --", - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": { + "type": "datasource", + "uid": "grafana" + }, + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "target": { + "limit": 100, + "matchAny": false, + "tags": [], "type": "dashboard" - } - ] - }, - "description": "", - "editable": true, - "graphTooltip": 0, - "links": [], - "panels": [ - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "barAlignment": 0, - "drawStyle": "line", - "fillOpacity": 0, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineInterpolation": "linear", - "lineWidth": 1, - "pointSize": 5, - "scaleDistribution": { - "type": "linear" - }, - "showPoints": "auto", - "spanNulls": false, - "thresholdsStyle": { - "mode": "line" - } - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] }, - "gridPos": { - "h": 9, - "w": 12, - "x": 0, - "y": 0 - }, - "id": 2, - "options": { - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "targets": [ - { - "hide": false, - "max": 100, - "min": 1, - "refId": "A", - "scenarioId": "random_walk", - "startValue": 50 - }, - { - "alias": "", - "csvContent": "min,max,threshold1\n1000,1000,8000\n0,100,80\n\n", - "refId": "config", - "scenarioId": "csv_content" - } - ], - "title": "Min, max, threshold from separate query", - "transformations": [ - { - "id": "configFromData", - "options": { - "configRefId": "config", - "mappings": [] - } - } - ], - "type": "timeseries" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "left", - "displayMode": "auto" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "SensorA" - }, - "properties": [ - { - "id": "custom.displayMode", - "value": "color-text" - } - ] - } - ] - }, - "gridPos": { - "h": 9, - "w": 12, - "x": 12, - "y": 0 - }, - "id": 5, - "options": { - "showHeader": true - }, - "pluginVersion": "8.1.0-pre", - "targets": [ - { - "csvContent": "Name, Value, SensorA, MyUnit, MyColor\nGoogle, 10, 50, km/h, blue\nGoogle, 100, 100,km/h, orange\n", - "hide": false, - "refId": "A", - "scenarioId": "csv_content" - } - ], - "title": "Custom mappings and apply to self", - "transformations": [ - { - "id": "configFromData", - "options": { - "applyTo": { - "id": "byName", - "options": "SensorA" - }, - "applyToConfig": true, - "configRefId": "A", - "mappings": [ - { - "configProperty": "unit", - "fieldName": "MyUnit", - "handlerKey": "unit" - }, - { - "fieldName": "MyColor", - "handlerKey": "color" - } - ] - } - } - ], - "type": "table" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "center", - "displayMode": "auto" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Value" - }, - "properties": [ - { - "id": "custom.displayMode", - "value": "color-background-solid" - } - ] - } - ] - }, - "gridPos": { - "h": 5, - "w": 12, - "x": 0, - "y": 9 - }, - "id": 7, - "options": { - "showHeader": true - }, - "pluginVersion": "8.1.0-pre", - "targets": [ - { - "csvContent": "ID, DisplayText\n21412312312, Homer\n12421412413, Simpsons \n12321312313, Bart", - "hide": false, - "refId": "A", - "scenarioId": "csv_content" - } - ], - "title": "Mapping data", - "transformations": [ - { - "id": "configFromData", - "options": { - "applyToConfig": true, - "configRefId": "A", - "mappings": [ - { - "fieldName": "Color", - "handlerKey": "mappings.color" - }, - { - "fieldName": "Value", - "handlerKey": "mappings.value" - } - ] - } - } - ], - "type": "table" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "center", - "displayMode": "auto" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Value" - }, - "properties": [ - { - "id": "custom.displayMode", - "value": "color-background-solid" - } - ] - } - ] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 12, - "y": 9 - }, - "id": 6, - "options": { - "showHeader": true - }, - "pluginVersion": "8.1.0-pre", - "targets": [ - { - "csvContent": "Value, Color\nOK, blue\nPretty bad, red\nYay it's green, green\nSomething is off, orange\nNo idea, #88AA00\nAm I purple?, purple", - "hide": false, - "refId": "A", - "scenarioId": "csv_content" - } - ], - "title": "Value mappings from query result applied to itself", - "transformations": [ - { - "id": "configFromData", - "options": { - "applyTo": { - "id": "byName", - "options": "Value" - }, - "applyToConfig": true, - "configRefId": "A", - "mappings": [ - { - "fieldName": "Color", - "handlerKey": "mappings.color" - }, - { - "fieldName": "Value", - "handlerKey": "mappings.value" - } - ] - } - } - ], - "type": "table" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "center", - "displayMode": "auto" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 5, - "w": 12, - "x": 0, - "y": 14 - }, - "id": 8, - "options": { - "showHeader": true - }, - "pluginVersion": "8.1.0-pre", - "targets": [ - { - "csvContent": "ID, Value\n21412312312, 100\n12421412413, 20\n12321312313, 10", - "hide": false, - "refId": "A", - "scenarioId": "csv_content" - } - ], - "title": "Display data", - "transformations": [ - { - "id": "configFromData", - "options": { - "applyToConfig": true, - "configRefId": "A", - "mappings": [ - { - "fieldName": "Color", - "handlerKey": "mappings.color" - }, - { - "fieldName": "Value", - "handlerKey": "mappings.value" - } - ] - } - } - ], - "type": "table" - }, - { - "fieldConfig": { - "defaults": { - "color": { - "mode": "palette-classic" - }, - "custom": { - "axisLabel": "", - "axisPlacement": "auto", - "axisSoftMin": 0, - "fillOpacity": 80, - "gradientMode": "none", - "hideFrom": { - "legend": false, - "tooltip": false, - "viz": false - }, - "lineWidth": 1 - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green" - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 10, - "w": 12, - "x": 0, - "y": 19 - }, - "id": 9, - "options": { - "barWidth": 0.97, - "groupWidth": 0.7, - "legend": { - "calcs": [], - "displayMode": "list", - "placement": "bottom" - }, - "orientation": "horizontal", - "showValue": "auto", - "text": {}, - "tooltip": { - "mode": "single", - "sort": "none" - } - }, - "pluginVersion": "8.1.0-pre", - "targets": [ - { - "csvContent": "ID, Value\nA21412312312, 100\nA12421412413, 20\nA12321312313, 10\n", - "hide": false, - "refId": "data", - "scenarioId": "csv_content" - }, - { - "csvContent": "ID, DisplayText\nA21412312312, Homer\nA12421412413, Marge \nA12321312313, Bart", - "hide": false, - "refId": "mappings", - "scenarioId": "csv_content" - } - ], - "title": "Value mapping ID -> DisplayText from separate query", - "transformations": [ - { - "id": "configFromData", - "options": { - "applyTo": { - "id": "byName", - "options": "ID" - }, - "applyToConfig": false, - "configRefId": "mappings", - "mappings": [ - { - "fieldName": "ID", - "handlerKey": "mappings.value" - }, - { - "fieldName": "DisplayText", - "handlerKey": "mappings.text" - } - ] - } - } - ], - "type": "barchart" + "type": "dashboard" } - ], - "refresh": "", - "schemaVersion": 33, - "tags": [ - "gdev", - "transform" - ], - "templating": { - "list": [] + ] + }, + "description": "", + "editable": true, + "fiscalYearStartMonth": 0, + "graphTooltip": 0, + "links": [], + "panels": [ + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "line" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 0, + "y": 0 + }, + "id": 2, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "max": 100, + "min": 1, + "refId": "A", + "scenarioId": "random_walk", + "startValue": 50 + }, + { + "alias": "", + "csvContent": "min,max,threshold1\n1000,1000,8000\n0,100,80\n\n", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "refId": "config", + "scenarioId": "csv_content" + } + ], + "title": "Min, max, threshold from separate query", + "transformations": [ + { + "id": "configFromData", + "options": { + "configRefId": "config", + "mappings": [] + } + } + ], + "type": "timeseries" }, - "time": { - "from": "now-6h", - "to": "now" + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "left", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "SensorA" + }, + "properties": [ + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] + } + ] + }, + "gridPos": { + "h": 9, + "w": 12, + "x": 12, + "y": 0 + }, + "id": 5, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.4.0-pre", + "targets": [ + { + "csvContent": "Name, Value, SensorA, MyUnit, MyColor\nGoogle, 10, 50, km/h, blue\nGoogle, 100, 100,km/h, orange\n", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "refId": "A", + "scenarioId": "csv_content" + } + ], + "title": "Custom mappings and apply to self", + "transformations": [ + { + "id": "configFromData", + "options": { + "applyTo": { + "id": "byName", + "options": "SensorA" + }, + "applyToConfig": true, + "configRefId": "A", + "mappings": [ + { + "configProperty": "unit", + "fieldName": "MyUnit", + "handlerKey": "unit" + }, + { + "fieldName": "MyColor", + "handlerKey": "color" + } + ] + } + } + ], + "type": "table" }, - "timepicker": {}, - "timezone": "", - "title": "Transforms - Config from query", - "uid": "Juj4_7ink", - "version": 1 - } + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "custom.cellOptions", + "value": { + "mode": "basic", + "type": "color-background" + } + } + ] + } + ] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 0, + "y": 9 + }, + "id": 7, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.4.0-pre", + "targets": [ + { + "csvContent": "ID, DisplayText\n21412312312, Homer\n12421412413, Simpsons \n12321312313, Bart", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "refId": "A", + "scenarioId": "csv_content" + } + ], + "title": "Mapping data", + "transformations": [ + { + "id": "configFromData", + "options": { + "applyToConfig": true, + "configRefId": "A", + "mappings": [ + { + "fieldName": "Color", + "handlerKey": "mappings.color" + }, + { + "fieldName": "Value", + "handlerKey": "mappings.value" + } + ] + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "custom.cellOptions", + "value": { + "mode": "basic", + "type": "color-background" + } + } + ] + } + ] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 9 + }, + "id": 6, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.4.0-pre", + "targets": [ + { + "csvContent": "Value, Color\nOK, blue\nPretty bad, red\nYay it's green, green\nSomething is off, orange\nNo idea, #88AA00\nAm I purple?, purple", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "refId": "A", + "scenarioId": "csv_content" + } + ], + "title": "Value mappings from query result applied to itself", + "transformations": [ + { + "id": "configFromData", + "options": { + "applyTo": { + "id": "byName", + "options": "Value" + }, + "applyToConfig": true, + "configRefId": "A", + "mappings": [ + { + "fieldName": "Color", + "handlerKey": "mappings.color" + }, + { + "fieldName": "Value", + "handlerKey": "mappings.value" + } + ] + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "custom": { + "align": "center", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 5, + "w": 12, + "x": 0, + "y": 14 + }, + "id": 8, + "options": { + "cellHeight": "sm", + "footer": { + "countRows": false, + "fields": "", + "reducer": [ + "sum" + ], + "show": false + }, + "showHeader": true + }, + "pluginVersion": "11.4.0-pre", + "targets": [ + { + "csvContent": "ID, Value\n21412312312, 100\n12421412413, 20\n12321312313, 10", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "refId": "A", + "scenarioId": "csv_content" + } + ], + "title": "Display data", + "transformations": [ + { + "id": "configFromData", + "options": { + "applyToConfig": true, + "configRefId": "A", + "mappings": [ + { + "fieldName": "Color", + "handlerKey": "mappings.color" + }, + { + "fieldName": "Value", + "handlerKey": "mappings.value" + } + ] + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "axisSoftMin": 0, + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 0, + "y": 19 + }, + "id": 9, + "options": { + "barRadius": 0, + "barWidth": 0.97, + "fullHighlight": false, + "groupWidth": 0.7, + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "orientation": "horizontal", + "showValue": "auto", + "stacking": "none", + "text": {}, + "tooltip": { + "mode": "single", + "sort": "none" + }, + "xTickLabelRotation": 0, + "xTickLabelSpacing": 0 + }, + "pluginVersion": "8.1.0-pre", + "targets": [ + { + "csvContent": "ID, Value\nA21412312312, 100\nA12421412413, 20\nA12321312313, 10\n", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "refId": "data", + "scenarioId": "csv_content" + }, + { + "csvContent": "ID, DisplayText\nA21412312312, Homer\nA12421412413, Marge \nA12321312313, Bart", + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "hide": false, + "refId": "mappings", + "scenarioId": "csv_content" + } + ], + "title": "Value mapping ID -> DisplayText from separate query", + "transformations": [ + { + "id": "configFromData", + "options": { + "applyTo": { + "id": "byName", + "options": "ID" + }, + "applyToConfig": false, + "configRefId": "mappings", + "mappings": [ + { + "fieldName": "ID", + "handlerKey": "mappings.value" + }, + { + "fieldName": "DisplayText", + "handlerKey": "mappings.text" + } + ] + } + } + ], + "type": "barchart" + }, + { + "datasource": { + "default": true, + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "barWidthFactor": 0.6, + "drawStyle": "line", + "fillOpacity": 0, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "insertNulls": false, + "lineInterpolation": "linear", + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "auto", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "dashed+area" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "blue", + "value": null + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 10, + "w": 12, + "x": 12, + "y": 19 + }, + "id": 10, + "maxDataPoints": 100, + "options": { + "legend": { + "calcs": [], + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "single", + "sort": "none" + } + }, + "targets": [ + { + "datasource": { + "type": "grafana-testdata-datasource", + "uid": "PD8C576611E62080A" + }, + "rawFrameContent": "[\n {\n \"schema\": {\n \"refId\": \"A\",\n \"meta\": {\n \"typeVersion\": [\n 0,\n 0\n ],\n \"custom\": {\n \"customStat\": 10\n }\n },\n \"fields\": [\n {\n \"name\": \"time\",\n \"type\": \"time\",\n \"typeInfo\": {\n \"frame\": \"time.Time\",\n \"nullable\": true\n },\n \"config\": {\n \"interval\": 300000\n }\n },\n {\n \"name\": \"A-series\",\n \"type\": \"number\",\n \"typeInfo\": {\n \"frame\": \"float64\",\n \"nullable\": true\n },\n \"labels\": {},\n \"config\": {}\n }\n ]\n },\n \"data\": {\n \"values\": [\n [\n 1732120345536,\n 1732120645536,\n 1732120945536,\n 1732121245536,\n 1732121545536,\n 1732121845536,\n 1732122145536,\n 1732122445536,\n 1732122745536,\n 1732123045536,\n 1732123345536,\n 1732123645536,\n 1732123945536,\n 1732124245536,\n 1732124545536,\n 1732124845536,\n 1732125145536,\n 1732125445536,\n 1732125745536,\n 1732126045536,\n 1732126345536,\n 1732126645536,\n 1732126945536,\n 1732127245536,\n 1732127545536,\n 1732127845536,\n 1732128145536,\n 1732128445536,\n 1732128745536,\n 1732129045536,\n 1732129345536,\n 1732129645536,\n 1732129945536,\n 1732130245536,\n 1732130545536,\n 1732130845536,\n 1732131145536,\n 1732131445536,\n 1732131745536,\n 1732132045536,\n 1732132345536,\n 1732132645536,\n 1732132945536,\n 1732133245536,\n 1732133545536,\n 1732133845536,\n 1732134145536,\n 1732134445536,\n 1732134745536,\n 1732135045536,\n 1732135345536,\n 1732135645536,\n 1732135945536,\n 1732136245536,\n 1732136545536,\n 1732136845536,\n 1732137145536,\n 1732137445536,\n 1732137745536,\n 1732138045536,\n 1732138345536,\n 1732138645536,\n 1732138945536,\n 1732139245536,\n 1732139545536,\n 1732139845536,\n 1732140145536,\n 1732140445536,\n 1732140745536,\n 1732141045536,\n 1732141345536,\n 1732141645536\n ],\n [\n 36.67835770082578,\n 35.674537924065,\n 8.339763723800829,\n 16.313291374141446,\n 66.05915891584247,\n 55.975417240601566,\n 33.75563648171818,\n 10.561077849025175,\n 20.31936089572975,\n 26.11219409670694,\n 57.542750561307564,\n 67.10954340535248,\n 82.95323961635275,\n 100.9691805551439,\n 59.829706792214644,\n 94.58723331927925,\n 89.3082374466047,\n 58.69065135820439,\n 97.144192150251,\n 139.99199318295675,\n 157.9473973408396,\n 177.94452058033198,\n 188.84065573954362,\n 154.3930906887033,\n 130.14406878049226,\n 116.65818233680316,\n 100.96041794526472,\n 144.65142921584447,\n 175.75178611497054,\n 203.55271609883386,\n 238.4931714915047,\n 253.38754249911452,\n 271.1735238723396,\n 258.54418620287515,\n 260.8463123020904,\n 216.10614084307323,\n 253.30389406688175,\n 249.37108721413884,\n 243.7226799137106,\n 216.74579233434042,\n 262.50043010512826,\n 238.71564300219498,\n 218.3552317737898,\n 195.6154411937393,\n 154.1987522722987,\n 124.00066408416897,\n 146.6474694384778,\n 101.68405646311294,\n 104.5791139459948,\n 85.39428966503652,\n 78.45166775446714,\n 56.285707917841535,\n 36.22861441808941,\n 35.098428846082555,\n 68.67835646605371,\n 101.67142528391042,\n 151.04038339587296,\n 114.77414457402928,\n 72.65341528313934,\n 113.42643748928826,\n 151.09282092262364,\n 163.24422498859587,\n 183.86606816236363,\n 230.24678524811478,\n 205.94887669562561,\n 211.24387656976373,\n 217.26738326873522,\n 214.66898480692646,\n 206.95531499977153,\n 194.19724584765092,\n 146.16071387746757,\n 188.30193538777615\n ]\n ]\n }\n }\n]", + "refId": "A", + "scenarioId": "raw_frame" + } + ], + "title": "Config from query / threshold does not overwrite Base threshold", + "transformations": [ + { + "id": "configFromData", + "options": { + "configRefId": "A", + "mappings": [ + { + "fieldName": "A-series", + "handlerArguments": { + "threshold": { + "color": "yellow" + } + }, + "handlerKey": "threshold1" + } + ] + } + } + ], + "type": "timeseries" + } + ], + "refresh": "", + "schemaVersion": 40, + "tags": [ + "gdev", + "transform" + ], + "templating": { + "list": [] + }, + "time": { + "from": "2024-11-20T16:31:51.747Z", + "to": "2024-11-20T22:28:15.688Z" + }, + "timepicker": {}, + "timezone": "", + "title": "Transforms - Config from query", + "uid": "Juj4_7ink", + "version": 1, + "weekStart": "" +} diff --git a/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md b/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md index 4637db17de0..7c3a5986f61 100644 --- a/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md +++ b/docs/sources/alerting/alerting-rules/create-grafana-managed-rule.md @@ -72,9 +72,13 @@ refs: data-sources: - pattern: /docs/grafana/ destination: /docs/grafana//datasources/ + - pattern: /docs/grafana-cloud/ + - destination: /docs/grafana-cloud/connect-externally-hosted/data-sources/ compatible-data-sources: - pattern: /docs/grafana/ - destination: /docs/grafana/GRAFANA_VERSION>/alerting/fundamentals/alert-rules/#supported-data-sources + destination: /docs/grafana//alerting/fundamentals/alert-rules/#supported-data-sources + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/alerting-and-irm/alerting/fundamentals/alert-rules/#supported-data-sources --- # Configure Grafana-managed alert rules @@ -100,7 +104,7 @@ To make a backup of your configuration and to be able to restore deleted alertin If you are using Grafana OSS: 1. Configure your [data sources](ref:data-sources). -1. Check which [data sources](ref:compatible-data-sources) are compatible with and supported by Grafana Alerting. +2. Check which [data sources](ref:compatible-data-sources) are compatible with and supported by Grafana Alerting. If you are using Grafana OSS, Enterprise, or Cloud: diff --git a/docs/sources/dashboards/create-reports/index.md b/docs/sources/dashboards/create-reports/index.md index 71efdd8d33f..d3a15f00404 100644 --- a/docs/sources/dashboards/create-reports/index.md +++ b/docs/sources/dashboards/create-reports/index.md @@ -155,7 +155,7 @@ You can save a report as a draft at any point during the report creation or upda ### Choose template variables -> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) version 7.5 and later behind the `reportVariables` feature flag, Grafana Enterprise version 8.0 and later without a feature flag, and [Grafana Cloud](/docs/grafana-cloud/). +> **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud/). You can configure report-specific template variables for the dashboard on the report page. The variables that you select will override the variables from the dashboard, and they are used when rendering a PDF file of the report. For detailed information about using template variables, refer to the [Templates and variables](ref:templates-and-variables) section. @@ -234,7 +234,6 @@ This feature relies on the same plugin that supports the [image rendering](ref:i ### Scheduling > **Note:** Available in [Grafana Enterprise](ref:grafana-enterprise) and [Grafana Cloud](/docs/grafana-cloud/). -> The scheduler was significantly changed in Grafana Enterprise version 8.1. Scheduled reports can be sent once, or repeated on an hourly, daily, weekly, or monthly basis, or sent at custom intervals. You can also disable scheduling by selecting **Never**, for example to send the report via the API. diff --git a/docs/sources/datasources/influxdb/_index.md b/docs/sources/datasources/influxdb/_index.md index 586cb89a682..c3f722d848f 100644 --- a/docs/sources/datasources/influxdb/_index.md +++ b/docs/sources/datasources/influxdb/_index.md @@ -4,7 +4,7 @@ aliases: - ../data-sources/influxdb/provision-influxdb/ - ../features/datasources/influxdb/ - provision-influxdb/ -description: Guide for using InfluxDB in Grafana +description: InfluxDB data source for Grafana keywords: - grafana - influxdb @@ -19,242 +19,42 @@ menuTitle: InfluxDB title: InfluxDB data source weight: 700 refs: - explore: + annotations: - pattern: /docs/grafana/ - destination: /docs/grafana//explore/ + destination: /docs/grafana//dashboards/build-dashboards/annotate-visualizations/ - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//explore/ - build-dashboards: + destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/annotate-visualizations/ + alerting: - pattern: /docs/grafana/ - destination: /docs/grafana//dashboards/build-dashboards/ + destination: /docs/grafana//alerting/ - pattern: /docs/grafana-cloud/ - destination: /docs/grafana//dashboards/build-dashboards/ - data-source-management: + destination: /docs/grafana-cloud/alerting-and-irm/alerting/ + transformations: - pattern: /docs/grafana/ - destination: /docs/grafana//administration/data-source-management/ + destination: /docs/grafana//panels-visualizations/query-transform-data/transform-data/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/transform-data/ --- # InfluxDB data source {{< docs/shared lookup="influxdb/intro.md" source="grafana" version="" >}} -Grafana includes built-in support for InfluxDB. -This topic explains options, variables, querying, and other features specific to the InfluxDB data source, which include -its [feature-rich code editor for queries and visual query builder]({{< relref "./query-editor" >}}). +Grafana includes built-in support for InfluxDB. You do not have to install a plugin to add the InfluxDB data source. -For instructions on how to add a data source to Grafana, refer to -the [administration documentation](ref:data-source-management). -Only users with the organization administrator role can add data sources. -Administrators can also [configure the data source via YAML](#provision-the-data-source) with Grafana's provisioning -system. +Grafana offers multiple configuration options for the InfluxDB data source, including a choice of three query languages and a robust query editor that includes both a code editor and a visual query builder. -Once you've added the InfluxDB data source, you can [configure it](#configure-the-data-source) so that your Grafana -instance's users can create queries in its [query editor]({{< relref "./query-editor" >}}) when -they [build dashboards](ref:build-dashboards) and use [Explore](ref:explore). +## Get started with the InfluxDB data source -## Configure the data source +The following documents will help you get started with the InfluxDB data source in Grafana: -To configure basic settings for the data source, complete the following steps: +- [Get started with Grafana and InfluxDB](/docs/grafana//getting-started/get-started-grafana-influxdb/) +- [Configure the InfluxDB data source](./configure-influxdb-data-source/) +- [InfluxDB query editor](./query-editor/) +- [InfluxDB templates and variables](./template-variables/) -1. Click **Connections** in the left-side menu. -1. Under Your connections, click **Data sources**. -1. Enter `InfluxDB` in the search bar. -1. Select **InfluxDB**. +Once you have configured the data source you can: - The **Settings** tab of the data source is displayed. - -1. Set the data source's basic configuration options carefully: - -| Name | Description | -| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **Name** | Sets the name you use to refer to the data source in panels and queries. We recommend something like `InfluxDB-InfluxQL`. | -| **Default** | Sets whether the data source is pre-selected for new panels. | -| **URL** | The HTTP protocol, IP address, and port of your InfluxDB API. InfluxDB's default API port is 8086. | -| **Min time interval** | _(Optional)_ Refer to [Min time interval](#configure-min-time-interval). | -| **Max series** | _(Optional)_ Limits the number of series and tables that Grafana processes. Lower this number to prevent abuse, and increase it if you have many small time series and not all are shown. Defaults to 1,000. | - -You can also configure settings specific to the InfluxDB data source. These options are described in the sections below. - -### Min time interval - -The **Min time interval** setting defines a lower limit for the auto group-by time interval. - -This value _must_ be formatted as a number followed by a valid time identifier: - -| Identifier | Description | -| ---------- | ----------- | -| `y` | year | -| `M` | month | -| `w` | week | -| `d` | day | -| `h` | hour | -| `m` | minute | -| `s` | second | -| `ms` | millisecond | - -We recommend setting this value to match your InfluxDB write frequency. -For example, use `1m` if InfluxDB writes data every minute. - -You can also override this setting in a dashboard panel under its data source options. - -### Select a query language - -InfluxDB data source options differ depending on which query language you select: - -- [InfluxQL](https://docs.influxdata.com/influxdb/v1.8/query_language/explore-data/), a SQL-like language for querying - InfluxDB, with statements such as SELECT, FROM, WHERE, and GROUP BY that are familiar to SQL users. - InfluxQL is available in InfluxDB 1.0 onwards. -- [SQL](https://www.influxdata.com/products/sql/) native SQL language with - support [FlightSQL](https://www.influxdata.com/glossary/apache-arrow-flight-sql/). -- [Flux](https://docs.influxdata.com/influxdb/v2.0/query-data/get-started/), which provides significantly broader - functionality than InfluxQL. It supports not only queries but also built-in functions for data shaping, string - manipulation, and joining to non-InfluxDB data sources, but also processing time-series data. - It's similar to JavaScript with a functional style. - -To help choose the best language for your needs, refer to -a [comparison of Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/) -and [why InfluxData created Flux](https://www.influxdata.com/blog/why-were-building-flux-a-new-data-scripting-and-query-language/). - -{{% admonition type="note" %}} -Though not required, we recommend that you append your query language choice to the data source's **Name** setting: - -- InfluxDB-InfluxQL -- InfluxDB-SQL -- InfluxDB-Flux - -{{% /admonition %}} - -### Configure InfluxQL - -Configure these options if you select the InfluxQL (classic InfluxDB) query language: - -| Name | Description | -| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **Allowed cookies** | Defines which cookies are forwarded to the data source. All other cookies are deleted. | -| **Database** | Sets the ID of the bucket to query. Copy this from the [Buckets page](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) of the InfluxDB UI. | -| **User** | Sets the username to sign into InfluxDB. | -| **Password** | Defines the token you use to query the bucket defined in **Database**. Copy this from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI. | -| **HTTP mode** | Sets the HTTP method used to query your data source. The POST verb allows for larger queries that would return an error using the GET verb. Defaults to GET. | - -### Configure SQL - -Configure these options if you select the SQL query language: - -| Name | Description | -| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **Database** | Sets the ID of the bucket to query. Copy this from the Buckets page of the InfluxDB UI. | -| **Token** | API token used for SQL queries. It can be generated on InfluxDB Cloud dashboard under [Load Data > API Tokens](https://docs.influxdata.com/influxdb/cloud-serverless/get-started/setup/#create-an-all-access-api-token) menu. | -| **Insecure Connection** | Disable gRPC TLS security. | - -### Configure Flux - -Configure these options if you select the Flux query language: - -| Name | Description | -| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| **Organization** | The [Influx organization](https://v2.docs.influxdata.com/v2.0/organizations/) that will be used for Flux queries. This is also used to for the `v.organization` query macro. | -| **Token** | The authentication token used for Flux queries. With Influx 2.0, use the [influx authentication token to function](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/). Token must be set as `Authorization` header with the value `Token `. For influx 1.8, the token is `username:password`. | -| **Default bucket** | _(Optional)_ The [Influx bucket](https://v2.docs.influxdata.com/v2.0/organizations/buckets/) that will be used for the `v.defaultBucket` macro in Flux queries. | - -### Provision the data source - -You can define and configure the data source in YAML files as part of Grafana's provisioning system. -For more information about provisioning, and for available configuration options, refer -to [Provisioning Grafana][provisioning-data-sources]. - -{{% admonition type="note" %}} -`database` [field is deprecated](https://github.com/grafana/grafana/pull/58647). -We suggest to use `dbName` field in `jsonData`. Please see the examples below. -No need to change existing provisioning settings. -{{% /admonition %}} - -#### Provisioning examples - -**InfluxDB 1.x example:** - -```yaml -apiVersion: 1 - -datasources: - - name: InfluxDB_v1 - type: influxdb - access: proxy - user: grafana - url: http://localhost:8086 - jsonData: - dbName: site - httpMode: GET - secureJsonData: - password: grafana -``` - -**InfluxDB 2.x for Flux example:** - -```yaml -apiVersion: 1 - -datasources: - - name: InfluxDB_v2_Flux - type: influxdb - access: proxy - url: http://localhost:8086 - jsonData: - version: Flux - organization: organization - defaultBucket: bucket - tlsSkipVerify: true - secureJsonData: - token: token -``` - -**InfluxDB 2.x for InfluxQL example:** - -```yaml -apiVersion: 1 - -datasources: - - name: InfluxDB_v2_InfluxQL - type: influxdb - access: proxy - url: http://localhost:8086 - jsonData: - dbName: site - httpHeaderName1: 'Authorization' - secureJsonData: - httpHeaderValue1: 'Token ' -``` - -**InfluxDB 3.x for SQL example:** - -```yaml -apiVersion: 1 - -datasources: - - name: InfluxDB_v3_InfluxQL - type: influxdb - access: proxy - url: http://localhost:8086 - jsonData: - version: SQL - dbName: site - httpMode: POST - insecureGrpc: false - secureJsonData: - token: '' -``` - -## Query the data source - -The InfluxDB data source's query editor has two modes, InfluxQL and Flux, depending on your choice of query language in -the [data source configuration](#configure-the-data-source): - -For details, refer to the [query editor documentation]({{< relref "./query-editor" >}}). - -## Use template variables - -Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. -Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed -in your dashboard. -Grafana refers to such variables as template variables. - -For details, see the [template variables documentation]({{< relref "./template-variables" >}}). +- Add [annotations](ref:annotations) +- Set up [alerting](ref:alerting) +- Add [transformations](ref:transformations) diff --git a/docs/sources/datasources/influxdb/configure-influxdb-data-source/_index.md b/docs/sources/datasources/influxdb/configure-influxdb-data-source/_index.md new file mode 100644 index 00000000000..f81c0069ce8 --- /dev/null +++ b/docs/sources/datasources/influxdb/configure-influxdb-data-source/_index.md @@ -0,0 +1,259 @@ +--- +aliases: + - ../data-sources/influxdb/ + - ../data-sources/influxdb/provision-influxdb/ + - ../features/datasources/influxdb/ + - provision-influxdb/ +description: Guide for using InfluxDB in Grafana +keywords: + - grafana + - influxdb + - guide + - flux +labels: + products: + - cloud + - enterprise + - oss +menuTitle: Configure the InfluxDB data source +title: Configure the InfluxDB data source +weight: 300 +refs: + provision-grafana: + - pattern: /docs/grafana/ + destination: /docs/grafana//administration/provisioning/#provision-grafana + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//administration/provisioning/#provision-grafana +--- + +# Configure the InfluxDB data source + +This document provides instructions for configuring the InfluxDB data source and explains the available configuration options. + +## Before you begin + +To configure the InfluxDB data source you must have the `Administrator` role. + +{{< admonition type="note" >}} +Select the query language you want to use with InfluxDB before adding the InfluxDB data source. Configuration options differ based on query language type. +{{< /admonition >}} + +InfluxData provides three query languages. Some key points to consider: + +- SQL is only available for InfluxDB v3.x. +- Flux is a functional data scripting language for InfluxDB 2.x. Refer to [Query InfluxDB with Flux](https://docs.influxdata.com/influxdb/cloud/query-data/get-started/query-influxdb/) for a basic guide on working with Flux. +- InfluxQL is SQL-like query language developed by InfluxData. It doesn't support more advanced functions such as JOINs. + +To help choose the best language for your needs, refer to +a [comparison of Flux vs InfluxQL](https://docs.influxdata.com/influxdb/v1.8/flux/flux-vs-influxql/) +and [Why InfluxData created Flux](https://www.influxdata.com/blog/why-were-building-flux-a-new-data-scripting-and-query-language/). + +## Add the InfluxDB data source + +Complete the following steps to set up a new InfluxDB data source: + +1. Click **Connections** in the left-side menu. +2. Click **Add new connection**. +3. Type `InfluxDB` in the search bar. +4. Select the **InfluxDB** data source. +5. Click **Add new data source** in the upper right. + +You are taken to the **Settings** tab where you will configure the data source. + +## InfluxDB common configuration options + +The following configuration options apply to **all three query language options**. + +- **Name** - Sets the name you use to refer to the data source in panels and queries. Examples: `InfluxDB-InfluxQL`, `InfluxDB_SQL`. +- **Default** - Toggle to set as the default data source. +- **Query language** - Select the query language for your InfluxDB instance. The three options are: + - **InfluxQL** - SQL-like language for querying InfluxDB, with statements such as SELECT, FROM, WHERE, and GROUP BY that are familiar to SQL users. + - **SQL** - Native SQL language starting with InfluxDB v.3.0. Refer to InfluxData's [SQL reference documentation](https://docs.influxdata.com/influxdb/cloud-serverless/reference/sql/) for a list of supported statements, operators, and functions. + - **Flux** - Flux is a data scripting language developed by InfluxData that allows you to query, analyze, and act on data. Refer to [Get started with Flux](https://docs.influxdata.com/influxdb/cloud/query-data/get-started/) for guidance on using Flux. + +**HTTP section:** + +- **URL** - The HTTP protocol, IP address, and port of your InfluxDB API. InfluxDB’s default API port is `8086`. +- **Allowed cookies** - Defines which cookies are forwarded to the data source. All other cookies are deleted by default. +- **Timeout** - Set an HTTP request timeout in seconds. + +**Auth section:** + +- **Basic auth** - The most common authentication method. Use your InfluxData user name and password to authenticate. Toggling requires you to add the user and password under **Basic auth details**. +- **With credentials** - Toggle to enable credentials such as cookies or auth headers to be sent with cross-site requests. +- **TLS client auth** - Toggle to use client authentication. When enabled, add the `Server name`, `Client cert` and `Client key` under the **TLS/SSL auth details** section. The client provides a certificate that the server validates to establish the client’s trusted identity. The client key encrypts the data between client and server. +- **With CA cert** - Authenticate with a CA certificate. Follow the instructions of your CA (Certificate Authority) to download the certificate file. +- **Skip TLS verify** - Toggle to bypass TLS certificate validation. +- **Forward OAuth identity** - Forward the OAuth access token (and also the OIDC ID token if available) of the user querying the data source. + +**Basic auth details:** + +If you enable **Basic auth** under the Auth section you need to configure the following: + +- **User** - Add the username used to sign in to InfluxDB. +- **Password** - Defines the token you use to query the bucket defined in **Database**. Retrieve this from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) in the InfluxDB UI. + +**TLS/SSL auth details:** + +TLS/SSL certificates are encrypted and stored in the Grafana database. + +- **CA cert** - If you toggle **With CA cert** add your self-signed cert here. +- **Server name** - Name of the server. Example: server1.domain.com +- **Client cert** - Add the client certificate. +- **Client key** - Add the client key. + +**Custom HTTP headers:** + +- **Header** - Add a custom HTTP header. Select an option from the drop-down. Allows custom headers to be passed based on the needs of your InfluxDB instance. +- **Value** - The value for the header. + +**Private data source connect:** + +- **Private data source connect** - _Only for Grafana Cloud users._ Private data source connect, or PDC, allows you to establish a private, secured connection between a Grafana Cloud instance, or stack, and data sources secured within a private network. Click the drop-down to locate the URL for PDC. For more information regarding Grafana PDC refer to [Private data source connect (PDC)](https://grafana.com/docs/grafana-cloud/connect-externally-hosted/private-data-source-connect/). + +Click **Manage private data source connect** to be taken to your PDC connection page, where you'll find your PDC configuration details. + +Once you have added your connection settings, click **Save & test** to test the data source connection. + +### InfluxQL-specific configuration section + +The following settings are specific to the InfluxQL query language option. + +**InfluxQL InfluxDB details section:** + +- **Database** - Sets the ID of the bucket to query. Refer to [View buckets](https://docs.influxdata.com/influxdb/v2.0/organizations/buckets/view-buckets/) in InfluxData's documentation on how to locate the list of available buckets and their corresponding IDs. +- **User** - The user name used to sign in to InfluxDB. +- **Password** - Defines the token used to query the bucket defined in **Database**. Retrieve the password from the [Tokens page](https://docs.influxdata.com/influxdb/v2.0/security/tokens/view-tokens/) of the InfluxDB UI. +- **HTTP method** - Sets the HTTP method used to query your data source. The POST method allows for larger queries that would return an error using the GET method. The default method is `POST`. +- **Min time interval** - _(Optional)_ Sets the minimum time interval for auto group-by. Grafana recommends setting this to match the data write frequency. For example, if your data is written every minute, it’s recommended to set this interval to 1 minute, so that each group contains data from each new write. The default is `10s`. Refer to [Min time interval](#min-time-interval) for format examples. +- **Max series** - _(Optional)_ Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is `1000`. + +### SQL-specific configuration section + +The following settings are specific to the SQL query language option. + +**SQL InfluxDB details section:** + +- **Database** - Specify the **bucket ID**. Refer to the **Buckets page** in the InfluxDB UI to locate the ID. +- **Token** The API token used for SQL queries. Generated on InfluxDB Cloud dashboard under [Load Data > API Tokens](https://docs.influxdata.com/influxdb/cloud-serverless/get-started/setup/#create-an-all-access-api-token) menu. +- **Insecure Connection** - Toggle to disable gRPC TLS security. +- **Max series** - _(Optional)_ Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is `1000`. + +### Flux-specific configuration section + +The following settings are specific to the Flux query language option. + +**Flux InfluxDB details section:** + +- **Organization** - The [Influx organization](https://v2.docs.influxdata.com/v2.0/organizations/) used for Flux queries. Also used for the `v.organization` query macro. +- **Token** - The authentication token used for Flux queries. With Influx 2.0, use the [influx authentication token to function](https://v2.docs.influxdata.com/v2.0/security/tokens/create-token/). Token must be set as `Authorization` header with the value `Token `. For Influx 1.8, the token is `username:password`. +- **Default bucket** - _(Optional)_ The [Influx bucket](https://v2.docs.influxdata.com/v2.0/organizations/buckets/) used for the `v.defaultBucket` macro in Flux queries. +- **Min time interval** - Sets the minimum time interval for auto group-by. Grafana recommends aligning this setting with the data write frequency. For example, if data is written every minute, set the interval to 1 minute to ensure each group includes data from every new write. The default is `10s`. +- **Max series** - Sets a limit on the maximum number of series or tables that Grafana processes. Set a lower limit to prevent system overload, or increase it if you have many small time series and need to display more of them. The default is `1000`. + +### Min time interval + +The **Min time interval** setting defines a lower limit for the auto group-by time interval. + +This value **must be** formatted as a number followed by a valid time identifier: + +| Identifier | Description | +| ---------- | ----------- | +| `y` | year | +| `M` | month | +| `w` | week | +| `d` | day | +| `h` | hour | +| `m` | minute | +| `s` | second | +| `ms` | millisecond | + +You can also override this setting in a dashboard panel under its data source options. + +## Provision the InfluxDB data source + +You can define and configure the data source in YAML files as part of Grafana's provisioning system. +For more information about provisioning, and for available configuration options, refer +to [Provision Grafana](ref:provision-grafana). + +{{% admonition type="note" %}} +The `database` [field is deprecated](https://github.com/grafana/grafana/pull/58647). +Grafana recommends using the `dbName` field in `jsonData`. There is no need to change existing provisioning settings. +{{% /admonition %}} + +### Provisioning examples + +Provisioning differs based on query language. + +**InfluxDB 1.x example:** + +```yaml +apiVersion: 1 + +datasources: + - name: InfluxDB_v1 + type: influxdb + access: proxy + user: grafana + url: http://localhost:8086 + jsonData: + dbName: site + httpMode: GET + secureJsonData: + password: grafana +``` + +**InfluxDB 2.x for Flux example:** + +```yaml +apiVersion: 1 + +datasources: + - name: InfluxDB_v2_Flux + type: influxdb + access: proxy + url: http://localhost:8086 + jsonData: + version: Flux + organization: organization + defaultBucket: bucket + tlsSkipVerify: true + secureJsonData: + token: token +``` + +**InfluxDB 2.x for InfluxQL example:** + +```yaml +apiVersion: 1 + +datasources: + - name: InfluxDB_v2_InfluxQL + type: influxdb + access: proxy + url: http://localhost:8086 + jsonData: + dbName: site + httpHeaderName1: 'Authorization' + secureJsonData: + httpHeaderValue1: 'Token ' +``` + +**InfluxDB 3.x for SQL example:** + +```yaml +apiVersion: 1 + +datasources: + - name: InfluxDB_v3_InfluxQL + type: influxdb + access: proxy + url: http://localhost:8086 + jsonData: + version: SQL + dbName: site + httpMode: POST + insecureGrpc: false + secureJsonData: + token: '' +``` diff --git a/docs/sources/datasources/influxdb/query-editor/index.md b/docs/sources/datasources/influxdb/query-editor/index.md index 76f1a50d733..14b3c1294d4 100644 --- a/docs/sources/datasources/influxdb/query-editor/index.md +++ b/docs/sources/datasources/influxdb/query-editor/index.md @@ -2,14 +2,15 @@ aliases: - ../../data-sources/influxdb/query-editor/ - influxdb-flux/ -description: Guide for Flux in Grafana +description: This topic describes the InfluxDB query editor, modes and querying the InfluxDB data source. labels: products: - cloud - enterprise - oss -title: Query Editor -weight: 200 +title: InfluxDB query Editor +menuTitle: Query editor +weight: 400 refs: explore: - pattern: /docs/grafana/ @@ -31,45 +32,80 @@ refs: destination: /docs/grafana//panels-visualizations/visualizations/logs/ - pattern: /docs/grafana-cloud/ destination: grafana-cloud/visualizations/panels-visualizations/visualizations/logs/ + query-editor: + - pattern: /docs/grafana/ + destination: /docs/grafana//panels-visualizations/query-transform-data/#query-editors + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/#query-editors + build-dashboards: + - pattern: /docs/grafana/ + destination: /docs/grafana//dashboards/build-dashboards/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/ + data-source-management: + - pattern: /docs/grafana/ + destination: /docs/grafana//administration/data-source-management/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//administration/data-source-management/ + annotations: + - pattern: /docs/grafana/ + destination: /docs/grafana//dashboards/build-dashboards/annotate-visualizations/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/annotate-visualizations/ + configure-influxdb-data-source: + - pattern: /docs/grafana/ + destination: /docs/grafana//datasources/influxdb/configure-influxdb-data-source/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana//datasources/influxdb/configure-influxdb-data-source/ --- # InfluxDB query editor -This topic explains querying specific to the InfluxDB data source. -For general documentation on querying data sources in Grafana, see [Query and transform data](ref:query-transform-data). +Grafana's query editors are unique to each data source. For general information on Grafana query editors, refer to [Query editors](ref:query-editor). For general information on querying data sources in Grafana, refer to [Query and transform data](ref:query-transform-data). + +The InfluxDB query editor is located on the [Explore page](ref:explore). You can also access the InfluxDB query editor from a dashboard panel. Click the ellipsis in the upper right of the panel and select **Edit**. + +You can also use the query editor to retrieve [log data](#query-logs) and [annotate](#apply-annotations) visualizations. ## Choose a query editing mode -The InfluxDB data source's query editor has two modes depending on your choice of query language in -the [data source configuration]({{< relref "../#configure-the-data-source" >}}): +The InfluxDB data source has three different types of query editors, each corresponding to the query language selected in the [data source configuration](https://grafana.com/docs/grafana//datasources/influxdb/configure-influxdb-data-source/#influxdb-configuration-options): - [InfluxQL](#influxql-query-editor) - [SQL](#sql-query-editor) - [Flux](#flux-query-editor) -You also use the query editor to retrieve [log data](#query-logs) and [annotate](#apply-annotations) visualizations. +Editor options vary based on query language. ## InfluxQL query editor -The InfluxQL query editor helps you select metrics and tags to create InfluxQL queries. +The InfluxQL query editor helps you select metrics and tags to create InfluxQL queries. There are two modes: `visual editor mode` and `raw query mode`. To switch between the two modes click the **pencil icon** in the upper right. -**To enter edit mode:** +Visual query editor mode contains the following components: -1. Hover over any part of the panel to display the actions menu on the top right corner. -1. Click the menu and select **Edit**. +- **FROM** - Select a measurement to query. +- **WHERE** - Select filters by clicking the **+ sign**. +- **SELECT** - Select fields and functions from the drop-down. You can add multiple fields and functions by clicking the **+ sign**. +- **GROUP BY** - Select a tag from the drop-down menu. +- **TIMEZONE** - _Optional_ Group data by a specific timezone. +- **ORDER BY TIME** - Sort data by time in either ascending or descending order. +- **LIMIT** - _Optional_ Limits the number of rows returned by the query. +- **SLIMIT** - _Optional_ Limits the number of series returned by the query. Refer to [SLIMIT clause](https://docs.influxdata.com/influxdb/cloud/query-data/influxql/explore-data/limit-and-slimit/#slimit-clause) for more information on this option. +- **FORMAT AS** - Select a format option from the drop-down menu. +- **ALIAS** - Add an alias. Refer to [Alias patterns](#alias-patterns) for more information. + +### Raw query editor mode + +You can write raw InfluxQL queries by switching to raw query mode. Click the pencil in the upper right of the query editor to switch modes. Note that when you switch to visual editor mode, you will lose any changes made in raw query mode. + +If you use raw query mode, your query must include `WHERE $timeFilter`. You should also provide a group by time and an aggregation function. Otherwise, InfluxDB may return hundreds of thousands of data points, potentially causing your browser to hang. ![InfluxQL query editor](/static/img/docs/influxdb/influxql-query-editor-8-0.png) -### Filter data (WHERE) - -To add a tag filter, click the plus icon to the right of the `WHERE` condition. - -To remove tag filters, click the tag key, then select **--remove tag filter--**. - -#### Match by regular expressions +### Match by regular expressions You can enter regular expressions for metric names or tag filter values. -Wrap the regex pattern in forward slashes (`/`). +Wrap the regex pattern in forward slashes (`/`), as shown in this example: `/measurement/`. Grafana automatically adjusts the filter tag condition to use the InfluxDB regex match condition operator (`=~`). @@ -77,56 +113,35 @@ Grafana automatically adjusts the filter tag condition to use the InfluxDB regex In the `SELECT` row, you can specify which fields and functions to use. -If you have a group by time, you must have an aggregation function. -Some functions like `derivative` also require an aggregation function. +If you **group by time** you must use an aggregation function. Certain functions such as `derivative` also require an aggregation function. -The editor helps you build this part of the query. -For example: +If you have the following: ![](/static/img/docs/influxdb/select_editor.png) -This query editor input generates an InfluxDB `SELECT` clause: +The query editor input generates an InfluxDB `SELECT` clause: ```sql SELECT derivative(mean("value"), 10s) / 10 AS "REQ/s" FROM.... ``` -**To select multiple fields:** +You can also use a \* in a SELECT statement to select all fields. -1. Click the plus button. -1. Select **Field > field** to add another `SELECT` clause. +```sql +SELECT * FROM +``` - You can also `SELECT` an asterisk (`*`) to select all fields. +### GROUP BY results -### Group query results +To group results by a tag, specify the tag in the **GROUP BY** row: -To group results by a tag, define it in a "Group By". +1. Click the **+ sign** in the GROUP BY row. +1. Select a tag from the drop-down. -**To group by a tag:** +You can GROUP BY multiple options. -1. Click the plus icon at the end of the GROUP BY row. -1. Select a tag from the dropdown that appears. - -**To remove the "Group By":** - -1. Click the tag. -1. Click the "x" icon. - -### Text editor mode (RAW) - -You can write raw InfluxQL queries by switching the editor mode. -However, be careful when writing queries manually. - -If you use raw query mode, your query _must_ include at least `WHERE $timeFilter`. - -Also, _always_ provide a group by time and an aggregation function. -Otherwise, InfluxDB can easily return hundreds of thousands of data points that can hang your browser. - -**To switch to raw query mode:** - -1. Click the hamburger icon. -1. Toggle **Switch editor mode**. +To remove a GROUP BY option click the **X icon** next to the option. ### Alias patterns @@ -138,20 +153,21 @@ Otherwise, InfluxDB can easily return hundreds of thousands of data points that | `$col` | Column name. | | `$tag_exampletag` | The value of the `exampletag` tag. The syntax is `$tag*yourTagName` and must start with `$tag*`. To use your tag as an alias in the ALIAS BY field, you must use the tag to group by in the query. | -You can also use `[[tag_hostname]]` pattern replacement syntax. +You can also use the `[[tag_hostname]]` pattern replacement syntax. -For example, entering the value `Host: [[tag_hostname]]` in the ALIAS BY field replaces it with the `hostname` tag value -for each legend value. -An example legend value would be `Host: server1`. +For example, entering the value `Host: [[tag_hostname]]` in the ALIAS BY field replaces it with the `hostname` tag value for each legend value. + +An example legend value is `Host: server1`. ## SQL query editor -Grafana support [SQL querying language](https://docs.influxdata.com/influxdb/cloud-serverless/query-data/sql/) -with [InfluxDB v3.0](https://www.influxdata.com/blog/introducing-influxdb-3-0/) and higher. +Grafana supports the [SQL query language](https://docs.influxdata.com/influxdb/cloud-serverless/query-data/sql/) in [InfluxDB v3.0](https://www.influxdata.com/blog/introducing-influxdb-3-0/) and higher. + +You construct your SQL query directly in the query editor. ### Macros -You can use macros within the query to replace them with the values from Grafana's context. +You can use macros in your query to automatically substitute them with values from Grafana's context. | Macro example | Replaced with | | --------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -179,12 +195,12 @@ Examples: ## Flux query editor Grafana supports Flux when running InfluxDB v1.8 and higher. -If your data source is [configured for Flux]({{< relref "./#configure-the-data-source" >}}), you can use -the [Flux query and scripting language](https://www.influxdata.com/products/flux/) in the query editor, which serves as +If your data source is [configured for Flux](ref:configure-influxdb-data-source), you can use +the [Flux](https://docs.influxdata.com/flux/v0/) in the query editor, which serves as a text editor for raw Flux queries with macro support. For more information and connection details, refer -to [1.8 compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility). +to [InfluxDB 1.8 API compatibility](https://github.com/influxdata/influxdb-client-go/#influxdb-18-api-compatibility). ### Use macros @@ -199,7 +215,7 @@ Macros support copying and pasting from [Chronograf](https://www.influxdata.com/ | `v.defaultBucket` | The data source configuration's "Default Bucket" setting. | | `v.organization` | The data source configuration's "Organization" setting. | -For example, the query editor interpolates this query: +For example, consider the following Flux query: ```flux from(bucket: v.defaultBucket) @@ -210,8 +226,7 @@ from(bucket: v.defaultBucket) |> yield(name: "mean") ``` -Into this query to send to InfluxDB, with interval and time period values changing according to the active time -selection: +This Flux query is interpolated into the following query and sent to InfluxDB, with the interval and time period values changing according to the active time selection: ```flux from(bucket: "grafana") @@ -222,33 +237,20 @@ from(bucket: "grafana") |> yield(name: "mean") ``` -To view the interpolated version of a query with the query inspector, refer to [Panel Inspector](ref:panel-inspector). +To view the interpolated version of a query with the Query inspector, refer to [Panel Inspector](ref:panel-inspector). ## Query logs -You can query and display log data from InfluxDB in [Explore](ref:explore) and with the [Logs panel](ref:logs) for dashboards. +You can query and display log data from InfluxDB in [Explore](ref:explore) and in the dashboard [Logs panel](ref:logs). -Select the InfluxDB data source, then enter a query to display your logs. +Select an InfluxDB data source in the Query editor. Under the **Select measurement field** next to the **FROM** section, choose a measurement containing your log data, then choose the appropriate fields that will display the log message. Add any additional filters by clicking the **+ sign** next to the **WHERE** field. Add additional conditions in the GROUP BY, ORDER BY and the rest of the options. -### Create log queries - -The Logs Explorer next to the query field, accessed by the **Measurements/Fields** button, lists measurements and -fields. -Choose the desired measurement that contains your log data, then choose which field to use to display the log message. - -Once InfluxDB returns the result, the log panel lists log rows and displays a bar chart, where the x axis represents the -time and the y axis represents the frequency/count. - -### Filter search - -To add a filter, click the plus icon to the right of the **Measurements/Fields** button, or next to a condition. - -To remove tag filters, click the first select, then choose **--remove filter--**. +After InfluxDB returns the results, the log panel displays log rows along with a bar chart. The x-axis represents time, while the y-axis shows the frequency or count. ## Apply annotations -[Annotations][annotate-visualizations] overlay rich event information on top of graphs. -You can add annotation queries in the Dashboard menu's Annotations view. +[Annotations](ref:annotations) overlay rich event information on top of graphs. +You can add annotation queries in the dashboard menu's **Annotations view**. For InfluxDB, your query **must** include `WHERE $timeFilter`. diff --git a/docs/sources/datasources/influxdb/template-variables/index.md b/docs/sources/datasources/influxdb/template-variables/index.md index 5351258ed1b..72d48bdccbf 100644 --- a/docs/sources/datasources/influxdb/template-variables/index.md +++ b/docs/sources/datasources/influxdb/template-variables/index.md @@ -17,7 +17,7 @@ labels: - oss menuTitle: Template variables title: InfluxDB template variables -weight: 300 +weight: 600 refs: add-template-variables-chained-variables: - pattern: /docs/grafana/ @@ -39,57 +39,62 @@ refs: destination: /docs/grafana//dashboards/variables/add-template-variables/#add-ad-hoc-filters - pattern: /docs/grafana-cloud/ destination: /docs/grafana//dashboards/variables/add-template-variables/#add-ad-hoc-filters - add-template-variables-adds-a-query-variable: + add-template-variables-add-a-query-variable: - pattern: /docs/grafana/ destination: /docs/grafana//dashboards/variables/add-template-variables/#add-a-query-variable - pattern: /docs/grafana-cloud/ destination: /docs/grafana//dashboards/variables/add-template-variables/#add-a-query-variable + variable-best-practices: + - pattern: /docs/grafana/ + destination: /docs/grafana//dashboards/variables/#variable-best-practices + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/dashboards/variables/#variable-best-practices --- # InfluxDB template variables -Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. -Grafana lists these variables in dropdown select boxes at the top of the dashboard to help you change the data displayed in your dashboard. -Grafana refers to such variables as template variables. +Instead of hard-coding details such as server, application, and sensor names in metric queries, you can use variables. Grafana displays these variables in drop-down select boxes at the top of the dashboard to help you change the data displayed in your dashboard. Grafana refers to such variables as template variables. -For an introduction to templating and template variables, refer to the [Templating](ref:variables) and [Add and manage variables](ref:add-template-variables) documentation. +For additional information using variables and templates, refer to the following documentation: + +- [Variables](ref:variables) +- [Templates](ref:variables) +- [Add and manage variables](ref:add-template-variables) +- [Variable best practices](ref:variable-best-practices) ## Use query variables -If you add a query template variable, you can write an InfluxDB exploration (metadata) query. -These queries can return results like measurement names, key names, or key values. +By adding a query template variable, you can write an InfluxDB metadata exploration query. These queries return results such as measurement names, key names, and key values. -For more information, refer to [Add query variable](ref:add-template-variables-adds-a-query-variable). +For more information, refer to [Add a query variable](ref:add-template-variables-add-a-query-variable). -For example, to create a variable that contains all values for tag `hostname`, specify a query like this in the query variable **Query**: +To create a variable containing all values for the `hostname` tag, use the following query format in the **Query** variable: ```sql SHOW TAG VALUES WITH KEY = "hostname" ``` -### Chain or nest variables +## Chain or nest variables You can also create nested variables, sometimes called [chained variables](ref:add-template-variables-chained-variables). -For example, if you had a variable called `region`, you could have the `hosts` variable show only hosts from the selected region with a query like: +For example, if you have a variable named `region`, you can configure the `hosts` variable to display only hosts from the selected region using the following query: ```sql SHOW TAG VALUES WITH KEY = "hostname" WHERE region = '$region' ``` -You can fetch key names for a given measurement: +You can also fetch key names for a given measurement: ```sql SHOW TAG KEYS [FROM ] ``` -If you have a variable with key names, you can use this variable in a group-by clause. -This helps you change group-by using the variable list at the top of the dashboard. +If you have a variable containing key names, you can use it in a **GROUP BY** clause. This allows you to adjust the grouping by selecting from the variable list at the top of the dashboard -### Use ad hoc filters +## Use ad hoc filters -InfluxDB supports the special **Ad hoc filters** variable type. -You can use this variable type to specify any number of key/value filters, and Grafana applies them automatically to all of your InfluxDB queries. +InfluxDB supports the **Ad hoc filters** variable type. This variable type allows you to define multiple key/value filters, which Grafana then automatically applies to all your InfluxDB queries. For more information, refer to [Add ad hoc filters](ref:add-template-variables-add-ad-hoc-filters). @@ -97,13 +102,13 @@ For more information, refer to [Add ad hoc filters](ref:add-template-variables-a The InfluxDB data source supports two variable syntaxes for use in the **Query** field: -- `$`, which is easier to read and write but does not allow you to use a variable in the middle of a word. +- `$` - This syntax is easy to read and write but does not allow you to use a variable in the middle of a word or expression. ```sql SELECT mean("value") FROM "logins" WHERE "hostname" =~ /^$host$/ AND $timeFilter GROUP BY time($__interval), "hostname" ``` -- `${varname}` +- `${varname}` - Use this syntax when you want to interpolate a variable in the middle of an expression. ```sql SELECT mean("value") FROM "logins" WHERE "hostname" =~ /^[[host]]$/ AND $timeFilter GROUP BY time($__interval), "hostname" @@ -113,4 +118,4 @@ When you enable the **Multi-value** or **Include all value** options, Grafana co ### Templated dashboard example -To view an example templated dashboard, refer to this [InfluxDB templated dashboard](https://play.grafana.org/d/f62a0410-5abb-4dd8-9dfc-caddfc3e2ffd/eccb2445-b0a2-5e83-8e0f-6d5ea53ad575). +To view an example of a templated dashboard, refer to this [InfluxDB example dashboard](https://play.grafana.org/d/f62a0410-5abb-4dd8-9dfc-caddfc3e2ffd/eccb2445-b0a2-5e83-8e0f-6d5ea53ad575). diff --git a/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md b/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md index d0ac307a1bc..726a5da5a8b 100644 --- a/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md +++ b/docs/sources/panels-visualizations/query-transform-data/transform-data/index.md @@ -286,6 +286,8 @@ In the field mapping specify: Grafana builds value mappings from your query result and applies them to the real data query results. You should see values being mapped and colored according to the config query results. +> **Note:** When you use this transformation for thresholds, the visualization continues to use the panel's base threshold. + ### Convert field type Use this transformation to modify the field type of a specified field. diff --git a/docs/sources/panels-visualizations/visualizations/node-graph/index.md b/docs/sources/panels-visualizations/visualizations/node-graph/index.md index e7e2b7c9dcc..7f488c8a40f 100644 --- a/docs/sources/panels-visualizations/visualizations/node-graph/index.md +++ b/docs/sources/panels-visualizations/visualizations/node-graph/index.md @@ -110,6 +110,38 @@ Edges can also show statistics when you hover over the edge. Similar to nodes, y The first data source supporting this visualization is X-Ray data source for its Service map feature. For more information, refer to the [X-Ray plugin documentation](https://grafana.com/grafana/plugins/grafana-x-ray-datasource). +## Node graph navigation + +You can use pan, zoom, and other functions to navigate a node graph. + +### Pan + +You can pan the view by clicking outside any node or edge and dragging your mouse. + +### Zoom + +Use the buttons in the lower right corner to zoom in or out. You can also use the mouse wheel or touchpad scroll, together with either Ctrl or Cmd key to do so. + +### Hidden nodes + +The number of nodes shown at a given time is limited to maintain a reasonable visualization performance. Nodes that are not currently visible are hidden behind clickable markers that show an approximate number of hidden nodes that are connected by a particular edge. You can click on the marker to expand the graph around that node. + +![Node graph exploration](/media/docs/grafana/panels-visualizations/node-graph-exploration-8.0-2.png 'Node graph exploration') + +### Grid view + +You can switch to the grid view to have a better overview of the most interesting nodes in the graph. Grid view shows nodes in a grid without edges and can be sorted by stats shown inside the node or by stats represented by the a colored border of the nodes. + +![Node graph grid](/media/docs/grafana/panels-visualizations/screenshot-node-graph-grid-v11.3.png 'Node graph grid') + +To sort the nodes, click on the stats inside the legend. The marker next to the stat name shows which stat is currently used for sorting and sorting direction. + +![Node graph legend](/media/docs/grafana/panels-visualizations/screenshot-node-graph-legend-v11.3.png 'Node graph legend') + +Click on the node and select "Show in Graph layout" option to switch back to graph layout and focus on the selected node, to show it in context of the full graph. + +![Node graph grid to default](/media/docs/grafana/panels-visualizations/screenshot-node-graph-view-v11.3.png 'Node graph grid to default') + ## Configuration options {{< docs/shared lookup="visualizations/config-options-intro.md" source="grafana" version="" >}} @@ -153,38 +185,6 @@ In node graphs, some data fields may have pre-configured data links. To add a di {{< docs/shared lookup="visualizations/overrides-options.md" source="grafana" version="" >}} -## Navigating the node graph - -You can use pan, zoom, and other functions to navigate a node graph. - -### Pan - -You can pan the view by clicking outside any node or edge and dragging your mouse. - -### Zoom - -Use the buttons in the lower right corner to zoom in or out. You can also use the mouse wheel or touchpad scroll, together with either Ctrl or Cmd key to do so. - -### Hidden nodes - -The number of nodes shown at a given time is limited to maintain a reasonable visualization performance. Nodes that are not currently visible are hidden behind clickable markers that show an approximate number of hidden nodes that are connected by a particular edge. You can click on the marker to expand the graph around that node. - -![Node graph exploration](/media/docs/grafana/panels-visualizations/node-graph-exploration-8.0-2.png 'Node graph exploration') - -### Grid view - -You can switch to the grid view to have a better overview of the most interesting nodes in the graph. Grid view shows nodes in a grid without edges and can be sorted by stats shown inside the node or by stats represented by the a colored border of the nodes. - -![Node graph grid](/media/docs/grafana/panels-visualizations/screenshot-node-graph-grid-v11.3.png 'Node graph grid') - -To sort the nodes, click on the stats inside the legend. The marker next to the stat name shows which stat is currently used for sorting and sorting direction. - -![Node graph legend](/media/docs/grafana/panels-visualizations/screenshot-node-graph-legend-v11.3.png 'Node graph legend') - -Click on the node and select "Show in Graph layout" option to switch back to graph layout and focus on the selected node, to show it in context of the full graph. - -![Node graph grid to default](/media/docs/grafana/panels-visualizations/screenshot-node-graph-view-v11.3.png 'Node graph grid to default') - ## Data API This visualization needs a specific shape of the data to be returned from the data source in order to correctly display it. diff --git a/docs/sources/panels-visualizations/visualizations/stat/index.md b/docs/sources/panels-visualizations/visualizations/stat/index.md index ad6da7f2889..eb989ae6d4e 100644 --- a/docs/sources/panels-visualizations/visualizations/stat/index.md +++ b/docs/sources/panels-visualizations/visualizations/stat/index.md @@ -23,6 +23,11 @@ refs: destination: /docs/grafana//panels-visualizations/query-transform-data/calculation-types/ - pattern: /docs/grafana-cloud/ destination: /docs/grafana-cloud/visualizations/panels-visualizations/query-transform-data/calculation-types/ + create-dashboard: + - pattern: /docs/grafana/ + destination: /docs/grafana//dashboards/build-dashboards/create-dashboard/ + - pattern: /docs/grafana-cloud/ + destination: /docs/grafana-cloud/visualizations/dashboards/build-dashboards/create-dashboard/ --- # Stat @@ -35,7 +40,7 @@ A stat visualization displays your data in single values of interest—such For example, if you're monitoring the utilization of various services, you can use a stat visualization to show their latest usage: -{{< figure src="/static/img/docs/v66/stat_panel_dark3.png" max-width="1025px" alt="A stat panel showing latest usage of various services" >}} +![A stat panel showing latest usage of various services](/media/docs/grafana/panels-visualizations/screenshot-stat-visualization-v11.3.png) Use a stat visualization when you need to: @@ -47,7 +52,7 @@ Use a stat visualization when you need to: ## Configure a stat visualization -Once you've [created a dashboard](https://grafana.com/docs/grafana//dashboards/build-dashboards/create-dashboard/), the following video shows you how to configure a stat visualization: +Once you've [created a dashboard](ref:create-dashboard), the following video shows you how to configure a stat visualization: {{< youtube id="yNRnLyVntUw" start="1048" >}} @@ -73,9 +78,9 @@ The following tables are examples of the type of data you need for a stat visual | 59 | | 40 | -The data is visualized as follows, with the last value displayed, along with a sparkline and [percentage change](#show-percent-change): +The data is visualized as follows, with the last value displayed, along with a sparkline and [percentage change](#value-options): -{{< figure src="/static/img/docs/stat-panel/stat_panel_single.png" max-width="1025px" alt="A stat panel showing the latest number of high priority bugs" >}} +![A stat panel showing the latest number of high priority bugs](/media/docs/grafana/panels-visualizations/screenshot-stat-single-value-v11.3.png) #### Time-series data @@ -89,7 +94,7 @@ The data is visualized as follows, with the last value displayed, along with a s The data is visualized as follows, with the mean value displayed for each room, along with the room name, sparkline, and unit of measurement: -{{< figure src="/static/img/docs/stat-panel/stat_panel_multiple.png" max-width="1025px" alt="A stat panel showing some statistics for each room in square meters" >}} +![A stat panel showing some statistics for each room in square meters](/media/docs/grafana/panels-visualizations/screenshot-stat-multiple-values-v11.3.png) By default, a stat displays one of the following: @@ -98,131 +103,87 @@ By default, a stat displays one of the following: You can use the [**Text mode**](#text-mode) to control how the text is displayed. -## Automatic layout adjustment +## Configuration options -The panel automatically adjusts the layout depending on available width and height in the dashboard. It automatically hides the graph (sparkline) if the panel becomes too small. +{{< docs/shared lookup="visualizations/config-options-intro.md" source="grafana" version="" >}} -## Panel options +### Panel options {{< docs/shared lookup="visualizations/panel-options.md" source="grafana" version="" >}} -## Value options +### Value options Use the following options to refine how your visualization displays its values: -### Show + +| Option | Description | +| ------ | ----------- | +| Show | Display a single value per column or series, or show values for each row. Choose from: