Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Alias fix by replace #61

Closed
wants to merge 38 commits into from
Closed

Conversation

Ewocker
Copy link

@Ewocker Ewocker commented Nov 9, 2017

I did not branch of from aliasFix branch but instead branch of from master.
The fix includes 2 commits:

  1. In datasource.js func handleKairosDBQueryResponse():
    Execute templateSrv.replace() until no '$' in target (here refers to alias string) is found
  2. In same location:
    Instead of using while loop, use for loop with limited count (10 times) to prevent unpredictable loop caused by templateSrc.replace.

Eric Hatch and others added 30 commits May 25, 2016 14:22
…trl.js to make downsampling none when creating a new dashboard
…and dateMath.parse was no longer working. Fix is in the datasource.js file.
…-zmon/kairosdb-datasource into zalando-zmon-remove-downsampling-option
…loop

If templateSrv does not find the variable to replace, it 'might' return $ which causes infinite
loop. Use replaceCount to limit to at most 10 replacement.
all urls are stores in jsonData.urls which can be found in instanceSettings in the datasource.js.
Use urls only when multi mode is turn on.
… with grafana type

look into example of graphite
https://github.com/grafana/grafana/blob/master/public/app/plugins/datasource/graphite/config_ctrl.ts
, and find that datasourceSrv can use loadDatasource which returns backendSrv (might have a better
way to just import but currently do not know how to), and use $http from backendSrv to get all
datasources list, and filter to only store kairosdatasource in jsonData.allKarirosDatasource.
…atasource instead of backendSrv

Realized that datasourceSrv has more general functionality then backendSrv which is during
construction
…rrors

Check Inspect Nectwork to see ossibly unhandled rejection:
{"err":{"data":null,"status":-1,"config":{"method":"POST","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"api/datasources/proxy/19/api/v1/datapoints/query/tags","requestId":"1.kairosdb.http.ingest_time.host.metricKeyValueLookup","data":{"metrics":[{"name":"kairosdb.http.ingest_time"}],"cache_time":0,"start_absolute":0},"retry":0,"timeout":{},"headers":{"X-Grafana-Org-Id":1,"Accept":"application/json,
text/plain,
*/*","Content-Type":"application/json;charset=utf-8"}},"statusText":""},"cancelled":true}
datasourceRequest are using a specific requestId to track either to cancel request or not. Use
unique datasource ID to make each request unique.
@Ewocker Ewocker force-pushed the aliasFixByReplace branch 2 times, most recently from 9133d7a to 11f0046 Compare February 27, 2018 23:05
@jifwin
Copy link
Contributor

jifwin commented Mar 20, 2018

This has been completely refactored in v3.0.0.

@jifwin jifwin closed this Mar 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants