link kibana search query to a certain time - kibana

I have a search saved in Kibana called foo which searches for the keyword bar in the time range 1 week.
From this search, I made a metric visualization foobar and have it in my dashboard.
When I change the time frame of my dashboard to say, 1 year, foobar also gets updated to represent the data in the new time frame. I want to have foobar stick to representing 1 week's data. Is that possible?

I think it's not possible, because if each visualisation has its own time range, the dashboard will be meaning less.
The meaning of dashboard is, group of visualisations with the same search query and filter.

Related

Remove duplicate custom metric events from application insights before plotting in Azure portal

I'm logging some custom metrics in Application insights using the TelemetryClient.TrackMetric method in .NET, and I've noticed that occasionally some of the events are duplicated when I view them in the Azure portal.
I've drilled into the data, and the duplicate events have the same itemId and timestamp, but if I show the ingestion time by adding | extend ingestionTime = ingestion_time() to the query then I can see that the ingestion times are different.
This GitHub issue indicates that this behavior is expected, as AI uses at-least-once delivery.
I plot these metrics in charts in the Azure portal using a sum aggregation, however these duplicates are creating trust issues with the charts as the duplicates are simply treated as two separate events.
Is there a way to de-dupe the events based on itemId before plotting the data in the Azure portal?
Update
A more specific example:
I'm running an algorithm, triggered by an event, which results in a reward. The algorithm may be triggered several dozen times a day, and the reward is a positive or negative floating point value. It logs the reward each time to Application Insights as a custom metric (called say custom-reward), along with some additional properties for data splitting.
In the Azure portal I'm creating a simple chart by going to Application Insights -> Metrics and customising the chart. I select my custom-reward metric in the Metric dropdown, and select Sum as the aggregation. I may or may not apply splitting. I save the chart to my dashboard.
This simple chart gives me a nice way of monitoring the system to make sure nothing unexpected is happening, and the Sum value in the bottom left of the chart allows me to quickly see whether the sum of the rewards is positive or negative over the chart's range, and by how much.
However, on occasion I've been surprised by the result (say over the last 12 hours the sum of the rewards was surprisingly negative), and on closer inspection I discovered that a few large negative results have been duplicated. Further investigation shows this has been happening with other events, but with smaller results I tend not to notice.
I'm not that familiar with the advanced querying bit of Application Insights, I actually just used it for the first time today to dig into the events. But it does sound like there might be something I can do there to create a query that I can then plot, with the results deduped?
Update 2
I've managed to make progress with this thanks to the tips by #JohnGardner, so I'll mark that as the answer. I've deduped and plotted the results by adding the following line to the query:
| summarize timestamp=any(timestamp), value=any(value), name=any(name), customDimensions=any(customDimensions) by itemId
Update 3
Adding the following line to the query allowed me to split on custom data (in this case splitting by algorithm ID):
| extend algorithmId = tostring(customDimensions.["algorithm-id"])
With that line added, when you select "Chart" in the query results, algorithmId now shows up as an option in the split dropdown. After that you can click "Pin to dashboard". You lose the handy "sum over the time period" indicator in the bottom left of the chart which you get via the simple "Metrics" chart, however I'm sure I'll be able to recreate that in other ways.
if you are doing your own queries, you would generally be using something like summarize or makeseries to do this deduping for a chart. you wouldn't generally plot individual items unless you are looking at a very small time range?
so instead of something like
summarize count() ...
you could do
summarize dcount(itemId) ...
or you might add a "fake" summarize to a query that didn't need it before with by itemId to coalesce multiple rows into just one, using any(x) to grab any individual row's value for each column for each itemId.
but it really depends on what you are doing in your specific query. if you were using something like sum(itemCount) to also deal with sampling, you have other odd cases now, where the at-least-once delivery might have duplicated sampled items? (updating your question to add a specific query and hypothetical result would possibly lead to a more specific answer).

Google Firebase - List all item_names

