bosun icon indicating copy to clipboard operation
bosun copied to clipboard

Is there a way to parse group keys (tags) in Bosun to get a particular tag value?

Open nerandell opened this issue 5 years ago • 6 comments

I have a bosun server setup which queries OpenTSDB. We have some alerts setup which are grouped using certain tags.

Sample Query:

$query= sum:metrics.get{key1=*,key2=*}{outcome=ERROR}

Sample tags obtained are:

"Tags": "key1=value1,key2=value2"

This value is currently a string. I want to extract the value of a particular key from the Tags string. This would be something like treating this string as a map. Is there a way to do this in Bosun expression language?

nerandell avatar May 24 '19 15:05 nerandell

What is the thing you are trying to achieve by extracting the value of the tag ?

johnewing1 avatar Feb 14 '20 10:02 johnewing1

Mark

AsapDiablo avatar Aug 05 '20 14:08 AsapDiablo

I have a bosun server setup which queries OpenTSDB. We have some alerts setup which are grouped using certain tags.

Sample Query:

$query= sum:metrics.get{key1=*,key2=*}{outcome=ERROR}

Sample tags obtained are:

"Tags": "key1=value1,key2=value2"

This value is currently a string. I want to extract the value of a particular key from the Tags string. This would be something like treating this string as a map. Is there a way to do this in Bosun expression language?

Have you figured out a way ?

AsapDiablo avatar Aug 05 '20 14:08 AsapDiablo

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jul 31 '21 15:07 stale[bot]

I have a similar problem, I want to get the top 10 results after sort for the avg response time of the partner. I used the filter function to implement it, I want to leave it here just in case someone have the same problem.

filter(variantSet, numberSet) (seriesSet|numberSet) Returns all results in variantSet that are a subset of numberSet and have a non-zero value. Useful with the limit and sort functions to return the top X results of a query.

filter(q("avg:$sample-avg-zero:avg_overall_ms{partner=h_}", "$start", ""),limit(sort(avg(q("avg:$sample-avg-zero:avg_overall_ms{partner=h_}", "$start", "")),"desc"),10))

lm272001573 avatar Aug 13 '21 07:08 lm272001573

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Aug 10 '22 04:08 stale[bot]