Amazon S3 client total request count
Hello, i need some help in something i assume it's easy but i need to be 100% sure.
I have an s3client that i use to make some requests to amazon s3. Now i need to log the total GET/POST/PUT/DELETE requests i do. I assume it's only 1 request per call, but to be 100% sure i prefer to ask here how can i check this.
The idea is to have methods like:
so when i do the "GetObjectMetadata" request, it adds 1 to the counter. So i need to be sure every mehtod i call does only 1 request, in case it does some extra requests i should then add something like "PostRequest += 1" or smth like that
15 Replies
That looks like VB, not C#.
How do you plan to handle restarts, or crashes? Is the object lifetime for your client always a singleton?
its a service i execute once every day and it start from 0 in every execution. It does some things and then ends and restart the next day.
Also for the C#/VB part, i assumed i could ask here since the s3Client is fully written in c# and here i only do a call to the api
what the S3 client is written in really doesnt matter
you are not asking about the s3 client, you are asking about your wrapper
regardless, the same questions apply - are you sure about the lifetimes here?
like, if you do
var wrapper = new Wrapper(s3Client);
, your counts will reset
so how accurate do you need your counts to be? When are they "reported" out of the system?yeah, this app should open, do something and end. This wrapper will execute once at the start of the lifetiume and will end with the end of the process
ok so its a short-lived app?
i just start it and at the end of the execution it will log it with somehting like:
then this is fine, except that it wont handle failures very well
and it will log it
dw, the failures are handled in the main code
but the counts will be potentially inaccurate, based on failures
i used to do s3Client.MyRequest with a try catch and all that, now i just do the same but with a wrapper so i can add the request count without worrying about forgiving to add it
well, thats something i will need to live with, it doesnt need to be 100% accurate, i just need it so someone can do some statistics and some numbers
okay, yeah then thats fine
but i assume when i call the api for a delete, for example, it will just do one delete request, right?
i dont know how to check what it does in the backend
it takes me to an interface so i cannot see the code and how it handles the requests
I dont understand the question
if you do
s3Client.Delete
, that will only do a delete
it will not do posts, puts, gets etcthe client fear is that it makes a Get and then a Delete, for example
i assume it's well written and it will only do a Delete
but i need to make sure it is like that for the client
so check the source for the s3client?
but yeah, I would be very surprised if it did anything else