Get events from graphite through api with use couple tags - graphite

How I can get events from graphite API use two tags or more?
For one tag I use this curl -s "http://graphite/events/get_data?tags=deploy&from=-3hours&until=now" | json_pp
In the documentation for graphite I finde this "The set parameter accepts an optional union or intersection argument to determine the behavior for filtering sets of tags (i.e. inclusive or exclusive). By default, Graphite uses a “lazy union” that will return any matching events for a given tag in a list of tags. This behavior is not intuitive and will therefore be deprecated in a future release."

I got it working on Graphite 1.1.7 by adding an encoded space char (%20) between the tags and in order to make the intersection work as expected I added a parameter set=intersection. Here is the query to pull the events for December 2020 using two tags with intersection:
http://graphite/events/get_data?from=00:00_20201201&until=00:00_20210101&tags=deploy%20failed&set=intersection

Related

Riak: searchable list of maps (with CRDTs)

I have a use-case which consist in storing several maps under an attribute. It's the equivalent JSON list:
[
{"tel": "+33123456789", "type": "work"},
{"tel": "+33600000000", "type": "mobile"},
{"tel": "+79001234567", "type": "mobile"}
]
Also, I'd like to have it searchable at the object level. For instance:
- search entries that have a mobile number
- search entries that have a mobile number and whose number starts with the string "+7"
Since Riak doesn't support sets of maps (but only sets of registers), I was wondering if there is a trick to achieve it. So far I've had 2 ideas
Map of maps
The idea is to generate (randomly?) keys for the objects, and store each object of the list in a parent map whose keys are the ones generated for this only purpose to have a key.
It seems to me that it doesn't allow to search the object (maps inside the parent map) because Riak Solr search requires the full path to the attribute. One cannot simply write the following Solr query: phone_numbers.*.tel:+7*. Also composed search (eg. search entries that have a mobile number and whose number starts with the string "+7") seem hard to achieve.
Sets with simulated multi-valued attributes
This solution consists in using a set and insert all the values of the object as a single string, with separators between them. Yes, it's a hack. An attribute value would look like: $tel:+79001234567$type:mobile$ with : as the attribute name-value separator and $ as the attribute separator.
Search could be feasible using the * wildcard (ugly, but still), except the problem with escaping the separators: what if the type attribute includes a :? Are they some separators that are accepted by Riak and would not be acceptable in a string (I'm thinking of control characters)?
In a nutshell
I'm looking for a solution whatever the hackiness of it, as long as it works. Any idea is welcome.

Google Analytics API - filter dimension sourceMedium

I would like to filter certain sources and mediums (specifically email clients). I need to keep the dimension as one column (I use the maximum number of dimensions - 7).
The filter works fine when I have only one sourceMedium such as:
ga:sourceMedium!=amail.centrum.cz / referral
Filter doesn’t work at all when I use two sourceMedium:
ga:sourceMedium!=amail.centrum.cz / referral,ga:sourceMedium!=mail.google.com / referral
It doesn’t matter If I use AND / OR, the query doesn’t output the desired data.
I assume that there supposed to be some delimiter which could identify that amail.centrum.cz is one string which is delimited by another one. I already tried to use ' at the beginning and at the end of the string, but it seems that it doesn’t work.
Is there anything that I missed in docs or anything else? Looking for your help :)
BTW: I'm aware of the solution: Pull out data from GA, filter data manually (compare output data vs my list of email clients what I would like to exclude)

eventAction and pageView filters in one request

I'm trying to filter website conversions from Google Analytics for a dashboard. However since it is a mixture of third party leads, events, and page path that contribute to the leads, I have to combine different types of filters. However combining folling metrics, the https://ga-dev-tools.appspot.com/query-explorer/ shows me the value 0 even if that's not correct.
Metrics: ga:totalEvents
Dimension:ga:date
ga:pagePath=#DialogNavigatorVertical,ga:eventAction==Texting form submit
I have tried multiple solutions, but can't figure out how to get the correct data. Can I not combine pagePath and evenAction?
Thank you so much for all your kind help,
Anna
Events by definition are not page views. This means that an Event dimension (category, action, label) can't have page view metrics such as page views or average time on the page because that information does not relate to the specific event.
But you can definitely combine pagePath and evenAction. You are getting wrong results because of one of the following reasons
In your filter, ga:pagePath=#DialogNavigatorVertical is wrong, it must be either == or !=. it cant be an assignment operator
IF you wish to combine two filter conditions using AND that means both must be true, use ;. Semicolon is used for AND operator in filters
IF you wish to combine two filter conditions using OR that means both must be true, use ,. Comma is used for OR operator in filters
In case you are using core reporting api from a backend script, please URL encode the call before hitting. like == must be %3D%3D, space must be %20 and so on.
Please have a look into settings here : https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters

What is a valid format for params in news bing url?

I'm trying to add some filters to request for news in bing api but currently I don't get any effects of doing this ( for example filter for news from current month).
I'm trying to this with : https://api.cognitive.microsoft.com/bing/v5.0/news/search?freshness=month&?category=business , and replacing some filters here but I always getting the same result.
Currently i want to add three filters : freshness, category and language for news from current day and month.
So it is bug or I'm doing something wrong with filters ?
One problem is that you have an extra "?" in your query. You only need the first one, and then you can use "&" to delimit individual parameters:
https://api.cognitive.microsoft.com/bing/v5.0/news/search?freshness=month&category=business
You might also try adding a market to the query string, like so:
https://api.cognitive.microsoft.com/bing/v5.0/news/search?freshness=month&category=business&mkt=en-us
I'm using 7.0 and don't know what headers you're passing, so I can't test this directly, but it's possible a default market isn't being set. Since categories are market specific, then depending on how Bing handles this, it could plausibly prevent your category from being used.

Google Analytics API: how to get non-US visitors

I have been using visitors with ga:country filters to get specific country's visitors. For example to get the number of visitors from US, I used the filter of 'ga:country==United%20States'. But I am wondering if I can do something like 'ga:country!=United%20States'? I guess I can subtract ga:country==United%20States from total visitors but I am wondering.
The easet way of doing this is to create a filter ga:country. A filter will let you remove a subset of the data returned by a query. Think of it like a where clause in SQL.
Filter=ga:country!%3DUnited%20States
That translates to
Filter=ga:country != United States
I made a simple report on my personal dashboard the Google Analtyics to test it.
Added info on filtering:
You can add more then one filter by seprateing
OR operator is defined using a comma (,).
AND operator is defined using a semi-colon (;).
You can mix and match Metric and Dimensions in the same filter.

Resources