It feels silly to ask a question like this but I really can't find a view by myself after clicking anywhere in the interface at least twice.
I switched my app from analytics to firebase and those events do reach the firebase backend.
I also can see the events from the last 30 minutes.
They are stored under select_content -> Parametername = item_name
But I do not find a view of way to select a wider period of time. Like show that same statistics over a longer period of time.
Do I have to set up a specific view? Or how can I get those results?
I had this exact problem and finally found a way to do it (though using the Google Analytics site instead of Firebase- but still using the select_content event).
In Google Analytics you can create a custom dimension from item_name (I did this in All events->Manage Custom Definitions->Create custom dimensions) then create a custom analysis in Analysis hub: I started from Blank, then used the Exploration Technique, selected Bar Chart for Visualization, added item_name as the Breakdown and Event Count as the Value- this gives the total event count for each item_name over the selected time period.
If you change the Visualization to Line Chart, you can also see how the values change over larger time periods (Granularities: Hour, Day, Week, Month).
Screenshot

Google Analytics Graph Values Do Not Add up to Number in Box

Chart from Google Analytics
As I worked on my sites monthly report for visits/trends, I noticed that the user number provided in text (value 4539) is different the the number you get when you add each day's plot point together along the blue line (value of 5110). I have the graph set for users, and also made sure the time frame for data was the same, but I am not sure what why these numbers differ so much.
Can someone explain this to me? Apparently I am an idiot.
Edit #1: This is the default settings under Reports > Audience > Overview. I have no dimensions added or anything more than just the strictly default settings.
User numbers are time dependent. That is to say, a user may come back more than once in a month, and GA knows that because it's detecting the cookie dropped in their browser. So, if Person A visited your site on Monday he counts as one user, and a report for Monday counts him as that. If he comes back on Tuesday and you look at a user report just for Tuesday, he is again one user. So, in individual daily reports Person A is counted as one user, in 2 reports. If you look at a report for the week, he counts as one user, because GA knows that he was person coming back to your site twice in one week.

Unique Users in Google Analytics

I'm trying to get all unique visitors for a selected time period, but I want to filter them by date on the server. However, the sum of unique visitors for each day isn't the number of unique visitors for the time period.
For example:
Monday: 2 unique visitors
Tuesday: 3 unique visitors
The unique visitors for the two days period isn't necessarily 5.
Is there a way to get the results I want using the Google Analytics API (v3)?
You're right that Users aren't additive, so you can't simply add them day by day. There are several ways around this.
The fist and most obvious is that if you've implemented the User-ID you should be able to straight up pull and interrogate the data about which users saw your site on which days.
Another way I've implemented before is to dynamically pull the number of Users from the Google Analytics API whenever you need it. Obviously this only works if you're populating a live web dashboard or similar, but since it's just the one figure you're asking for, it wouldn't slow down the load time by much. Eg. if you're using a dashboarding tool such as Klipfolio, you may be able to define a dynamic data source, and query Google whenever you needthe figure (https://support.klipfolio.com/hc/en-us/articles/216183237-BETA-Working-with-dynamic-data-sources)
You could also limit the number of ways that the data can be interrogated, and calculate all of them. For example, if you only allow users to look at data month-by-month or day-by-day, then you only need those figures.
Finally, you can estimate the figure with reasonable accuracy by splitting it into two parts. New Users are equal to New Sessions (you're only new on your first Session), which is additive, so that figure can be separated out and combined as required.
Then, you could take a rough ratio of new to returning Users (% New Users) from, say, 1 year of data, and use that with the New Users figure to generate an average on any level.

A Drupal view to show the top rated node per day, each day for a year?

I have a site with user generated stories. Stories are nodes. Stories are rated with Fivestar.
I want to create a calendar style view to list the top rated story - every day, for the current year. So at the end I will have a list of 365 stories.
I'm not sure how to approach this, any help would be great.
You could make a View that takes a Date argument, where you'll pass a specific day', and return results sorted by Fivestar rating, and limiting the View to 1 result.
Then in your custom calendar, loop over every day, and each time, calling the View and showing the result, which will be the 'top rated' note. Though this might be somewhat overkill, it's suitable for a Block which shows today's current top rated Node. I wouldn't actually use it for a whole month or even year view.
Another option could be, that every 24 hours - and a little past midnight - you use that View to get the top rated note for the previous day, and store or flag it as the top rated.
That way, only 1 Node a day will be flagged or stored, and you could build a view that lists all stored/flagged nodes, ordered by date. Rating is irrelevant here, since the View you ran in Cron already picked up the top rated one. Theme this View as a grid, and maybe with an argument Month, and you are close to a Calendar like Month view of your top rated Nodes per day.
Last option would be to build a View, which gets all nodes, and sort them by rating, and group them by day. Then make sure you only print 1 per group, namely, the top rated one.

Resources