{
  "repo": "tidbcloud/metrics-server",
  "binary": "push_pipeline",
  "binary_path": "cmd/push_pipeline/main.go",
  "dependencies": {
    "HTTP GET /metrics": {
      "infrastructure": {},
      "services": []
    },
    "HTTP GET /internal/reload": {
      "infrastructure": {},
      "services": []
    },
    "Runtime PushPipelineLifecycle.Startup": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "CONNECT",
              "trigger": "Initialize database connection pool",
              "conditions": ["Always"],
              "implementation": "cmdhelper.InitMetadbDriver() -> dbinit.InitializeV2(mysqlConfig, false)"
            }
          ]
        }
      },
      "services": []
    },
    "Runtime PushPipelineLifecycle.ScrapeAndExport": {
      "infrastructure": {
        "mysql": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "SELECT",
              "trigger": "Get integrations by provider type",
              "conditions": ["Always"],
              "implementation": "entity.NewIntegrationQuerySet(tx).ProviderTypeIn(integrationTypes...).StatusIn(active, error).All(&is)"
            }
          ]
        },
        "thanos": {
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "GET /api/v1/query",
              "trigger": "Query metrics from Thanos",
              "conditions": ["Always"],
              "implementation": "client.DoInstantQuery(ctx, promql, metricName)"
            }
          ]
        }
      },
      "services": [
        {
          "name": "core-svc",
          "target_interface": "CoreService.ListClusters",
          "operation_type": "grpc_unary",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC ListClusters",
              "trigger": "Get clusters by project IDs",
              "conditions": ["Always"],
              "implementation": "grpcli.ListClusters(ctx, &core.ListClustersReq{Filter: ...})"
            }
          ]
        },
        {
          "name": "account-svc",
          "target_interface": "AccountAPIService.GetProjectByID",
          "operation_type": "grpc_unary",
          "conditions": ["Always"],
          "operations": [
            {
              "operation": "gRPC GetProjectByID",
              "trigger": "Get project name for metrics labels",
              "conditions": ["Always"],
              "implementation": "centralmod.GetProjectByID(ctx, projectID) -> grpcli.GetProjectByID(ctx, &account.GetProjectByIDRequest{Id: projectID})"
            }
          ]
        },
        {
          "name": "datadog",
          "target_interface": "POST /api/v2/series",
          "operation_type": "http_post",
          "conditions": ["IntegrationType == DATADOG"],
          "operations": [
            {
              "operation": "HTTP POST series",
              "trigger": "Push metrics to Datadog",
              "conditions": ["Always"],
              "implementation": "client.PostMetrics(ms) -> HTTP POST to https://api.{site}/api/v2/series"
            }
          ]
        },
        {
          "name": "datadog",
          "target_interface": "POST /api/beta/sketches",
          "operation_type": "http_post",
          "conditions": ["IntegrationType == DATADOG"],
          "operations": [
            {
              "operation": "HTTP POST sketches",
              "trigger": "Push sketches to Datadog",
              "conditions": ["Always"],
              "implementation": "pushSketches(ctx, sl) -> HTTP POST to https://api.{site}/api/beta/sketches"
            }
          ]
        },
        {
          "name": "newrelic",
          "target_interface": "otlpmetrics.NewrelicMetricsService.Export",
          "operation_type": "grpc_unary",
          "conditions": ["IntegrationType == NEWRELIC"],
          "operations": [
            {
              "operation": "gRPC Export",
              "trigger": "Push metrics to New Relic via OTLP",
              "conditions": ["Always"],
              "implementation": "newrelicClient.Export(ctx, req) -> OTLP gRPC to otlp.nr-data.net:4317"
            }
          ]
        }
      ]
    }
  }
}
