• Home
  • Technology support
  • Runtimes
  • Go
  • Configuration and analysis
  • Custom Go services

Custom Go services

Dynatrace OneAgent not only detects Go-based web applications and provides full code-level visibility; it also offers support for proprietary application-specific services. Thanks to custom services, you can monitor any Go application service even if Dynatrace doesn't provide built-in support for it. A custom service can be used to quickly monitor functions in any Go application.

Custom services serve multiple purposes:

  • Service-level visibility for application-specific components.
  • Response time baselining. This enables the Dynatrace AI to automatically detect changes in response time and identify their root cause.
  • Failure detection and baselining. The AI not only detects when a custom service failed due to an error; it can also identify the root cause and determine if the failure impacts end-user experience.
  • Deeper visibility into your application. This gives you request-level end-to-end traces and method hotspots.

The application you want to define a custom service for must be instrumented with OneAgent.

Create custom Go services

To define custom Go services

  1. In the Dynatrace menu, go to Settings > Service detection > Custom service detection.

  2. Go to the Go services tab, and select Define Go services.

    Go services tab

  3. Type a custom name for the service, and then select Find entry point.

  4. Choose the process group and the process that contain the entry points, and select Continue.

  5. Choose the package or type that you want to use, and select Continue.

    Choose a package or type

    In this example, the scope is main.(*CronJob) because the function is defined as a method of the CronJob type in the main package.

  6. Choose one or more functions as entry points for the custom service, and select Finish.

    Choose a function

  7. Select Save changes in the lower-right corner to enable the new custom Go service.

    Enable Go service

  8. Restart the goCron process to allow Dynatrace OneAgent to instrument all entry points defined in custom Go services.

The newly defined service appears in Smartscape, Service flow, and on its own standalone service overview page:

Service overview page - cron job service

Service flow - cron job service.png

PurePath - cron job service

Closures in Go

Closures are anonymous functions to which the Go compiler assigns special names.

The generated closure names defined in a scope are numbered in order of their appearance: func1, func2, and so on. For instance, the closure in the main function gets the func1 label:

go
package main func main() { go func() { // ... }() }