I have created some log based metrics in GCP and confirmed using the Preview Logs that they are valid (getting green bubbles with numbers in them).
However, when trying to view these in the metrics explorer, they are inactive (I need to toggle "Show only active resources and metrics" for the log based metric to show up) -- and then after toggling it on, sure enough, there is no time series to display.
What could be the problem?
Not sure if you got this sorted, but it's a top result when I was working through this.
In my case I was using string values in a distribution type log based metric. So it looks fine in the Preview Logs, and the labels all look fine, but when you send data through you get nothing in metrics explorer.
Creating a new counter type metric worked fine.
Related
I have a video id that I am grabbing metrics for, but I can't seem to get the metrics in the image below. Link clicks does not seem to be a metric I can find, though it shows up in my creator studio associated with the video post. This is my current call being used. If I remove most of the insights to just get all I don't even see a metric aligned with the clicks number I am looking for.
https://www.facebook.com/video.php?v={USING THIS VIDEO ID}
{videoID}/video_insights?metric=total_video_impressions_organic_unique,total_video_impressions_paid_unique,total_video_impressions_unique,total_video_stories_by_action_type,total_video_views,total_video_impressions
Image: click metrics
My goal is to base my metrics directly from log values. The problem is when I display them as graph it looks like they are distributed. How can I change it so that it displays the values from the logs?
Unfortunately Stackdriver doesn't work in that way, you shouldn't expect that Stackdriver shows you "52" in this case. Have a look at the official documentation where "logs-based metrics can be one of two metric types: counter or distribution" and "counter metrics count the number of log entries matching" and "distribution metrics is to track latencies". You have to choose another tool for this task.
Assuming you created this as a distribution metric, I would expect this to work. Please take a look at this blog post to make sure you're using aligners and aggregators correctly.
It is clear from the documentation that I can add custom metrics for a custom event.
How do I view these metrics in the Pinpoint console? From the Pinpoint console, it is obvious how to view attributes. I can go to Analytics > Events, select my custom event, and narrow down the events to whatever attributes I desire. I am asking about how to view metrics. To be clear, these differ by being continuous values whereas attributes are discrete. The documentation says that I can do this. See below how I can filter by attributes manually: (attribute is circled)
See the docs on custom events here: https://docs.aws.amazon.com/pinpoint/latest/developerguide/integrate-events.html
Similarly, creating a funnel only allows filtering for attributes. How can I filter for metrics?
Thank you for your time!
When I first asked this question, AWS had the ability to record metrics with the Swift SDK, but not view them in the Pinpoint API, which is absurd, because then you can only record metrics. What's the point? I asked in the AWS forums, and a couple months later, they responded something along the lines of "Please wait - coming soon."
This feature is now available, whereas before it simply wasn't.
Go to Pinpoint, your project, then click the Analytics drop-down menu, then click events. You can see that you can sort by metric. If you look at my outdated screenshot above, you'll see that this was not an option.
Is it possible to count number of occurrences of a specific log message over a specific period of time from GCP Stackdriver logging? To answer the question "How many times did this event occur during this time period." Basically I would like the integral of the curve in the chart below.
It doesn't have to be a moving window, this time it's more of a one-time-task. A count-aggregator or similar on the advanced log query would also work if that would be available.
The query looks like this:
(resource.type="container"
logName="projects/xyz-142842/logs/drs"
"Publish Message for updated entity"
) AND (timestamp>="2018-04-25T06:20:53Z" timestamp<="2018-04-26T06:20:53Z")
My log based metric for the graph above looks like this:
My Dashboard is setup like this:
I ended up building stacked bars.
With correct zoom level I can sum up the number of occurrences easy enough. It would have been a nice feature to get the count directly from a graph (the integral), but this works for now.
There are multiple ways to do so, the two that I saw actually working and that can apply to your situation are the following:
Making use of Logs-based Metrics. They can, for example, record the number of log entries containing particular error messages, or they can extract latency information reported in log entries.
Stackdriver Logging logs-based metrics can be one of two metric types: counter or distribution. [...] Counter metrics count the number of log entries matching an advanced logs filter. [...] Distribution metrics accumulate numeric data from log entries matching a filter.
I would advise you to go through the Documentation to check this feature completely cover your use case.
You can export your logs to Big query, once you have them there you can make use of the classical tools like groupby, select and all the tool that BigQuery offers you.
Here you can find a very minimal step to step guide regarding how to export the logs and how to Analyzing Audit Logs Using BigQuery, but I am sure you can find online many resources.
The product and the approaches are really different, I would say that BigQuery is more flexible, but also more complex to be configure and to properly use it. If you find a third better way please update your question with those information.
At first you have to create a metric :
Go to Log explorer.
Type your query
Go to Actions >> Create Metric.
In the monitoring dashboard
Create a chart.
Select the resource and metric.
Go to "Advanced" and provide the details as given below :
Preprocessing step : Rate
Alignment function : count
Alignment period : 1
Alignment unit : minutes
Group by : log
Group by function : count
This will give you the visualisation in a bar chart with count of the desired events.
There is one more option.
You can read your custom metric using Stackdriver Monitoring API ( https://cloud.google.com/monitoring/api/v3/ ) and process it in script with whatever aggregation you need.
If you are working with python - you may look into gcloud python library https://github.com/GoogleCloudPlatform/google-cloud-python/tree/master/monitoring
It will be very simple script and you can stream results of calculation into bigquery table and use it in your dashboard
With PacketAI, you can send logs of arbitrary formats, including from GCP. then the logs dashboard will automatically parse and group into patterns as shown in this video. https://streamable.com/n50kr8
Counts and trends of different log patterns are also displayed
Disclaimer: I work for PacketAI
I'm trying to setup a Stackdriver dashboard for my custom metrics that my services provide.
In particular I'm starting with general custom/grpc/time_ms metric that is a gauge and have status label on it. I'd love to be able to set up a chart and alert for success rate of the metric(something like count:custom/grpc/time_ms{status:OK} / count:custom/grpc/time_ms{*}).
With my previous project I used Datadog and it was pretty easy to do so there. But I don't see any similar functionality neither in the UI nor in Stackdriver documentation. So I was wondering if it's not documented or simply not supported?
This question is quite old, however, still might be useful for new users of Google Cloud.
In 'Metrics Explorer' in Google Cloud Console there is an option to write a query with MQL (click Query Editor button).
MQL supports expressions which are described in detail here.
The simplest example for dividing one metric by another would look like this:
{ fetch
your_resource_type ::
your_metric_1
; fetch
your_resource_type ::
your_metric_2
}
| join
| div