grafana / mimir

Grafana Mimir provides horizontally scalable, highly available, multi-tenant, long-term storage for Prometheus.
https://grafana.com/oss/mimir/
GNU Affero General Public License v3.0
4.04k stars 512 forks source link

Improve "no org id" error #2030

Open pracucci opened 2 years ago

pracucci commented 2 years ago

When Mimir receives a request without the X-Scope-OrgID, it returns the "no org id" error, coming from weaveworks/common: https://github.com/grafana/mimir/blob/4a5df428f680588101bd1946c8b6e780cf86e75f/vendor/github.com/weaveworks/common/user/id.go#L19

However, a Mimir user has no idea what the "org id" is. In the documentation we call it "tenant ID" and also the error is not giving any suggestion on how to fix it. We should improve the "no org id" error message and also add it to Mimir errors catalog.

JoeHCQ1 commented 1 year ago

Hey, I just got this from Loki too. And I'm one of those users who has no idea what the org ID. I'm just trying to get connectivity between Loki and Grafana, using in-cluster DNS.

Getting error:

grafana logger=context userId=1 orgId=1 uname=safe-monkfish t=2022-11-15T19:40:19.141410144Z level=error msg="Failed to call resource" error="no org id\n" traceID=

image

Logiraptor commented 1 year ago

@JoeHCQ1 Do you mind reopening your issue on the https://github.com/grafana/loki repo? It's likely that you're just missing an X-Scope-OrgID header, but in case anything further is needed it would be better to ask for help there.

adapasuresh commented 1 year ago

Hi,

sureshadapa@localhost GrafanaLoki % kubectl create ns grafana-loki-logging namespace/grafana-loki-logging created sureshadapa@localhost GrafanaLoki % helm install --values values.yaml loki grafana/loki -n grafana-loki-logging NAME: loki LAST DEPLOYED: Sun Jan 8 05:27:14 2023 NAMESPACE: grafana-loki-logging STATUS: deployed REVISION: 1 NOTES:


Welcome to Grafana Loki Chart version: 3.8.1 Loki version: 2.7.0


Installed components:

