0

I am trying to reproduce the steps given in grafana log data source plugin so that I can replace the current-query function with a hardcoded log-panel compatible query function in oci-datasource-plugin Github link| oci-datasource-file

From the documentation of log-panel build guide

      const frame = new MutableDataFrame({
        refId: query.refId,
        fields: [
          { name: 'time', type: FieldType.time },
          { name: 'content', type: FieldType.string, labels: { filename: 'file.txt' } }
        ],
      });
    
      frame.add({ time: 1589189388597, content: 'user registered' })
      frame.add({ time: 1589189406480, content: 'user logged in' })
  1. The documentation suggests to return a Frame.
  2. The steps given shows a Mutable data frame.
  3. But the panel expects a response.

If a frame is returned instead of a response data, the following error appears Error for returning a frame or frame.json()

Based on the working code found in Github link| oci-datasource-file

for a different panel type , I modified my code to return a response with data inside it.

My response look this and replacing the data with

   result.data = frame.toJSON()
   return result

Also, if you can paste a working sample data that I can look at , it will be really helpful. To be more precise, I am looking for the sample json data for log panel

Athul Muralidharan
  • 693
  • 1
  • 10
  • 18
  • I encountered a similar problem recently, but it looks like we actually had somewhat different problems. Curious if you ran into other issues or have ideas that might help. https://stackoverflow.com/questions/66575053/grafana-logs-plugin-doesnt-show-logs-panel – Gordon Seidoh Worley Mar 11 '21 at 15:58

1 Answers1

0

After looking into one of the test files in Grafana | LogDetails.test.tsx

Looks, like it must be returned must be returned as

result.data = [frame]
return result
Athul Muralidharan
  • 693
  • 1
  • 10
  • 18