Skip to content
/ goapm Public

go apm is a set of wrapping common tools with open telemetry components, like redis, mysql, http, gin, gorm and so on.

License

Notifications You must be signed in to change notification settings

hedon954/goapm

Repository files navigation

goapm

Go Report Card codecov CI GitHub release (latest SemVer) Go Reference

goapm is a toolkit for monitoring and observability of golang applications. It provides a set of libraries that are wrapped around opentelemetry.

Example

Features

  • Components support opentelemetry
    • sql.DB
    • gorm.DB
    • RedisV6
    • RedisV9
    • HTTP
    • Gin
    • GRPC Server
    • GRPC Client
  • Metrics
  • AutoPProf
  • APM
  • RotateLog

Architecture

architecture

Otel Collector Policy

processors:
  batch:
  tail_sampling:
    decision_wait: 5s
    num_traces: 50000
    expected_new_traces_per_sec: 1
    policies:
      [
        {
          name: "pinned-always-sample",
          type: boolean_attribute,
          boolean_attribute: { key: pinned, value: true },
        },
        {
          name: "error-always-sample",
          type: boolean_attribute,
          boolean_attribute: { key: error, value: true },
        },
        {
          name: "slowsql-always-sample",
          type: boolean_attribute,
          boolean_attribute: { key: slowsql, value: true },
        },
        {
          name: "longtx-always-sample",
          type: boolean_attribute,
          boolean_attribute: { key: longtx, value: true },
        },
        {
          name: http-slow,
          type: numeric_attribute,
          numeric_attribute:
            {
              key: http.duration_ms,
              min_value: 1000,
              max_value: 9223372036854775807,
            },
        },
        {
          name: http-status-error,
          type: numeric_attribute,
          numeric_attribute:
            { key: http.status_code, min_value: 500, max_value: 599 },
        },
        {
          name: grpc-slow,
          type: numeric_attribute,
          numeric_attribute:
            {
              key: grpc.duration_ms,
              min_value: 1000,
              max_value: 9223372036854775807,
            },
        },
      ]
  filter/ottl:
    error_mode: ignore
    traces:
      span:
        - 'attributes["drop"] == true'