Releases: grafana/grafana-plugin-sdk-go
v0.167.0
What's Changed
Full Changelog: v0.166.0...v0.167.0
Compatibility
# github.com/grafana/grafana-plugin-sdk-go/backend
## compatible changes
TestStandaloneServe: added
# github.com/grafana/grafana-plugin-sdk-go/experimental/datasourcetest
## compatible changes
package added
# summary
v0.167.0 is a valid semantic version for this release.
v0.166.0
What's Changed
- Experimental: OAuth Token Retriever by @andresmgot in #702
Full Changelog: v0.165.0...v0.166.0
v0.165.0
What's Changed
Full Changelog: v0.164.0...v0.165.0
Compatibility
gorelease -base v0.164.0 -version v0.165.0
# github.com/grafana/grafana-plugin-sdk-go/backend
## incompatible changes
GracefulStandaloneServe: changed from func(ServeOpts, github.com/grafana/grafana-plugin-sdk-go/internal/standalone.Args) error to func(ServeOpts, github.com/grafana/grafana-plugin-sdk-go/internal/standalone.ServerSettings) error
StandaloneServe: removed
# summary
v0.165.0 is a valid semantic version for this release.
v0.164.0
What's Changed
- Fix subpackage links in readme by @joshhunt in #699
- framestruct: Fix wrong conversion even if the first column contains null values by @skurfuerst in #601
New Contributors
Full Changelog: v0.163.0...v0.164.0
Compatibility
gorelease -base v0.163.0 -version v0.164.0
# summary
v0.164.0 is a valid semantic version for this release.
v0.163.0
What's Changed
Full Changelog: v0.162.0...v0.163.0
Compatibility
# github.com/grafana/grafana-plugin-sdk-go/backend/tenant2.0 -version v0.163.0
## incompatible changes
package removed
# github.com/grafana/grafana-plugin-sdk-go/backend/tenant/tenanttest
## incompatible changes
package removed
# summary
v0.163.0 is a valid semantic version for this release.
v0.162.0
What's Changed
- Makes sure go build manifest file is generated with POSIX separators by @academo in #687
- Use tenant ID from incoming gRPC meta for instance caching by @wbrowne in #676
Full Changelog: v0.161.0...v0.162.0
Breaking changes
Both the Instance Manager and Instance Provider interfaces have been updated to require a context.Context as part of their APIs. This affects all plugins which perform manual instance management via the Instance Manager API. Adding context as a parameter to instance management faciliates propagation of contextual information, which is useful particularly for instance caching.
For example:
package plugin
type Plugin struct {
im instancemgmt.InstanceManager
}
func (p *Plugin) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
i, err := p.im.Get(ctx, req.PluginContext) // ctx is now required
if err != nil {
return nil, err
}
// ..
}Recommended fix
Automatic instance management
Automatic instance management for data sources was added to the SDK in version 0.97.0, which
removes the need for plugin developers to use the Instance Manager directly. Support for app plugins was added in v0.140.0.
To use auto instance management, please refer to the relevant SDK documentation:
The following demonstrates usage of automatic instance management:
package main
func main() {
err := datasource.Manage("grafana-test-datasource", plugin.New(), datasource.ManageOpts{})
if err != nil {
os.Exit(1)
}
}package plugin
func New(s backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
cfg := models.LoadCfg(s)
return &plugin{token: cfg.Token}, nil
}
type plugin struct {
token string
}
func (p *plugin) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
return backend.NewQueryDataResponse(), nil
}Alternative
We highly encourage that all plugin developers make use of automatic instance management. However, as short term solution you can instead pass context.Context from each handler to the instance manager.
For example:
func (p * Plugin) QueryData(ctx context.Context, req *backend.QueryDataRequest) (*backend.QueryDataResponse, error) {
i, err := p.im.Get(ctx, req.PluginContext) // ctx is now required
if err != nil {
return nil, err
}
// ..
}
func (p * Plugin) CallResource(ctx context.Context, req *backend.CallResourceRequest, sender backend.CallResourceResponseSender) error {
i, err := p.im.Get(ctx, req.PluginContext) // ctx is now required
if err != nil {
return nil, err
}
// ..
}Compatibility
gorelease -base v0.161.0 -version v0.162.0
# github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt
## incompatible changes
InstanceManager.Do: changed from func(github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext, InstanceCallbackFunc) error to func(context.Context, github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext, InstanceCallbackFunc) error
InstanceManager.Get: changed from func(github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext) (Instance, error) to func(context.Context, github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext) (Instance, error)
InstanceProvider.GetKey: changed from func(github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext) (interface{}, error) to func(context.Context, github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext) (interface{}, error)
InstanceProvider.NeedsUpdate: changed from func(github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext, CachedInstance) bool to func(context.Context, github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext, CachedInstance) bool
InstanceProvider.NewInstance: changed from func(github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext) (Instance, error) to func(context.Context, github.com/grafana/grafana-plugin-sdk-go/backend.PluginContext) (Instance, error)
# github.com/grafana/grafana-plugin-sdk-go/backend/tenant
## compatible changes
package added
# github.com/grafana/grafana-plugin-sdk-go/backend/tenant/tenanttest
## compatible changes
package added
v0.161.0
What's Changed
- Chore: Move dataplane contract docs to grafana/dataplane by @kylebrandt in #677
- better comment for field.config.DisplayNameFromDS by @gabor in #678
- httpclient: Don't forward HTTP headers by default by @marefr in #679
Full Changelog: v0.160.0...v0.161.0
Breaking change
v0.150.0 introduced Forward HTTP headers by default. This release removes the automatic forwarding of HTTP headers since it caused problems for several plugins. This is a possible breaking change given that this was introduced rather recently.
In case your plugin is dependent on the automatic forwarding of HTTP headers you would need to set the httpclient.Options.ForwardHTTPHeaders to true, like as can be seen in the example below:
func NewDatasource(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
opts, err := settings.HTTPClientOptions()
if err != nil {
return nil, fmt.Errorf("http client options: %w", err)
}
opts.ForwardHTTPHeaders = true
cl, err := httpclient.New(opts)
...
}Expect the datasource-http-backend example and Add authentication for data source plugins
documentation to be updated soon.
Compatibility
gorelease -base v0.160.0 -version v0.161.0
# github.com/grafana/grafana-plugin-sdk-go/backend/httpclient
## compatible changes
Options.ForwardHTTPHeaders: added
# summary
v0.161.0 is a valid semantic version for this release.
v0.160.0
What's Changed
- test: use
t.Setenvandt.TempDirby @Juneezee in #668 - Logs contract: simpler time-field by @gabor in #658
- Data: (Docs) Update code example to be dataplane compliant by @kylebrandt in #670
- Bump dependencies by @xnyo in #672
New Contributors
Full Changelog: v0.159.0...v0.160.0
Compatibility
gorelease -base v0.159.0 -version v0.160.0
# summary
v0.160.0 is a valid semantic version for this release.
v0.159.0
What's Changed
- Add secure socks proxy to sdk by @stephaniehingtgen in #667
New Contributors
- @stephaniehingtgen made their first contribution in #667
Full Changelog: v0.158.0...v0.159.0
Compatibility
gorelease -base v0.158.0 -version v0.159.0
github.com/grafana/grafana-plugin-sdk-go/backend/gtime
------------------------------------------------------
# github.com/grafana/grafana-plugin-sdk-go/backend
## compatible changes
HTTPSettings.SecureSocksProxyEnabled: added
HTTPSettings.SecureSocksProxyPass: added
HTTPSettings.SecureSocksProxyUsername: added
# github.com/grafana/grafana-plugin-sdk-go/backend/httpclient
## compatible changes
Options.ProxyOptions: added
# github.com/grafana/grafana-plugin-sdk-go/backend/proxy
## compatible changes
package added
# summary
v0.159.0 is a valid semantic version for this release.
v0.158.0
What's Changed
- Logs contract: ignore remaining fields by @gabor in #659
- Logs contract: more robust field finding, explicit approach by @gabor in #660
- Tracing: Support multiple OTel propagators by @xnyo in #663
- Tracing: Add more details to HTTP Outgoing Request by @xnyo in #664
- Data: Encode Nanosecond into JSON by @kylebrandt in #647
- Data: cmp tests using FrameTestCompareOptions() will no longer ignore time differences beyond millisecond resolution
New Contributors
Full Changelog: v0.157.0...v0.158.0
Compatibility
gorelease -base v0.157.0 -version v0.158.0
# summary
v0.158.0 is a valid semantic version for this release.