I have a Google App Engine application that is listed under the Stackdriver Trace, but when I go to trace list there is nothing.
However, the logs and error reporting works.
Is there a special setting you need to set in order to get the traces? I've looked through many tutorials and it seems that the traces automatically appear?
Stackdriver Trace is not automatically setup for Compute Engine, App Engine Flexible or Containers. Stackdriver Trace is automatically enabled for App Engine Standard.
You must instrument your application first, then you can review the Stackdriver Trace logs.
Start with this link. Instrumentation is language specific:
Setting Up Stackdriver Trace
Related
I am using a Google Cloud virtual machine to run several python scripts scheduled on a cron, I am looking for some way to check that they ran.
When I look in my logs I see nothing, so I guess simply running a .py file is not logged? Is there a way to turn on logging at this level? What are the usual approaches for such things?
The technology for recording log information in GCP is called Stackdriver. You have a couple of choices for how to log within your application. The first is to instrument your code with Stackdriver APIs which explicitly write data to the Stackdriver subsytem. Here are the docs for that and here is further recipe.
A second story is that you install the Stackdriver Logging Agent on your Compute Engine. This will then allow you to tap into other sources of logging output such as local syslog.
We have multiple spring boot and python apps running on top of GKE and for spring boot applications am using spring-cloud-gcp-starter-trace to log traces to stack driver so that I can debug those traces via the stack driver UI.
Am not able to figure out how to add labels like service_name, service_version and cluster_name so that I can filter out only those traces for reporting purposes because right now we have istio configured on one cluster and even with one percent sampling rate it's generating tons of telemetry data and with UN-availability of filters or am missing some configuration, the trace UI has almost become useless for me
I had a look at the documentation for spring-cloud-gcp-starter-trace, they don't have any properties through which I can set these fields, Am setting app name and app version via the metadata tags of the kubernetes deployment template but they aren't getting picked up.
Can some one please let me know how can I achieve this.
You can add custom tags using the brave.SpanCustomizer. Just autowire it in as the bean already exists in the application context.
You can then add tags like this:
#Autowired
SpanCustomizer spanCustomizer;
...
spanCustomizer.tag("my-tag", "my tag value");
These will turn into labels on you traces in Stackdriver Trace, on which you can search.
If you're using OpenCensus, you can use annotations to pass metadata into the Trace backend:
https://cloud.google.com/trace/docs/setup/java#custom_spans.
I don't see anything in spring-cloud-gcp-starter-trace documentation (what little I could find) regarding annotations however.
I am having difficulties integrating with Stackdriver Error Reporting.
When using the stack driver log viewer I can see that it has correctly identified it as an error event due to the orange '!!' on the log line.
The logs are coming from a Java Application in a pod on Kubernetes. I am using SLF4J and logback to control my logging. I realise this is not the example in the docs which suggest fluentd however I would like to avoid changing my logging across all applications.
Following the troubleshooting guide I am able to submit a log line that is picked up and also directly report an error. This makes me think the issue must be permissions related. I have tried adding the "Error Reporting Admin" role onto the compute engine default service account and onto Kubernetes Engine Service Agent but this has not worked.
Am I missing something?
The !! in the logs viewer means that the LogEntry.severity field has a value of ERROR (which is provided by the client that wrote the entry). Entries that land in Error Reporting need to meet a few other criteria: https://cloud.google.com/error-reporting/docs/formatting-error-messages
You might also be interested in the details on how errors are grouped together: https://cloud.google.com/error-reporting/docs/grouping-errors
The "Error Reporting Admin" role would allow someone (or a service account) to perform actions like muting an error group. There are no permissions requirements to get data from logging into Error Reporting.
I am new to Google Cloud platform, I am trying out Google's Talent Solution APIs and getting 400 and 409 errors. I would like to know how to see the error trace on my google cloud platform console for those requests? I could see those requests in the dashboard, not sure if I can drill down and see the exact error?
If you see these errors in your Developer Console main dashboard in the "Error Reporting" section, you should be able to click on the "Go to Error Reporting" link. There, you'll see a list of errors that happened lately. Clicking on one of them, you'll see more info on that specific error (occurrences, last seen, etc...) and a stack trace sample. Further down, you'll see a list of the last occurrences for that error and their respective link to the logs.
Alternatively, you may go directly to your Dev Console -> Logging section and choose the Talent Solution resource if available or the resource where you call the API from (App Engine, GKE, etc...) and filter the logs by error code to get details about these.
We are starting to enable Stackdriver for our project, but while I have a ubuntu instance with stackdriver logging, and I am getting the logs shipped back (I can see the logs in Stackdriver Logging), when I browse to Error Reporting, it's just a blank screen with a button to "Setup Error Reporting", which takes me to some API documentation which I think is tailored for new application coding. We are running nginx and the logging is working, but I can't for the life of me figure out how to get the Error Reporting to work properly, if that's even doable.
"Setup Error Reporting" should guide you to the setup documentation (not API documentation). Depending on the platform you are using, you might need to perform some changes in your application's code or log format. Read more at https://cloud.google.com/error-reporting/docs/setup/
If you have Stackdriver Logging setup and on Google Compute Engine, the requirement is for your exception stack traces to be log in single log entries.