Coder Social home page Coder Social logo

Comments (7)

andresmgot avatar andresmgot commented on September 23, 2024

When running in debug mode I see an error "address is empty" which seems to be related (I don't see that with other apps):

logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360031792+01:00 level=info msg="Starting plugin process"
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360083469+01:00 level=debug msg=Profiler enabled=false
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.36011727+01:00 level=debug msg=Tracing enabled=false propagation=
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360135526+01:00 level=debug msg="2023/11/02 17:03:36 Error: address is empty"
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360159282+01:00 level=debug msg="Serving plugin" plugins="[diagnostics resource data stream]"
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360288951+01:00 level=debug msg="plugin address" address=/tmp/plugin1476197245 network=unix
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360316465+01:00 level=debug msg="using plugin" version=2
logger=plugin.grafana-llm-app t=2023-11-02T17:03:36.360681938+01:00 level=debug msg="Plugin restarted"

But I am unable to see what's the root cause.

from grafana-plugin-sdk-go.

marefr avatar marefr commented on September 23, 2024

The error seems to originate from here and saying that there's no standalone address set:

standaloneAddress, err := getStandaloneAddress(pluginID, dir)
if err != nil {
return ClientSettings{}, err
}
if standaloneAddress == "" {
return ClientSettings{}, errors.New("address is empty")
}

from grafana-plugin-sdk-go.

asimpson avatar asimpson commented on September 23, 2024

@marefr I'm not seeing an error about an empty standalone address 🤔 I spent a little time tracing through the standlone machinery in the sdk and it seems like the pid and address are created correctly when launching a debugging session.

Also, I'm able to get a breakpoint to pause execution if I put a breakpoint in main.go but any breakpoints further in the plugin, e.g. in app.go, will not pause.

from grafana-plugin-sdk-go.

marefr avatar marefr commented on September 23, 2024

@asimpson where have you put the breakpoint in app,go? If NewApp please note that it will run whenever the first request comes in. You should see the log message "Creating new app instance" when that happens and be able to put a breakpoint there. Let us know if it still doesn't work and we'll try investigate further.

from grafana-plugin-sdk-go.

asimpson avatar asimpson commented on September 23, 2024

I put the breakpoint on that message actually but I don't see the message and the breakpoint never fires.

from grafana-plugin-sdk-go.

marefr avatar marefr commented on September 23, 2024

@asimpson I just tested this and works as expected for me. Did use the following steps:

  1. Clone the llm repo
  2. npm install
  3. mage -v
  4. mage build:debug
  5. Edit custom.ini of Grafana
[plugin.grafana-llm-app]
path = /home/marcus/go/src/github.com/grafana/grafana-llm-app

[log]
filters = plugin.grafana-llm-app:debug
  1. Start grafana and configure/enable grafana-llm-app with dummy setting and click Save & test
  2. Verify that log messages from plugin are in grafana's server log
DEBUG[11-14|15:26:26] Creating new app instance                logger=plugin.grafana-llm-app
DEBUG[11-14|15:26:26] Loading settings                         logger=plugin.grafana-llm-app
  1. Add .vscode/launch.json for plugin
{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Standalone debug mode",
      "type": "go",
      "request": "launch",
      "mode": "debug",
      "program": "${workspaceFolder}/pkg",
      "env": {},
      "args": ["-standalone"]
    }
  ]
}
  1. Set breakpoint at https://github.com/grafana/grafana-llm-app/blob/549bb92516fe7f6836841e82056d565a2e6f29c1/pkg/plugin/app.go#L40
  2. VS code start debugging using "Standalone debug mode"
  3. Navigate to http://localhost:3000/plugins/grafana-llm-app and click Save & test
  4. Breakpoint are hit

from grafana-plugin-sdk-go.

marefr avatar marefr commented on September 23, 2024

Closing this. Feel free to reach out if it still doesn't work and we can re-open

from grafana-plugin-sdk-go.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.