Creating a blacklist configuration in Prometheus/Alertmanger that allow excluding individual hosts and/or host/service combinations from creating alerts, e.g.:
blacklist_endpoints:
name: blacklisted_URLs
host: "test_URL"
labels: <label>
The above URLs should not create alerts no matter if it present in some other rules, In other words, These should be the priority if matching here.
Any Idea will be useful or any approach which we can take for achieving this.
I know for DSE graph, in gremlin-console you can create a graph with replication as follows
system.graph('graph_name').replication("{'class' : 'NetworkTopologyStrategy', 'dc1' : 3}")
But how do you find out about an existing graph's replication?
As far as I know, right now it's not possible to do via existing interfaces inside the gremlin-console. Before 5.1.3, there were separate options that was possible to fetch via schema.config().describe(), but they were replaced with replication & systemReplication. Looks like (don't know 100%) that the strings provided via these options could be just passed to corresponding CREATE KEYSPACE commands, so if you have access to cqlsh then you can get replication factor from describe keyspace graph_name. Another possibility is to use Java code to fetch Metadata, and then extract replication factor via getReplication call.
I don't actually have a problem, but I am very curious, why sharing URLs are different in "Get Shareable Link" and "Share..." buttons.
For example, I want to share one folder.
When I get URL from "Get Shareable Link", I get this:
https://drive.google.com/open?id=1Tgz6ltC4WKmgbrRYNhd3r0hAjS7C_K2l
but, if I get URL from "Share...", I get this:
https://drive.google.com/drive/folders/1Tgz6ltC4WKmgbrRYNhd3r0hAjS7C_K2l?usp=sharing
Well, I know some things about the URL in the second link: The usp= must be source parameter, that where the link came from, and yes, this is sharing. It came from sharing ("Share..."). And also there are may other parameters:
usp=drive_web
usp=direct_url
Google Drive Links URL format and query parameters
And there are also parameters before usp=: "edit, view: these parameters tell the browser the priority that which type of access to go into if this access type is accessible. So, if the link has "edit" parameter but the user don't have permission to edit the file/folder, then automaticlly it will be redirected into "view" permission mode.
https://learninginhand.com/blog/google-document-url-tricks
Well, these are king of understandable, but my question is this:
Why these two links have different starting?
https://drive.google.com/open?id=1Tgz6......
https://drive.google.com/drive/folders/1Tgz6......
I know that this is file/folder ID: 1Tgz6ltC4WKmgbrRYNhd3r0hAjS7C_K2l, but what is the point of these differences in these links?
why the first one has open?id= and the second one has drive/folders/, why? Which one is better to use in which situations? If both are fine in any situation, then why are they two? What is the point of it? You know, I get the point of URL ending parameters (usp= and stuff), but I don't get the point of different URLs which work kinda absolutely the same way: to share/get file/folder.
There is also another example:
https://drive.google.com/open?id=1vY7tQaNt3Vnkaxy-5Lbn1ImOfTiTC5bPk8mRZLqBOsE
https://docs.google.com/spreadsheets/d/1vY7tQaNt3Vnkaxy-5Lbn1ImOfTiTC5bPk8mRZLqBOsE
What's the point of these two guys:
open?id=
spreadsheets/d/
Don't they just do the same thing: to build the URL? So, why the same folder/file is represented by two different URLs? Why there is not just one URL (of course with ending parameters: usp= and stuff. the ending parameters are quick understandable).
I am trying to get JVM metrics from my application, which runs three instances, with three separate JVMs. I can see the different data that I am interested in in the New Relic dashboard, on the Monitoring -> JVMs tab. I can also get the information I want for one of those JVMs, by hitting the REST API like so:
% curl -gH "x-api-key:KEY" 'https://api.newrelic.com/api/v1/applications/APPID/data.xml?metrics%5B%5D=GC%2FPS%20Scavenge&field=time_percentage&begin=T1&end=T2'
(I've replaced the values of some fields, but this is the full form of my request.)
I get a response including a long list of elements like this:
<metric name="GC/PS Scavenge" begin="T1" end="T2" app="MYAPP" agent_id="AGENTID">
<field name="time_percentage">0.018822634485032824</field>
</metric>
All of the metric elements include the same agent_id fields, and I never specified which agent to use. How can I either:
get metrics for all agents
specify which agent I am interested in (so I can send multiple requests, one for each JVM)
agent_id can be a particular JVM instance, and while you can't request for multiple agents at once you can request metrics for a single JVM.
You can get the JVM's agent_id in one of two ways:
1) an API call to
https://api.newrelic.com/api/v1/accounts/:account_id/applications/:app_id/instances.xml
2) browse to the JVM in the New Relic user interface (use the 'JVM' drop-down at the top right after you select your app), then grab the ID from the URL.
The ID will look something like [account_id]_i2043442
Some data is not available broken down by JVM, most notably a call to threshold_values.xml won't work if the agent_id isn't an application.
full documentation of the V1 API: http://newrelic.github.io/newrelic_api/
I'm fairly familiar with REST principles, and have read the relevant dissertation, Wikipedia entry, a bunch of blog posts and StackOverflow questions on the subject, but still haven't found a straightforward answer to a common case:
I need to request a resource to display. Depending on the resource's state, I need to render either a read-only or an editable representation. In both cases, I need to GET the resource. How do I construct a URL to get the read-only or editable version?
If my user follows a link to GET /resource/<id>, that should suffice to indicate to me that s/he needs the read-only representation. But if I need to server up an editable form, what does that URL look like? GET /resource/<id>/edit is obvious, but it contains a verb in the URL. Changing that to GET /resource/<id>/editable solves that problem, but at a seemingly superficial level. Is that all there is to it -- change verbs to adjectives?
If instead I use POST to retrieve the editable version, then how do I distinguish between the POST that initially retrieves it, vs the POST that saves it? My (weak) excuse for using POST would be that retrieving an editable version would cause a change of state on the server: locking the resource. But that only holds if my requirements are to implement such a lock, which is not always the case. PUT fails for the same reason, plus PUT is not enabled by default on the Web servers I'm running, so there are practical reasons not to use it (and DELETE).
Note that even in the editable state, I haven't made any changes yet; presumably when I submit the resource to the Web server again, I'd POST it. But to get something that I can later POST, the server has to first serve up a particular representation.
I guess another approach would be to have separate resources at the collection level:
GET /read-only/resource/<id> and GET /editable/resource/<id> or GET /resource/read-only/<id> and GET /resource/editable/<id> ... but that looks pretty ugly to me.
Thoughts?
1) It is perfectly valid to have two distinct resources, one for viewing and one for editing some domain concept. Just be aware that because they are two different URIs from REST's perspective they are two different resources. Too often people conflate resource with domain object. That's why they end up being stuck only doing CRUD.
2) Don't get too hung up on the name of the resource. The important thing is that you realize that what the URI points to is a "thing", "a resource". If that's more obvious to you with editable instead of edit then use that. Having a verb in your URL doesn't make your application wrong, it just makes it a bit less readable to the human developer. Using a verb in the URL to try and redefine the semantics of the HTTP method, now that's a violation of the uniform interface constraint.
In REST, editing an existing resource is accomplished by a client GET-ing a representation of that resource, making changes to the representation, and then doing a PUT of the new representation back to the server.
So to just read a resource your REST client program would do a:
GET http://www.example.com/SomeResource
And to edit that resource:
GET http://www.example.com/SomeResource
... edit it ...
PUT http://www.example.com/SomeResource
Normally simultaneous updates are handled by letting the last PUT arriving at the server overwrite the earlier ones, on the assumption that it represents a newer state. But in your case you want to guard against this.
Carefully consider #Jason's suggestion to maintain an optional parallel lock resource for each main resource. Your client would first create the lock, do the edit, then delete the lock. Your system would need to release a lock automatically if the user making the lock subsequently never saves any changes. This would look like:
GET http://www.example.com/SomeResource
... user presses an edit button ...
PUT http://www.example.com/SomeResource/lock
... user edits the resource's representation ...
PUT http://www.example.com/SomeResource
DELETE http://www.example.com/SomeResource/lock
You'd need to do some appropriate error handling if the user is trying to edit a resource that's locked by someone else.
It sounds like you feel you're constrained by the current limitations of HTML. If you use a server-side REST framework like Restlet (for Java), it supports the notion of "overloaded POST", where you can use POST but tack on a query string argument like method=PUT or method=DELETE. If you're writing your own server-side components they can use this trick too.
There are tricks you can play at the HTML level too. For instance your page can have a read-only part that's initially displayed, and an input form that's initially not shown. When the user presses the edit button, your JavaScript hides the read-only part and shows the input form.
Be sure to read Richardson and Ruby's Restful Web Services (O'Reilly) too. It's extremely helpful.
I don't think returning a form or just values is up to a REST server, but the responsibility of the client. Whether a resource is editable is a property of the resource, and not something defined by the URL.
In other words: The URL for getting the resource is GET /resource/<id>. This has a property editable. If a user wants a form it can retrieve the resource from the same URL and populate the form. The client can than PUT/POST changes.
How do I construct a URL to get the read-only or editable version?
There's an underlying problem here, which is that you are constructing URLs in the first place - appending IDs to hard-coded URLs is not REST. Roy Fielding has written about this very mistake. Whichever document prompts you to edit the resource should contain the URI to the editable variant of that resource. You follow that URI, whether that's /resource/editable or /editable/resource is outside the scope of REST.
If instead I use POST to retrieve the editable version, then how do I distinguish between the POST that initially retrieves it, vs the POST that saves it?
You perform a GET (not a POST) to read the resource, and POST (or PUT) to write the resource.
If you want to create a lock on the resource in question, use POST to write to the resource (or the resource's container, with the resource ID encoded in the body of the POST), and have the server create a lock as a new resource, and return an ID of that resource as the response to the POST. (with authentication issues beyond the scope of your question or this answer)
Then to unlock the lock, either use a DELETE on the lock resource, or POST to the lock's container.
I guess your question could be "how to identify the readonly representation that return with GET action in PUT action?". You could do this:
<Root>
<readonly>
<p1><p1>
...
<readonly>
<others>
...
<others>
<Root>
After parsing the request XML from PUT you can ignore the readonly part and process others. In Response, return 200 status and leave a message saying the part in readonly is ignored.
Is it your expected?