2

I am trying to figure out to create a variable that contains the value of another variable. One variable will contain the “root” name of an API and the actual API application name. Here’s what I mean.

Fully Qualified API Name: MyAPICollection.MyApi

The Problem: There are cases where I need to use only the application name (“MyApi”) and other cases where I need to use the fully qualified name(“MyApiCollection”).

What I’ve tried:

I created on a constant variable called: AppName with all the possible apps I’d like the user to select (e.g. “MyApp1”, MyApp2", “MyApp3”).

I created another constant variable called “CollectionName” with a value of “MyApiCollection”. This variable won’t be displayed.

I created another constant variable called FullyQualifiedName. This will not be displayed but will be used to pass on to my Lucene query. So, I used the value of: $CollectionName.$AppName

Result: I am simply getting a literal value of: $CollectionName.$AppName

What I’ve tried to make it work: First off, is this even possible to do in Grafana (please say yes!)?

  1. I’ve tried: $CollectionName.$AppName
  2. I’ve tried: {$CollectionName.$AppName}
  3. I’ve tried: {{$CollectionName.$AppName}}
  4. I’ve tried: {$CollectionName}.{$AppName}
  5. and finally: {{$CollectionName}.{$AppName}}

Why am I doing this? I have one dashboard that is presently supporting 4 APIs and is part of a collection. However, there are some cases when I only need a subset of the fully qualified name.

Example: MyCollection.MyApi1 will be passed to ElasticSearch because of the fields.Application field in the log record is tagged with “MyCollection.MyApi1”.

In other cases, I need only the application name part of the fully qualified name with different casing requirements (e.g. to reference CloudWatch logs).

Example: To query CloudWatch logs I will use the application name to specify which CloudWatch logs group that Grafana should use as its data source. The naming format for the CloudWatch log groups will be the same from one API to the next. The only thing that will change is the application name (e.g.“myapi1”). The other requirement is that the application name be in lower-case.

I can’t think that what I’m doing is all that unusual. I want to be able to have one dashboard that supports all the APIs that are in the collection and variables will hopefully get me to that goal.

Any ideas?

KSS
  • 821
  • 3
  • 10
  • 26

0 Answers0