How to log per request / context - Golang - google-app-engine

I'm trying to migrate an a web app from Google Appengine to a dedicated server and I've got stuck to the logging issue. Basically I would like to organise the logs per request/context(like on GAE) so that I can easily review the errors/trace on each request. The most advanced logging library I could find is the glog package but still I can't figure it out how to log per request/context.

Each request gives you a http.Request-object to work with.
If you're using sessions, then you'll have a sessions.Session-object to work with.
You will want to use those objects to help log per request/context, as they identify the request / session.

Related

Salesforce DocuSign API Sync Issue

New to the forum :) - first post. I am trying to set up DocuSign in Salesforce for a client and keep running into an issue when trying to create an envelope template. Some context: my client has a DocuSign Business account (not Gen/ Negotiate), I have added the documents, and can add non-merge fields fine. The only issue is when I try to place the merge field, not create it, I receive an error:
Save Error: Some fields might be out of sync. Unable to connect to the service. Failed to connect to the salesforce service.
So far I have tried: adding IP addresses to Salesforce, removed MFA authentication for API, I have tried clearing cache and cookies, in different browsers, and in incognito mode - no success. I think I just have missed a step in set up? OR is this just not a feature of the client's current account and they need to enable the "Gen" feature to use merge fields?
Appreciate the help - I am also new to Salesforce administration and coding - so I am learning as I go and bear with me if I am not picking up all the "lingo" up front.
It sounds like you're using the legacy DocuSign for Salesforce package if you're not using Gen/Negotiate, so there are typically a couple of issues that could cause the error that you're seeing. The first is a caching issue, so you could try in an incognito browser or by clearing cache and cookies for the browser.
The other issue could be that the connection between DocuSign and Salesforce was broken and needs to be connected again. If that's the case, you could follow the steps in this article. If you're still running into problems, I'd advise to reach out to the DocuSign support team so that they can take a look with you (https://support.docusign.com/).

Load testing a Google App Engine Application using JMeter

I've created an application and I'd like to test how well it scales to large numbers of users.
To run my application a user has to go to the homepage, sign in to a Google account, click a button and then upload a video file.
First of all, is this possible to emulate using JMeter? I'm signed into my Google account locally but am not sure whether simulated users will have access to it?
Secondly, I've recorded a session in JMeter doing the actions above and have run the test with 10 simulated users, however, the App Engine dashboard doesn't detect any activity. I've followed the steps mentioned here but obviously with details of my application etc.
Here's a screenshot of the summary report.
Is there anything obvious I might be doing wrong? Am I using JMeter in the correct way to test the application as desired?
Apologies for my JMeter inexperience.
This is not something you will be able to record and replay, my expectation is that your application is protected by OAuth so you will need some token in order to execute your calls.
Not knowing the details of your application implementation it's quite hard to guess what's went wrong, I would recommend
Running your test with 1 user and 1 loop first to ensure that it's doing what it is supposed to be doing by adding View Results Tree listener and inspecting request and response details for each sampler (especially for failed ones).
Once you figure out what's wrong with this particular request - amend JMeter configuration so it would be successful. Repeat until you're happy with the test end-to-end.
Add load only after that and be careful as test might be sensitive to extra users/loops, especially if you're using a single login account (which is not recommended)
References:
How to Handle Correlation in JMeter
How to Run Performance Tests on OAuth Secured Apps with JMeter

Java Google AppEngine Managed VMs: What logs are obtainable through the Logging API?

I like that I can use the Logs API (described here: https://cloud.google.com/appengine/docs/java/logs/) to programatically access and display app & request logs as I see fit--it's great.
Now that I'm using Managed VMs on AppEngine you can see on the Admin Console Logs Viewer that there are a ton of additional logs--including in my case a custom log which I found I could include in the viewer (decribed here: https://cloud.google.com/appengine/docs/managed-vms/custom-runtimes#logging).
My question is: Is there any way I can use the Logs API (or other pipelines already built?) to access these logs? My Managed VM module includes several components which could produce logs that I want to view:
App logs -- I can get these! No problem here.
Custom log files created by background processes I kick off in _ah/start (like "my_custom_1.log" in the screenshot)
STDERR & STDOUT from my background processes
Relevant Managed VM logs (e.g. for when an instance was restarted due to bad health... other system events like normal restarts?)
Basically I want "the total picture" at the instance level. Anyone tried to tame Managed VMs in this way with success? I'm not looking forward to rolling my own solution. And I wouldn't even know where to start on the problem of capturing STDERR and STDOUT. Any help appreciated.
There is a difference between App Engine logging and Google Cloud logging. Some of the Managed VM logs go to both, but much of it only goes to cloud logging.
Until recently there was not an API to read Cloud logs, only to write them. However, there is a new v2 beta API: https://cloud.google.com/logging/docs/api/introduction_v2
To do things at an instance level, entries in Cloud logging should have metadata set to denote which VM they came from. Both of these values seem to vary on logs from my VMs:
compute.googleapis.com/resource_name
compute.googleapis.com/resource_id

Possible to access Piwik getVisitorLog through HTTP API?

I'm building some reporting tool. Ideally I want to avoid going through web server logs myself and use (some of) the power of Piwik.
The stuff I get from the visitor log would be a good start, this is at http://example.com/piwik/index.php?module=CoreHome&action=index&idSite=1&period=day&date=yesterday#/module=Live&action=getVisitorLog&idSite=1&period=day&date=yesterday
Unfortunately I can't find a getVisitorLog action in the HTTP API docs at
http://developer.piwik.org/api-reference/reporting-api#Actions (and it's also not an undocumented feature, method=Actions.getVisitorLog gives me
The method 'getVisitorLog' does not exist or is not available in the module '\Piwik\Plugins\Actions\API'.
Is there another way to get to this? Or should I write a plugin for Piwik?
Apparently it is possible through the Live plugin API:
http://developer.piwik.org/api-reference/reporting-api#Live
This works as desired:
http://example.com/piwik/index.php?module=API&method=Live.getLastVisitsDetails&format=JSON&idSite=1&period=day&date=2015-07-21&expanded=1&token_auth=XXXXX&filter_limit=100

How to stop CapeDwarf JBoss AS7 from storing logs in datastore?

I am using CapeDwarf JBoss AS7 to host classic GAE+GWT application. On server side, I am logging directly to java.util.Logger framework.
The application works fine, the logs print nice to the console and files.
However, all my logs, together with some http request logs, are also stored in the datastore. Yes, every log line becomes one datastore entity. This should not surprise me, because it is stated in the docs (http://www.jboss.org/capedwarf/docs) and it is needed in order to display logs in gae-like admin console of CapeDwarf.
I was looking for a way to disable this useful but expensive feature. I cannot find any docs that would tell me what to do if I do not need/want my logs in the datastore (e.g. right now 98.3% of my datastore are __org.jboss.capedwarf.LogRequest__ and __org.jboss.capedwarf.LogLine__ entities!). Does anyone happen to know how to do it?
Already answered on our forum: https://community.jboss.org/message/810735#810735

Resources