Is there a way to perform a math expression on 2 CloudWatch Logs Insight queries in Grafana?
When I try to do so, I get an error:
The error is:
level=error msg="Query data error" error="expression request error: failed to query data: query must have either statistic or statistics field"
How can I cast the result of A and B to statistics fields
I would like to retrieve the value of Query A, and the value of Query B, in order to have the percentage of errors during the last hour.
Related
I am trying to query some data from our collection which has about 45000 documents.
I have indexed status as 1.
status field takes three different values, ra, rc and res.
When I try to query for these different values I get different execution time when I try for "ra"
I am getting 36081 documents while querying for "rc" in 0.125 seconds. while querying for rc such as:
db.getCollection('contract').find({"status" :"rc"})
But when I run this query for the value of "ra", I get 486 documents in 1.80seconds.
This is weird for me.
What could be causing this difference?
I have written the following Flux query in Grafana, I get two results for value. I would like to filter those two by distinct values by scenario key.
I would expect to have "main_flow" and "persons_end_user" results at the end. How can I achive this, I have tried with distinct() and unique(), but does not seem to work.
I have multiple environments whith MongoDB on them that stores the same types of data (same types of collections, different documents according to the environment)
I run in MongoDB the following query:
db.incident.count({ $and: [{"tags.display_name": "Policy Violation"},{start_time: {$gte: ISODate("2020-07-11T09:30:04.887Z")}}]})
and I get a number as expected (for example: 279)
But on some of my environment, when I run this query:
db.incident.count({"start_time": {$gte: ISODate("2020-07-11T09:30:04.887Z")}})
I get a lower number (for example from the same environment from the example above : 274) which is an impossible result (as you can see the first query is a subquery of the second)
I read some documents and found:
Avoid using the db.collection.count() method without a query predicate since without the query predicate, the method returns results based on the collection’s metadata, which may result in an approximate count. In particular, on a sharded cluster, the resulting count will not correctly filter out orphaned documents.
After an unclean shutdown, the count may be incorrect
but I couldn't find anywhere the definition (or any example, etc') for 'query predicate'
Can someone please help? how can I get an exact result?
I am trying to convert a huge set of dates to ISODate objects and storing it in the same collection and field. I am using the following query:
db.collection.find().forEach(function(element){
element.StartTime = ISODate(element.StartTime);
element.StopTime = ISODate(element.StopTime);
db.collection.save(element);
});
The query ran for about 10 minutes, and then gave an error:
2017-06-15T15:48:10.419+0200 E QUERY [thread1] Error: invalid ISO date :
ISODate#src/mongo/shell/types.js:65:1
#(shell):2:23
DBQuery.prototype.forEach#src/mongo/shell/query.js:501:1
#(shell):1:1
I had a look into the entries in the DB and it looks like it did convert a lot of the data set, but I am having troubles now fixing the error and finding the location where it stopped. What I tried is using Studio3T to find where either "StartTime" or "StopTime" has a value of 2017-06-15T15:48:10.419+0200 or at least starts with 2017-06, but as I expected (since there shouldn't be any data from June 2017 in there), it can't find anything.
Now when I run the query again, it gives the error immediately.
My question is if it's possible to find the document in the collection responsible for this error or what the cause might be. Are there recommendations for bulk operations like this preventing these errors?
I m trying to retrieve the page_fans using the following FQL query (Insights Table).
SELECT metric, value FROM insights WHERE object_id=182929845081087 AND metric='page_fans' AND end_time=1334905200 AND period=86400
But I just get blank data , when I make the above query.
{
"data": [
]
}
I m able to retrieve the other metrics by just changing the metric value in the above query.
For Eg. I get the page_engaged_users by just changing the metric value in the above query.
SELECT metric, value FROM insights WHERE object_id=182929845081087 AND metric='page_engaged_users' AND end_time=1334905200 AND period=86400
{
"data": [
{
"metric": "page_engaged_users",
"value": 35
}
]
}
What is wrong with the first query in which I m trying to retrieve the page_fans ??
And I know that I can retrieve page_fans using other ways as well !!
If you look at the insights documentation, notice in the last column that the page_fans metric is only available for the lifetime period. Change your query to period=0 or `period=period('lifetime') and you'll get data.
If you want the new fans added on a given day, use the page_fan_adds metric with period('day').
If you request any other period, you will either get an error or no data (which means someone other than you can request that metric for a different period).
The other problem could be that you are requesting data that is too recent. In your query, you're looking at 2012-04-20, so you should be fine. When I tested this, I got no data if I used a date greater than 2012-09-15 (on 2012-09-18).