==== sureshadapa@localhost GrafanaLoki % helm install grafana grafana/grafana -n grafana-loki-logging W0108 05:40:00.456673 28527 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0108 05:40:01.190210 28527 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0108 05:40:01.205262 28527 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ W0108 05:40:01.232582 28527 warnings.go:70] policy/v1beta1 PodSecurityPolicy is deprecated in v1.21+, unavailable in v1.25+ NAME: grafana LAST DEPLOYED: Sun Jan 8 05:39:59 2023 NAMESPACE: grafana-loki-logging STATUS: deployed REVISION: 1 NOTES:

  1. Get your 'admin' user password by running:

    kubectl get secret --namespace grafana-loki-logging grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo

  2. The Grafana server can be accessed via port 80 on the following DNS name from within your cluster:

    grafana.grafana-loki-logging.svc.cluster.local

    Get the Grafana URL to visit by running these commands in the same shell: export POD_NAME=$(kubectl get pods --namespace grafana-loki-logging -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=grafana" -o jsonpath="{.items[0].metadata.name}") kubectl --namespace grafana-loki-logging port-forward $POD_NAME 3000

  3. Login with the password from step 1 and the username: admin #################################################################################

    WARNING: Persistence is disabled!!! You will lose your data when
    the Grafana pod is terminated.

    #################################################################################

sureshadapa@localhost GrafanaLoki % kubectl apply -f grafana-secret.yaml -n grafana-loki-logging
Warning: resource secrets/grafana is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically. secret/grafana configured

sureshadapa@localhost GrafanaLoki % kubectl apply -f grafana-service.yaml -n grafana-loki-logging Warning: resource services/grafana is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically. service/grafana configured

sureshadapa@localhost GrafanaLoki % kubectl apply -f grafana-configmap.yaml -n grafana-loki-logging Warning: resource configmaps/grafana is missing the kubectl.kubernetes.io/last-applied-configuration annotation which is required by kubectl apply. kubectl apply should only be used on resources created declaratively by either kubectl create --save-config or kubectl apply. The missing annotation will be patched automatically. configmap/grafana configured

sureshadapa@localhost GrafanaLoki % kubectl apply -f grafana-ingress.yaml -n grafana-loki-logging ingress.networking.k8s.io/grafana created

— Error— logger=plugin.loader t=2023-01-08T00:36:10.24867019Z level=info msg="Plugin registered" pluginID=input │ │ logger=secrets t=2023-01-08T00:36:10.249171091Z level=info msg="Envelope encryption state" enabled=true currentprovider=secretKey.v1 │ │ logger=query_data t=2023-01-08T00:36:10.252089413Z level=info msg="Query Service initialization" │ │ logger=live.push_http t=2023-01-08T00:36:10.258337418Z level=info msg="Live Push Gateway initialization" │ │ logger=infra.usagestats.collector t=2023-01-08T00:36:10.572675651Z level=info msg="registering usage stat providers" usageStatsProvidersLen=2 │ │ logger=provisioning.alerting t=2023-01-08T00:36:10.573002104Z level=info msg="starting to provision alerting" │ │ logger=provisioning.alerting t=2023-01-08T00:36:10.573027524Z level=info msg="finished to provision alerting" │ │ logger=ngalert.state.manager t=2023-01-08T00:36:10.573135067Z level=info msg="Warming state cache for startup" │ │ logger=ngalert.state.manager t=2023-01-08T00:36:10.573282955Z level=info msg="State cache has been initialized" states=0 duration=147.126µs │ │ logger=ticker t=2023-01-08T00:36:10.573326252Z level=info msg=starting first_tick=2023-01-08T00:36:20Z │ │ logger=http.server t=2023-01-08T00:36:10.576188883Z level=info msg="HTTP Server Listen" address=:3000 protocol=http subUrl=/grafana socket= │ │ logger=ngalert.multiorg.alertmanager t=2023-01-08T00:36:10.576449006Z level=info msg="starting MultiOrg Alertmanager" │ │ logger=grafanaStorageLogger t=2023-01-08T00:36:10.577005191Z level=info msg="storage starting" │ │ logger=serviceaccounts.background t=2023-01-08T00:36:10.594082562Z level=warn msg="secret scan interval is too low, increasing to 5m0s" │ │ logger=context t=2023-01-08T00:36:45.4254377Z level=warn msg="failed to look up session from cookie" error="user token not found" │ │ logger=context userId=0 orgId=0 uname= t=2023-01-08T00:36:45.425740068Z level=info msg="Request Completed" method=GET path= status=302 remote_a │ │ logger=http.server t=2023-01-08T00:36:48.667187156Z level=info msg="Successful Login" User=admin@localhost │ │ logger=context userId=0 orgId=0 uname= t=2023-01-08T00:36:48.667280598Z level=info msg="Ignored invalid redirect_to cookie value." url=/grafana │ │ logger=context userId=1 orgId=1 uname=admin t=2023-01-08T00:36:49.026739164Z level=info msg="Request Completed" method=GET path=/api/live/ws st │ │ logger=context userId=1 orgId=1 uname=admin t=2023-01-08T00:37:36.750585104Z level=error msg="Failed to call resource" error="no org id\n" trac │ │ logger=context userId=1 orgId=1 uname=admin t=2023-01-08T00:37:36.750660858Z level=error msg="Request Completed" method=GET path=/api/datasourc │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

adapasuresh commented 1 year ago

In grafana UI, at Test datasource it gives me: Unable to fetch labels from Loki (Failed to call resource), please check the server logs for more details

And in the grafana pod the log msg give above: It says Org Id null, but in the logger context I notice orgId=1

Screenshot 2023-01-08 at 6 17 43 AM Screenshot 2023-01-08 at 6 18 49 AM
pracucci commented 1 year ago

Hi @adapasuresh I think you actually want to open an issue in Loki. If so, do you mind moving your comments to https://github.com/grafana/loki, please? 🙇

hongbo-miao commented 1 year ago

I got "no org id" error in Loki, and searched online. Initially found this ticket. Later found the solution at

The helm chart enables authentication by default, however that needs additional setup, see https://grafana.com/docs/loki/latest/operations/authentication/

In my case, I am testing in a local Kubernetes, and set this in Loki helm chart values.yaml helps me:

loki:
    auth_enabled: false

Then Grafana can add Loki successfully.

That thread has more info. Maybe it will help people here too 😃

omidraha commented 11 months ago

Same issue with loki helm chart with version 5.15.0 image

charleskorn commented 11 months ago

Hi @omidraha, looks like you're having an issue with Loki, not Mimir. You'll likely get more help if you start a discussion in the Loki repo: https://github.com/grafana/loki