Showing preview only (1,828K chars total). Download the full file or copy to clipboard to get everything.
Repository: PacktPublishing/Go-for-DevOps
Branch: main
Commit: 5861b176be50
Files: 358
Total size: 15.4 MB
Directory structure:
gitextract_rgfwv7jv/
├── .gitignore
├── LICENSE
├── README.md
├── chapter/
│ ├── 10/
│ │ ├── .github/
│ │ │ ├── release.yml
│ │ │ └── workflows/
│ │ │ ├── action-version.yaml
│ │ │ ├── first.yaml
│ │ │ ├── image-release.yaml
│ │ │ └── tweeter-automation.yaml
│ │ ├── .gitignore
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── action.yaml
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── main.go
│ │ └── pkg/
│ │ └── tweeter/
│ │ ├── tweeter.go
│ │ └── tweeter_test.go
│ ├── 11/
│ │ ├── Dockerfile
│ │ ├── README.md
│ │ ├── chatbot/
│ │ │ ├── .gitignore
│ │ │ ├── bot/
│ │ │ │ └── bot.go
│ │ │ ├── chatbot.go
│ │ │ ├── internal/
│ │ │ │ └── handlers/
│ │ │ │ ├── handlers.go
│ │ │ │ └── help.go
│ │ │ └── slack.manifest
│ │ ├── docker-compose.yaml
│ │ ├── ops/
│ │ │ ├── README.md
│ │ │ ├── client/
│ │ │ │ └── client.go
│ │ │ ├── internal/
│ │ │ │ ├── jaeger/
│ │ │ │ │ └── client/
│ │ │ │ │ ├── client.go
│ │ │ │ │ └── test/
│ │ │ │ │ ├── README.md
│ │ │ │ │ ├── client/
│ │ │ │ │ │ └── client.go
│ │ │ │ │ ├── docker-compose.yaml
│ │ │ │ │ ├── etoe_test.go
│ │ │ │ │ ├── otel-collector-config.yaml
│ │ │ │ │ └── server/
│ │ │ │ │ ├── Dockerfile
│ │ │ │ │ ├── docker-compose.yaml
│ │ │ │ │ ├── go.mod
│ │ │ │ │ ├── go.sum
│ │ │ │ │ ├── main.go
│ │ │ │ │ ├── otel-collector-config.yaml
│ │ │ │ │ └── readme.md
│ │ │ │ ├── prom/
│ │ │ │ │ └── prom.go
│ │ │ │ └── server/
│ │ │ │ └── server.go
│ │ │ ├── ops.go
│ │ │ └── proto/
│ │ │ ├── buf.gen.yaml
│ │ │ ├── buf.yaml
│ │ │ ├── jaeger/
│ │ │ │ ├── collector.pb.go
│ │ │ │ ├── collector.proto
│ │ │ │ ├── collector_grpc.pb.go
│ │ │ │ ├── model/
│ │ │ │ │ ├── model.pb.go
│ │ │ │ │ └── model.proto
│ │ │ │ ├── query.pb.go
│ │ │ │ ├── query.proto
│ │ │ │ ├── query_grpc.pb.go
│ │ │ │ ├── sampling.pb.go
│ │ │ │ ├── sampling.proto
│ │ │ │ └── sampling_grpc.pb.go
│ │ │ ├── ops.pb.go
│ │ │ ├── ops.proto
│ │ │ └── ops_grpc.pb.go
│ │ ├── otel-collector-config.yaml
│ │ ├── petstore/
│ │ │ ├── Dockerfile
│ │ │ ├── README.md
│ │ │ ├── client/
│ │ │ │ ├── cli/
│ │ │ │ │ └── petstore/
│ │ │ │ │ └── petstore.go
│ │ │ │ ├── client.go
│ │ │ │ └── demo/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── demo.go
│ │ │ │ └── names.txt
│ │ │ ├── docker-compose.yaml
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── internal/
│ │ │ │ └── server/
│ │ │ │ ├── errors/
│ │ │ │ │ └── errors.go
│ │ │ │ ├── log/
│ │ │ │ │ └── log.go
│ │ │ │ ├── server.go
│ │ │ │ ├── storage/
│ │ │ │ │ ├── mem/
│ │ │ │ │ │ ├── mem.go
│ │ │ │ │ │ └── mem_test.go
│ │ │ │ │ └── storage.go
│ │ │ │ └── telemetry/
│ │ │ │ ├── metrics/
│ │ │ │ │ ├── metrics.go
│ │ │ │ │ └── start.go
│ │ │ │ └── tracing/
│ │ │ │ ├── sampler/
│ │ │ │ │ └── sampler.go
│ │ │ │ └── tracing.go
│ │ │ ├── otel-collector-config.yaml
│ │ │ ├── petstore.go
│ │ │ ├── prometheus.yaml
│ │ │ └── proto/
│ │ │ ├── buf.gen.yaml
│ │ │ ├── buf.yaml
│ │ │ ├── petstore.pb.go
│ │ │ ├── petstore.proto
│ │ │ └── petstore_grpc.pb.go
│ │ └── prometheus.yaml
│ ├── 12/
│ │ ├── agent.service
│ │ ├── goss/
│ │ │ └── allfiles/
│ │ │ └── allfiles.go
│ │ └── packer/
│ │ ├── README
│ │ ├── amazon.final.pkr.hcl
│ │ ├── amazon.goenv.pkr.hcl
│ │ └── plugins/
│ │ └── goenv/
│ │ ├── GNUmakefile
│ │ ├── LICENSE
│ │ ├── goenv.go
│ │ └── internal/
│ │ └── config/
│ │ ├── config.go
│ │ └── config.hcl2spec.go
│ ├── 13/
│ │ └── petstore-provider/
│ │ ├── .gitignore
│ │ ├── Makefile
│ │ ├── docker-compose.yml
│ │ ├── examples/
│ │ │ └── main.tf
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── internal/
│ │ │ ├── client/
│ │ │ │ ├── client.go
│ │ │ │ ├── internal/
│ │ │ │ │ └── server/
│ │ │ │ │ ├── errors/
│ │ │ │ │ │ └── errors.go
│ │ │ │ │ ├── log/
│ │ │ │ │ │ └── log.go
│ │ │ │ │ ├── storage/
│ │ │ │ │ │ ├── mem/
│ │ │ │ │ │ │ ├── mem.go
│ │ │ │ │ │ │ └── mem_test.go
│ │ │ │ │ │ └── storage.go
│ │ │ │ │ └── telemetry/
│ │ │ │ │ ├── metrics/
│ │ │ │ │ │ ├── metrics.go
│ │ │ │ │ │ └── start.go
│ │ │ │ │ └── tracing/
│ │ │ │ │ ├── sampler/
│ │ │ │ │ │ └── sampler.go
│ │ │ │ │ └── tracing.go
│ │ │ │ └── proto/
│ │ │ │ ├── buf.gen.yaml
│ │ │ │ ├── buf.yaml
│ │ │ │ ├── petstore.pb.go
│ │ │ │ ├── petstore.proto
│ │ │ │ └── petstore_grpc.pb.go
│ │ │ ├── data_source_pet.go
│ │ │ ├── provider.go
│ │ │ ├── resource_pets.go
│ │ │ └── schema.go
│ │ └── main.go
│ ├── 14/
│ │ ├── petstore-operator/
│ │ │ ├── .dockerignore
│ │ │ ├── .gitignore
│ │ │ ├── Dockerfile
│ │ │ ├── Makefile
│ │ │ ├── PROJECT
│ │ │ ├── Tiltfile
│ │ │ ├── api/
│ │ │ │ └── v1alpha1/
│ │ │ │ ├── groupversion_info.go
│ │ │ │ ├── pet_types.go
│ │ │ │ └── zz_generated.deepcopy.go
│ │ │ ├── client/
│ │ │ │ ├── client.go
│ │ │ │ ├── internal/
│ │ │ │ │ └── server/
│ │ │ │ │ ├── errors/
│ │ │ │ │ │ └── errors.go
│ │ │ │ │ ├── log/
│ │ │ │ │ │ └── log.go
│ │ │ │ │ ├── storage/
│ │ │ │ │ │ ├── mem/
│ │ │ │ │ │ │ ├── mem.go
│ │ │ │ │ │ │ └── mem_test.go
│ │ │ │ │ │ └── storage.go
│ │ │ │ │ └── telemetry/
│ │ │ │ │ ├── metrics/
│ │ │ │ │ │ ├── metrics.go
│ │ │ │ │ │ └── start.go
│ │ │ │ │ └── tracing/
│ │ │ │ │ ├── sampler/
│ │ │ │ │ │ └── sampler.go
│ │ │ │ │ └── tracing.go
│ │ │ │ └── proto/
│ │ │ │ ├── buf.gen.yaml
│ │ │ │ ├── buf.yaml
│ │ │ │ ├── petstore.pb.go
│ │ │ │ ├── petstore.proto
│ │ │ │ └── petstore_grpc.pb.go
│ │ │ ├── config/
│ │ │ │ ├── crd/
│ │ │ │ │ ├── bases/
│ │ │ │ │ │ └── petstore.example.com_pets.yaml
│ │ │ │ │ ├── kustomization.yaml
│ │ │ │ │ ├── kustomizeconfig.yaml
│ │ │ │ │ └── patches/
│ │ │ │ │ ├── cainjection_in_pets.yaml
│ │ │ │ │ └── webhook_in_pets.yaml
│ │ │ │ ├── default/
│ │ │ │ │ ├── kustomization.yaml
│ │ │ │ │ ├── manager_auth_proxy_patch.yaml
│ │ │ │ │ └── manager_config_patch.yaml
│ │ │ │ ├── manager/
│ │ │ │ │ ├── controller_manager_config.yaml
│ │ │ │ │ ├── kustomization.yaml
│ │ │ │ │ └── manager.yaml
│ │ │ │ ├── manifests/
│ │ │ │ │ └── kustomization.yaml
│ │ │ │ ├── petstore-service/
│ │ │ │ │ └── service.yaml
│ │ │ │ ├── prometheus/
│ │ │ │ │ ├── kustomization.yaml
│ │ │ │ │ └── monitor.yaml
│ │ │ │ ├── rbac/
│ │ │ │ │ ├── auth_proxy_client_clusterrole.yaml
│ │ │ │ │ ├── auth_proxy_role.yaml
│ │ │ │ │ ├── auth_proxy_role_binding.yaml
│ │ │ │ │ ├── auth_proxy_service.yaml
│ │ │ │ │ ├── kustomization.yaml
│ │ │ │ │ ├── leader_election_role.yaml
│ │ │ │ │ ├── leader_election_role_binding.yaml
│ │ │ │ │ ├── pet_editor_role.yaml
│ │ │ │ │ ├── pet_viewer_role.yaml
│ │ │ │ │ ├── role.yaml
│ │ │ │ │ ├── role_binding.yaml
│ │ │ │ │ └── service_account.yaml
│ │ │ │ ├── samples/
│ │ │ │ │ ├── kustomization.yaml
│ │ │ │ │ └── petstore_v1alpha1_pet.yaml
│ │ │ │ └── scorecard/
│ │ │ │ ├── bases/
│ │ │ │ │ └── config.yaml
│ │ │ │ ├── kustomization.yaml
│ │ │ │ └── patches/
│ │ │ │ ├── basic.config.yaml
│ │ │ │ └── olm.config.yaml
│ │ │ ├── controllers/
│ │ │ │ ├── pet_controller.go
│ │ │ │ └── suite_test.go
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ ├── hack/
│ │ │ │ └── boilerplate.go.txt
│ │ │ └── main.go
│ │ └── workloads/
│ │ ├── Readme.md
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── kind-config.yaml
│ │ └── main.go
│ ├── 15/
│ │ ├── .gitignore
│ │ ├── cloud-init/
│ │ │ └── init.yml
│ │ ├── cmd/
│ │ │ ├── compute/
│ │ │ │ └── main.go
│ │ │ └── storage/
│ │ │ └── main.go
│ │ ├── go.mod
│ │ ├── go.sum
│ │ ├── pkg/
│ │ │ ├── helpers/
│ │ │ │ └── helpers.go
│ │ │ └── mgmt/
│ │ │ ├── compute.go
│ │ │ └── storage.go
│ │ └── readme.md
│ ├── 16/
│ │ └── workflow/
│ │ ├── README.md
│ │ ├── client/
│ │ │ └── client.go
│ │ ├── configs/
│ │ │ ├── README
│ │ │ ├── es.json
│ │ │ └── policies.json
│ │ ├── data/
│ │ │ ├── README.md
│ │ │ ├── generators/
│ │ │ │ ├── README
│ │ │ │ └── mk/
│ │ │ │ ├── README
│ │ │ │ └── mk.go
│ │ │ ├── machines.json
│ │ │ ├── packages/
│ │ │ │ └── sites/
│ │ │ │ └── sites.go
│ │ │ └── sites.json
│ │ ├── internal/
│ │ │ ├── es/
│ │ │ │ └── es.go
│ │ │ ├── policy/
│ │ │ │ ├── config/
│ │ │ │ │ └── config.go
│ │ │ │ ├── policy.go
│ │ │ │ └── register/
│ │ │ │ ├── README
│ │ │ │ ├── restrictjobtypes/
│ │ │ │ │ └── restrictjobtypes.go
│ │ │ │ ├── sameargs/
│ │ │ │ │ └── sameargs.go
│ │ │ │ └── startorend/
│ │ │ │ └── startOrEnd.go
│ │ │ ├── service/
│ │ │ │ ├── executor/
│ │ │ │ │ └── executor.go
│ │ │ │ ├── jobs/
│ │ │ │ │ ├── jobs.go
│ │ │ │ │ └── register/
│ │ │ │ │ ├── diskerase/
│ │ │ │ │ │ └── diskerase.go
│ │ │ │ │ ├── sleep/
│ │ │ │ │ │ └── sleep.go
│ │ │ │ │ ├── tokenbucket/
│ │ │ │ │ │ └── tokenbucket.go
│ │ │ │ │ └── validatedecom/
│ │ │ │ │ └── validatedecom.go
│ │ │ │ └── service.go
│ │ │ └── token/
│ │ │ └── token.go
│ │ ├── proto/
│ │ │ ├── buf.gen.yaml
│ │ │ ├── buf.yaml
│ │ │ ├── custom.go
│ │ │ ├── diskerase.pb.go
│ │ │ ├── diskerase.proto
│ │ │ └── diskerase_grpc.pb.go
│ │ ├── samples/
│ │ │ └── diskerase/
│ │ │ ├── LICENSE
│ │ │ ├── cmd/
│ │ │ │ ├── eraseSatellite.go
│ │ │ │ ├── protoStatus.go
│ │ │ │ ├── root.go
│ │ │ │ └── status.go
│ │ │ └── diskerase.go
│ │ └── workflow.go
│ ├── 5/
│ │ └── excel/
│ │ ├── simple/
│ │ │ └── excel.go
│ │ └── visualization/
│ │ ├── excel.go
│ │ └── internal/
│ │ └── chart/
│ │ └── chart.go
│ ├── 6/
│ │ └── grpc/
│ │ ├── buf.work
│ │ ├── client/
│ │ │ ├── bin/
│ │ │ │ └── qotd.go
│ │ │ └── client.go
│ │ ├── proto/
│ │ │ ├── buf.gen.yaml
│ │ │ ├── buf.yaml
│ │ │ ├── qotd.pb.go
│ │ │ ├── qotd.proto
│ │ │ └── qotd_grpc.pb.go
│ │ ├── qotd.go
│ │ └── server/
│ │ └── server.go
│ ├── 7/
│ │ ├── cobra/
│ │ │ └── app/
│ │ │ ├── LICENSE
│ │ │ ├── cmd/
│ │ │ │ ├── get.go
│ │ │ │ └── root.go
│ │ │ └── main.go
│ │ ├── filter_errors/
│ │ │ └── main.go
│ │ └── signals/
│ │ └── main.go
│ ├── 8/
│ │ ├── agent/
│ │ │ ├── README.md
│ │ │ ├── agent.go
│ │ │ ├── bin/
│ │ │ │ ├── README.md
│ │ │ │ ├── build.sh
│ │ │ │ └── linux_amd64/
│ │ │ │ └── agent
│ │ │ ├── buf.work
│ │ │ ├── client/
│ │ │ │ ├── cli/
│ │ │ │ │ ├── LICENSE
│ │ │ │ │ ├── cmd/
│ │ │ │ │ │ ├── auth.go
│ │ │ │ │ │ ├── install.go
│ │ │ │ │ │ ├── remove.go
│ │ │ │ │ │ └── root.go
│ │ │ │ │ ├── main.go
│ │ │ │ │ └── sample/
│ │ │ │ │ └── helloweb/
│ │ │ │ │ ├── helloweb
│ │ │ │ │ └── helloweb.go
│ │ │ │ └── client.go
│ │ │ ├── internal/
│ │ │ │ └── service/
│ │ │ │ ├── service.go
│ │ │ │ └── unit_file.go
│ │ │ └── proto/
│ │ │ ├── agent.pb.go
│ │ │ ├── agent.proto
│ │ │ ├── agent_grpc.pb.go
│ │ │ ├── buf.gen.yaml
│ │ │ ├── buf.yaml
│ │ │ └── extra.go
│ │ ├── rollout/
│ │ │ ├── README.md
│ │ │ ├── config.go
│ │ │ ├── endstate_string.go
│ │ │ ├── lb/
│ │ │ │ ├── README.md
│ │ │ │ ├── buf.work
│ │ │ │ ├── client/
│ │ │ │ │ ├── cli/
│ │ │ │ │ │ └── cli.go
│ │ │ │ │ └── client.go
│ │ │ │ ├── lb.go
│ │ │ │ ├── proto/
│ │ │ │ │ ├── buf.gen.yaml
│ │ │ │ │ ├── buf.yaml
│ │ │ │ │ ├── lb.pb.go
│ │ │ │ │ ├── lb.proto
│ │ │ │ │ └── lb_grpc.pb.go
│ │ │ │ ├── sample/
│ │ │ │ │ └── web/
│ │ │ │ │ └── main.go
│ │ │ │ └── server/
│ │ │ │ ├── grpc/
│ │ │ │ │ └── server.go
│ │ │ │ └── http/
│ │ │ │ ├── p2c.go
│ │ │ │ └── server.go
│ │ │ ├── rollout.go
│ │ │ ├── service.json
│ │ │ └── workflow.go
│ │ ├── scanner/
│ │ │ └── scanner.go
│ │ └── ssh/
│ │ └── client/
│ │ ├── expect/
│ │ │ └── expect.go
│ │ └── remotecmd/
│ │ └── remotecmd.go
│ ├── 9/
│ │ ├── alerting/
│ │ │ ├── alertmanager.yml
│ │ │ ├── client/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ └── main.go
│ │ │ ├── docker-compose.yaml
│ │ │ ├── otel-collector-config.yaml
│ │ │ ├── prometheus.yaml
│ │ │ ├── readme.md
│ │ │ ├── rules/
│ │ │ │ └── demo-server.yml
│ │ │ └── server/
│ │ │ ├── Dockerfile
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ └── main.go
│ │ ├── logging/
│ │ │ ├── docker-compose.yml
│ │ │ ├── otel-collector-config.yml
│ │ │ ├── readme.md
│ │ │ └── varlogpods/
│ │ │ ├── containerd_logs-0_000011112222333344445555666677778888/
│ │ │ │ └── logs/
│ │ │ │ └── 0.log
│ │ │ ├── crio_logs-0_111122223333444455556666777788889999/
│ │ │ │ └── logs/
│ │ │ │ └── 0.log
│ │ │ ├── docker_logs-0_222233334444555566667777888899990000/
│ │ │ │ └── logs/
│ │ │ │ └── 0.log
│ │ │ └── otel_otel_888877776666555544443333222211110000/
│ │ │ └── otel-collector/
│ │ │ └── 0.log
│ │ ├── metrics/
│ │ │ ├── client/
│ │ │ │ ├── Dockerfile
│ │ │ │ ├── go.mod
│ │ │ │ ├── go.sum
│ │ │ │ └── main.go
│ │ │ ├── docker-compose.yaml
│ │ │ ├── otel-collector-config.yaml
│ │ │ ├── prometheus.yaml
│ │ │ ├── readme.md
│ │ │ └── server/
│ │ │ ├── Dockerfile
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ └── main.go
│ │ └── tracing/
│ │ ├── client/
│ │ │ ├── Dockerfile
│ │ │ ├── go.mod
│ │ │ ├── go.sum
│ │ │ └── main.go
│ │ ├── docker-compose.yaml
│ │ ├── otel-collector-config.yaml
│ │ ├── readme.md
│ │ └── server/
│ │ ├── Dockerfile
│ │ ├── go.mod
│ │ ├── go.sum
│ │ └── main.go
│ ├── build_check.sh
│ ├── mod_tidy.sh
│ └── rename.sh
├── go.mod
└── go.sum
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
.idea
venv
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2021 Packt
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
# Go for DevOps
<a href="https://www.packtpub.com/product/go-for-devops/9781801818896?utm_source=github&utm_medium=repository&utm_campaign=9781801818896"><img src="https://static.packt-cdn.com/products/9781801818896/cover/smaller" alt="Go for DevOps" height="256px" align="right"></a>
This is the code repository for [Go for DevOps](https://www.packtpub.com/product/go-for-devops/9781801818896?utm_source=github&utm_medium=repository&utm_campaign=9781801818896), published by Packt.
**Learn how to use the Go language to automate servers, the cloud, Kubernetes, GitHub, Packer, and Terraform**
## What is this book about?
Go is the go-to language for DevOps libraries and services, and without it, achieving fast and safe automation is a challenge. With the help of Go for DevOps, you'll learn how to deliver services with ease and safety, becoming a better DevOps engineer in the process.
This book covers the following exciting features:
* Understand the basic structure of the Go language to begin your DevOps journey
* Interact with filesystems to read or stream data
* Communicate with remote services via REST and gRPC
* Explore writing tools that can be used in the DevOps environment
* Develop command-line operational software in Go
* Work with popular frameworks to deploy production software
* Create GitHub actions that streamline your CI/CD process
* Write a ChatOps application with Slack to simplify production visibility
If you feel this book is for you, get your [copy](https://www.amazon.com/dp/1801818894) today!
<a href="https://www.packtpub.com/?utm_source=github&utm_medium=banner&utm_campaign=GitHubBanner"><img src="https://raw.githubusercontent.com/PacktPublishing/GitHub/master/GitHub.png"
alt="https://www.packtpub.com/" border="5" /></a>
## Instructions and Navigations
All of the code is organized into folders. For example, Chapter02.
The code will look like the following:
```
packer {
required_plugins {
amazon = {
version = ">= 0.0.1"
```
**Following is what you need for this book:**
This book is for Ops and DevOps engineers who would like to use Go to develop their own DevOps tooling or integrate custom features with DevOps tools such as Kubernetes, GitHub Actions, HashiCorp Packer, and Terraform. Experience with some type of programming language, but not necessarily Go, is necessary to get started with this book.
With the following software and hardware list you can run all code files present in the book (Chapter 1-16).
### Software and Hardware List
| Chapter | Software required | OS required |
| -------- | ------------------------------------ | ----------------------------------- |
| 1-16 | Go 1.18 | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Packer | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Terraform | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Kubernetes | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Docker | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Tilt | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Protocol Buffers | Windows, Mac OS X, and Linux (Any) |
| 1-16 | gPRC,ctlptl | Windows, Mac OS X, and Linux (Any) |
| 1-16 | But CLI | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Operator SDK | Windows, Mac OS X, and Linux (Any) |
| 1-16 | Azure CLI, KinD | Windows, Mac OS X, and Linux (Any) |
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. [Click here to download it](https://static.packt-cdn.com/downloads/9781801818896_ColorImages.pdf).
### Related products
* Learning DevOps - Second Edition [[Packt]](https://www.packtpub.com/product/learning-devops-second-edition/9781801818964?utm_source=github&utm_medium=repository&utm_campaign=9781801818964) [[Amazon]](https://www.amazon.com/dp/1801818967)
* The DevOps Career Handbook [[Packt]](https://www.packtpub.com/product/the-devops-career-handbook/9781803230948?utm_source=github&utm_medium=repository&utm_campaign=9781803230948) [[Amazon]](https://www.amazon.com/dp/1803230940)
## Errata
* Page xxi (Under to get the most out of this book): **gPRC(https://grpc.io)** _should be_ **gRPC(https://grpc.io)**
* Page 29 (Under Returning multiple values and named results): **func divide(num, div int) (res, rem int) { result = num / div remainder = num % div return res, rem }** _should be_ **func divide(num, div int) (res, rem int) {res = num / div rem = num % div return res, rem
}**
* Page 74, Third paragraph: **we will spin off 10 goroutines to add a number to a sum value** _should be_ **we will spin off 100 goroutines to add a number to a sum value**
* Page 77, Code snippet: `if ctx.Err() != nil { return nil, err }` _should be_ ` if err := ctx.Err() != nil { return nil, err }`
## Get to Know the Authors
**John Doak**
is the principal manager of Layer 1 Reliability Engineering at Microsoft. John led the development of the Azure Data Explorer and Microsoft Authentication Library Go SDKs. Previously, he was a Staff Site Reliability Engineer at Google. As part of network engineering, he created many of their first network automation systems. John led the migration of that group from Python to Go, developing Go training classes that have been taught around the world. He was a pivotal figure in transforming the network team to a network/systems group that integrated with SRE. Prior to that, he worked for Lucasfilm in video games and film. You can find his musings on Go/SRE topics and his Go classes on the web.
**David Justice**
is the principal software engineer lead for the Azure K8s infrastructure and Steel Thread teams, which maintain a variety of CNCF and Bytecode Alliance projects. He is a maintainer of the Cluster API Provider Azure and a contributor to the Cluster API. Prior to that, David was the technical assistant to the Azure CTO, where he was responsible for Azure cross-group technical strategy and architecture. Early on at Microsoft, he was a program manager leading Azure SDKs and CLIs, where he transitioned all Azure services to describe them using OpenAPI specifications in GitHub and established automations to generate Azure reference docs, SDKs, and CLIs. Prior to working at Microsoft, David was the CTO of a mobile CI/CD SaaS called CISimple.
### Download a free PDF
<i>If you have already purchased a print or Kindle version of this book, you can get a DRM-free PDF version at no cost.<br>Simply click on the link to claim your free PDF.</i>
<p align="center"> <a href="https://packt.link/free-ebook/9781801818896">https://packt.link/free-ebook/9781801818896 </a> </p>
================================================
FILE: chapter/10/.github/release.yml
================================================
changelog:
exclude:
labels:
- ignore-for-release
categories:
- title: Breaking Changes 🛠
labels:
- breaking-change
- title: New Features 🎉
labels:
- enhancement
- title: Bug Fixes 🐛
labels:
- bug-fix
- title: Other Changes
labels:
- "*"
================================================
FILE: chapter/10/.github/workflows/action-version.yaml
================================================
name: Release new tweeter version
on:
release:
types: [released]
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true
permissions:
contents: write
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@v0.1.0
with:
source-tag: ${{ env.TAG_NAME }}
================================================
FILE: chapter/10/.github/workflows/first.yaml
================================================
name: first-workflow
on: workflow_dispatch
jobs:
echo:
runs-on: ubuntu-latest
steps:
- name: echo step
run: echo 'Hello World!'
================================================
FILE: chapter/10/.github/workflows/image-release.yaml
================================================
name: release image
on:
push:
tags:
- 'image-v*' # push events for tags matching image-v for version (image-v1.0, etc)
permissions:
contents: read
packages: write
jobs:
image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set env
run: echo "RELEASE_VERSION=${GITHUB_REF:17}" >> $GITHUB_ENV # refs/tags/image-v1.0.0 substring starting at 1.0.0
- name: setup buildx
uses: docker/setup-buildx-action@v1
- name: login to GitHub container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: build and push
uses: docker/build-push-action@v2
with:
push: true
tags: |
ghcr.io/PacktPublishing/tweeter:${{ env.RELEASE_VERSION }}
ghcr.io/PacktPublishing/tweeter:latest
================================================
FILE: chapter/10/.github/workflows/tweeter-automation.yaml
================================================
name: tweeter-automation
on:
push:
tags:
- 'v[0-9]+.[0-9]+.*'
branches:
- main
pull_request:
branches:
- main
jobs:
test:
permissions:
contents: read
strategy:
matrix:
go-version: [ 1.16.x, 1.17.x ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: install go
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- uses: actions/checkout@v2
- name: lint with golangci-lint
uses: golangci/golangci-lint-action@v2
- name: run go test
run: go test ./...
test-action:
permissions:
contents: read
packages: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# TODO: when the repo is open sourced, remove the login and open the image to the public
- name: login to GitHub container registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- run: docker pull ghcr.io/PacktPublishing/tweeter:1.0.0
- name: test the tweeter action in DRY_RUN
id: tweeterAction
env:
DRY_RUN: true
uses: ./
with:
message: hello world!
accessToken: fake
accessTokenSecret: fake
apiKey: fake
apiKeySecret: fake
- run: echo ${{ steps.tweeterAction.outputs.sentMessage }} from dry run test
release:
permissions:
contents: write
needs: test
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set RELEASE_VERSION ENV var
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV
- uses: actions/setup-go@v2
with:
go-version: 1.17.x
- name: install gox
run: go install github.com/mitchellh/gox@v1.0.1
- name: build cross-platform binaries
env:
PLATFORMS: darwin/amd64 darwin/arm64 windows/amd64 linux/amd64 linux/arm64
VERSION_INJECT: github.com/PacktPublishing/Go-for-DevOps/chapter/10/pkg/tweeter.Version
OUTPUT_PATH_FORMAT: ./bin/${{ env.RELEASE_VERSION }}/{{.OS}}/{{.Arch}}/tweeter
run: |
gox -osarch="${PLATFORMS}" -ldflags "-X ${VERSION_INJECT}=${RELEASE_VERSION}" -output "${OUTPUT_PATH_FORMAT}"
- name: generate release notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh api -X POST 'repos/{owner}/{repo}/releases/generate-notes' \
-F commitish=${{ env.RELEASE_VERSION }} \
-F tag_name=${{ env.RELEASE_VERSION }} \
> tmp-release-notes.json
- name: gzip the bins
env:
OUT_BASE: ./bin/${{ env.RELEASE_VERSION }}
run: |
tar -czvf "${OUT_BASE}/darwin/amd64/tweeter_darwin_amd64.tar.gz" -C "${OUT_BASE}/darwin/amd64" tweeter
tar -czvf "${OUT_BASE}/darwin/arm64/tweeter_darwin_arm64.tar.gz" -C "${OUT_BASE}/darwin/arm64" tweeter
tar -czvf "${OUT_BASE}/windows/amd64/tweeter_windows_amd64.tar.gz" -C "${OUT_BASE}/windows/amd64" tweeter.exe
tar -czvf "${OUT_BASE}/linux/amd64/tweeter_linux_amd64.tar.gz" -C "${OUT_BASE}/linux/amd64" tweeter
tar -czvf "${OUT_BASE}/linux/arm64/tweeter_linux_arm64.tar.gz" -C "${OUT_BASE}/linux/arm64" tweeter
- name: create release
env:
OUT_BASE: ./bin/${{ env.RELEASE_VERSION }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
jq -r .body tmp-release-notes.json > tmp-release-notes.md
gh release create ${{ env.RELEASE_VERSION }} \
-t "$(jq -r .name tmp-release-notes.json)" \
-F tmp-release-notes.md \
"${OUT_BASE}/darwin/amd64/tweeter_darwin_amd64.tar.gz#tweeter_osx_amd64" \
"${OUT_BASE}/darwin/arm64/tweeter_darwin_arm64.tar.gz#tweeter_osx_arm64" \
"${OUT_BASE}/windows/amd64/tweeter_windows_amd64.tar.gz#tweeter_windows_amd64" \
"${OUT_BASE}/linux/amd64/tweeter_linux_amd64.tar.gz#tweeter_linux_amd64" \
"${OUT_BASE}/linux/arm64/tweeter_linux_arm64.tar.gz#tweeter_linux_arm64"
================================================
FILE: chapter/10/.gitignore
================================================
# Binaries for programs and plugins
*.exe
*.exe~
*.dll
*.so
*.dylib
# Test binary, built with `go test -c`
*.test
# Output of the go coverage tool, specifically when used with LiteIDE
*.out
# Dependency directories (remove the comment below to include it)
# vendor/
.idea
================================================
FILE: chapter/10/Dockerfile
================================================
FROM golang:1.17 as builder
WORKDIR /workspace
# Run this with docker build --build_arg $(go env GOPROXY) to override the goproxy
ARG goproxy=https://proxy.golang.org
ENV GOPROXY=$goproxy
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
# Cache deps before building and copying source so that we don't need to re-download as much
# and so that source changes don't invalidate our downloaded layer
RUN go mod download
# Copy the sources
COPY ./ ./
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \
go build -a -ldflags '-extldflags "-static"' \
-o tweeter .
# Copy the action into a thin image
FROM gcr.io/distroless/static:latest
WORKDIR /
COPY --from=builder /workspace/tweeter .
ENTRYPOINT ["/tweeter"]
================================================
FILE: chapter/10/README.md
================================================
# DevOps for Go Tweeter
The tweeter command line tool will send a tweet via Twitter.
## Setup
You can use tweeter to send a tweet or to output the message to STDOUT. If you want to send a tweet, you will need to set up a Twitter application.
### Setup With a Twitter Application
To send a tweet, you will need to create or use an existing Twitter account, create a Twitter application, and generate API credentials. All of this can be done through the
[Twitter Developer Portal](https://developer.twitter.com/en/portal/projects-and-apps).
### Setup Without a Twitter Application
Some people may not want to set up a Twitter account. If you would like to use tweeter without sending tweets, use the `--dry-run` argument. This will cause the tool to write the message to STDOUT rather than sending the message to Twitter.
## Inputs
- `--message` **Required** the tweet message you would like to send
- `--apiKey` the API key under Consumer Keys in the [Twitter developer portal](https://developer.twitter.com/en/portal/projects-and-apps)
- `--apiKeySecret` the API key secret under Consumer Keys in the [Twitter developer portal](https://developer.twitter.com/en/portal/projects-and-apps)
- `--accessToken` the access token under Authentication Tokens in the [Twitter developer portal](https://developer.twitter.com/en/portal/projects-and-apps)
- `--accessTokenSecret` the access token secret under Authentications Tokens in the [Twitter developer portal](https://developer.twitter.com/en/portal/projects-and-apps)
- `--dryRun` will skip authentication validation and sending the message to Twitter
## Test
```
$ go test ./...
? github.com/devopsforgo/github-actions [no test files]
ok github.com/devopsforgo/github-actions/pkg/tweeter 0.002s
```
## Run Help
To see the command line arguments and descriptions, display the help.
```
$ go run . -h
Usage of /tmp/go-build3731631588/b001/exe/github-actions:
--accessToken string twitter access token
--accessTokenSecret string twitter access token secret
--apiKey string twitter api key
--apiKeySecret string twitter api key secret
--dryRun if true, then a tweet will not be sent
--message string message you'd like to send to twitter
pflag: help requested
exit status 2
```
## Run Without Sending a Tweet
The `--dryRun` argument will skip validation of the authentication arguments and output the message to STDOUT.
```
$ go run . --dryRun --message foo
```
## Run Sending a Tweet
Without `--dryRun` specified, tweeter will send the `--messsage` argument as a Tweet.
```
$ go run . --message foo --apiKey 123 --apiKeySecret secret --accessToken token --accessTokenSecret secret
```
================================================
FILE: chapter/10/action.yaml
================================================
name: Tweeter Action
author: DevOps for Go
description: Simple action to send a tweet via an GitHub Action.
inputs:
message:
description: 'message you want to tweet'
required: true
apiKey:
description: 'api key for Twitter api'
required: true
apiKeySecret:
description: 'api key secret for Twitter api'
required: true
accessToken:
description: 'access token for Twitter api'
required: true
accessTokenSecret:
description: 'access token secret for Twitter api'
required: true
outputs:
errorMessage:
description: 'if something went wrong, the error message'
sentMessage:
description: 'message sent to Twitter'
runs:
using: docker
image: docker://ghcr.io/PacktPublishing/tweeter:1.0.0
args:
- --message
- "${{ inputs.message }}"
- --apiKey
- ${{ inputs.apiKey }}
- --apiKeySecret
- ${{ inputs.apiKeySecret }}
- --accessToken
- ${{ inputs.accessToken }}
- --accessTokenSecret
- ${{ inputs.accessTokenSecret }}
================================================
FILE: chapter/10/go.mod
================================================
module github.com/PacktPublishing/Go-for-DevOps/chapter/10
go 1.17
require (
github.com/dghubble/go-twitter v0.0.0-20210609183100-2fdbf421508e
github.com/dghubble/oauth1 v0.7.0
github.com/hashicorp/go-multierror v1.1.1
github.com/pkg/errors v0.9.1
github.com/spf13/pflag v1.0.5
)
require (
github.com/cenkalti/backoff v2.1.1+incompatible // indirect
github.com/dghubble/sling v1.3.0 // indirect
github.com/google/go-querystring v1.0.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect
)
================================================
FILE: chapter/10/go.sum
================================================
github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=
github.com/cenkalti/backoff v2.1.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dghubble/go-twitter v0.0.0-20210609183100-2fdbf421508e h1:o0sI/cfhAXdtAbiIVeTd4hmwtwgs4cQFwRBhmbx8AKY=
github.com/dghubble/go-twitter v0.0.0-20210609183100-2fdbf421508e/go.mod h1:xfg4uS5LEzOj8PgZV7SQYRHbG7jPUnelEiaAVJxmhJE=
github.com/dghubble/oauth1 v0.7.0 h1:AlpZdbRiJM4XGHIlQ8BuJ/wlpGwFEJNnB4Mc+78tA/w=
github.com/dghubble/oauth1 v0.7.0/go.mod h1:8pFdfPkv/jr8mkChVbNVuJ0suiHe278BtWI4Tk1ujxk=
github.com/dghubble/sling v1.3.0 h1:pZHjCJq4zJvc6qVQ5wN1jo5oNZlNE0+8T/h0XeXBUKU=
github.com/dghubble/sling v1.3.0/go.mod h1:XXShWaBWKzNLhu2OxikSNFrlsvowtz4kyRuXUG7oQKY=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
================================================
FILE: chapter/10/main.go
================================================
package main
import (
"fmt"
"os"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
flag "github.com/spf13/pflag"
"github.com/PacktPublishing/Go-for-DevOps/chapter/10/pkg/tweeter"
)
var (
message, apiKey, apiKeySecret, accessToken, accessTokenSecret string
dryRun, versionFlag bool
)
func main() {
parseAndValidateInput()
if versionFlag {
printVersion()
return
}
if dryRun {
printOutput("sentMessage", message)
return
}
tweeterClient, err := tweeter.New(tweeter.Config{
ApiKey: apiKey,
ApiKeySecret: apiKeySecret,
AccessToken: accessToken,
AccessTokenSecret: accessTokenSecret,
})
if err != nil {
err = errors.Wrap(err, "failed creating tweeter client")
printOutput("errorMessage", err.Error())
os.Exit(1)
}
// send the tweet
if err := tweeterClient.Tweet(message); err != nil {
err = errors.Wrap(err, "status update error")
printOutput("errorMessage", err.Error())
os.Exit(1)
}
printOutput("sentMessage", message)
}
func parseAndValidateInput() {
flag.StringVar(&message, "message", "", "message you'd like to send to twitter")
flag.StringVar(&apiKey, "apiKey", "", "twitter api key")
flag.StringVar(&apiKeySecret, "apiKeySecret", "", "twitter api key secret")
flag.StringVar(&accessToken, "accessToken", "", "twitter access token")
flag.StringVar(&accessTokenSecret, "accessTokenSecret", "", "twitter access token secret")
flag.BoolVar(&dryRun, "dryRun", false, "if true or if env var DRY_RUN=true, then a tweet will not be sent")
flag.BoolVar(&versionFlag, "version", false, "output the version of tweeter")
flag.Parse()
if os.Getenv("DRY_RUN") == "true" {
dryRun = true
}
if versionFlag {
return
}
var err error
if message == "" {
err = multierror.Append(err, errors.New("--message can't be empty"))
}
if !dryRun {
if apiKey == "" {
err = multierror.Append(err, errors.New("--apiKey can't be empty"))
}
if apiKeySecret == "" {
err = multierror.Append(err, errors.New("--apiKeySecret can't be empty"))
}
if accessToken == "" {
err = multierror.Append(err, errors.New("--accessToken can't be empty"))
}
if accessTokenSecret == "" {
err = multierror.Append(err, errors.New("--accessTokenSecret can't be empty"))
}
}
if err != nil {
_, _ = fmt.Fprint(os.Stderr, err.Error())
os.Exit(1)
}
}
func printVersion() {
versionStr := "dirty"
if tweeter.Version != "" {
versionStr = tweeter.Version
}
fmt.Printf("tweeter version: %s", versionStr)
}
func printOutput(key, message string) {
fmt.Printf("::set-output name=%s::%s\n", key, message)
}
================================================
FILE: chapter/10/pkg/tweeter/tweeter.go
================================================
package tweeter
import (
"github.com/dghubble/go-twitter/twitter"
"github.com/dghubble/oauth1"
"github.com/hashicorp/go-multierror"
"github.com/pkg/errors"
)
var (
// Version is the git reference injected at build
Version string
)
type (
// Config is the authentication params needed to construct a tweeter.Client
Config struct {
ApiKey string
ApiKeySecret string
AccessToken string
AccessTokenSecret string
}
// Client sends tweets to Twitter
Client struct {
twitterClient *twitter.Client
}
)
// Validate will check the Config to ensure its field values are valid
func (cfg Config) Validate() error {
var err error
if cfg.ApiKey == "" {
err = multierror.Append(err, errors.New("ApiKey is required"))
}
if cfg.ApiKeySecret == "" {
err = multierror.Append(err, errors.New("ApiKeySecret is required"))
}
if cfg.AccessToken == "" {
err = multierror.Append(err, errors.New("AccessToken is required"))
}
if cfg.AccessTokenSecret == "" {
err = multierror.Append(err, errors.New("AccessTokenSecret is required"))
}
return err
}
// New creates a new instance of the tweeter.Client ready to send tweets
func New(cfg Config) (*Client, error) {
if err := cfg.Validate(); err != nil {
return nil, errors.Wrap(err, "failed to validate tweeter config")
}
var (
oauthCfg = oauth1.NewConfig(cfg.ApiKey, cfg.ApiKeySecret)
token = oauth1.NewToken(cfg.AccessToken, cfg.AccessTokenSecret)
httpClient = oauthCfg.Client(oauth1.NoContext, token)
)
return &Client{
twitterClient: twitter.NewClient(httpClient),
}, nil
}
// Tweet sends a tweet
func (c *Client) Tweet(message string) error {
_, _, err := c.twitterClient.Statuses.Update(message, nil)
return errors.Wrap(err, "failed to send tweet")
}
================================================
FILE: chapter/10/pkg/tweeter/tweeter_test.go
================================================
package tweeter_test
import (
"strings"
"testing"
"github.com/PacktPublishing/Go-for-DevOps/chapter/10/pkg/tweeter"
)
func TestNew(t *testing.T) {
subject, err := tweeter.New(tweeter.Config{
ApiKey: "apiKey",
ApiKeySecret: "apiKeySecret",
AccessToken: "accessToken",
AccessTokenSecret: "accessTokenSecret",
})
if err != nil {
t.Error(err, "config should be valid")
}
if subject == nil {
t.Error("subject should not be nil")
}
}
func TestConfig_Validate(t *testing.T) {
testCases := []struct {
Name string
Cfg tweeter.Config
Expect func(t *testing.T, err error)
}{
{
Name: "All keys are filled",
Cfg: tweeter.Config{
ApiKey: "apiKey",
ApiKeySecret: "apiKeySecret",
AccessToken: "accessToken",
AccessTokenSecret: "accessTokenSecret",
},
Expect: func(t *testing.T, err error) {
if err != nil {
t.Error(err, "error should be nil")
}
},
},
{
Name: "ApiKey is empty",
Cfg: tweeter.Config{
ApiKey: "",
ApiKeySecret: "apiKeySecret",
AccessToken: "accessToken",
AccessTokenSecret: "accessTokenSecret",
},
Expect: func(t *testing.T, err error) {
if err == nil {
t.Error("error should be non-nil")
}
if !strings.Contains(err.Error(), "ApiKey is required") {
t.Error(err.Error(), "should contain 'ApiKey is required'")
}
},
},
{
Name: "ApiKeySecret is empty",
Cfg: tweeter.Config{
ApiKey: "apiKey",
ApiKeySecret: "",
AccessToken: "accessToken",
AccessTokenSecret: "accessTokenSecret",
},
Expect: func(t *testing.T, err error) {
if err == nil {
t.Error("error should be non-nil")
}
if !strings.Contains(err.Error(), "ApiKeySecret is required") {
t.Error(err.Error(), "should contain 'ApiKeySecret is required'")
}
},
},
{
Name: "AccessToken is empty",
Cfg: tweeter.Config{
ApiKey: "apiKey",
ApiKeySecret: "apiKeySecret",
AccessToken: "",
AccessTokenSecret: "accessTokenSecret",
},
Expect: func(t *testing.T, err error) {
if err == nil {
t.Error("error should be non-nil")
}
if !strings.Contains(err.Error(), "AccessToken is required") {
t.Error(err.Error(), "should contain 'AccessToken is required'")
}
},
},
{
Name: "AccessTokenSecret is empty",
Cfg: tweeter.Config{
ApiKey: "apiKey",
ApiKeySecret: "apiKeySecret",
AccessToken: "accessToken",
AccessTokenSecret: "",
},
Expect: func(t *testing.T, err error) {
if err == nil {
t.Error("error should be non-nil")
}
if !strings.Contains(err.Error(), "AccessTokenSecret is required") {
t.Error(err.Error(), "should contain 'AccessTokenSecret is required'")
}
},
},
{
Name: "ApiKey and AccessTokenSecret are empty",
Cfg: tweeter.Config{
ApiKey: "",
ApiKeySecret: "apiKeySecret",
AccessToken: "accessToken",
AccessTokenSecret: "",
},
Expect: func(t *testing.T, err error) {
if err == nil {
t.Error("error should be non-nil")
}
if !strings.Contains(err.Error(), "AccessTokenSecret is required") ||
!strings.Contains(err.Error(), "ApiKey is required") {
t.Error(err.Error(), "should contain 'AccessTokenSecret is required' and 'ApiKey is required'")
}
},
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.Name, func(t *testing.T) {
tc.Expect(t, tc.Cfg.Validate())
})
}
}
================================================
FILE: chapter/11/Dockerfile
================================================
FROM golang:1.17
COPY . /usr/src/server
WORKDIR /usr/src/server
RUN go env -w GOPROXY=direct GO111MODULE=on
RUN go mod init github.com/PacktPublishing/Go-for-DevOps/chapter/11
RUN go mod tidy
WORKDIR /usr/src/server/ops
RUN go install
CMD ["/go/bin/ops", "--jaegerAddr=jaeger-all-in-one:16685", "--promAddr=prometheus:9000", "--petstoreAddr=petstore:6742"]
================================================
FILE: chapter/11/README.md
================================================
# ChatOps Demonstration
This directory contains:
* A ChatOps service for Slack
* An traceable and metricized Petstore CRUD service
* Jaeger for Trace storage
* Prometheus for Metric storage
## Turnup the demo
In this directory, use the following command:
```bash
docker-compose up -d
```
In a another terminal enter the following directory:
```
chapter/11/chatops/
```
Create a `.env` file with the following content:
```bash
AUTH_TOKEN=xoxb-[the rest of the token]
APP_TOKEN=xapp-[the rest of the token]
```
These were generated when we setup the Slack app. Please see chapter 11 for more details on generating these.
Run the bot with:
```bash
go run chatbotops.go
```
In the background, there is a demo client that is adding pets to the petstore and doing searches for pets (some searches will cause errors). The service is set to Float sampling, so not every call will generate a trace.
In another terminal, you can interact with the petstore by using the CLI application. This will let you add your own pets, delete pets, search for pets with a filter. That client can be found here: chapter/11/petstore/client/cli/petstore. You can find instructions on its use by running the following:
```bash
go run petstore.go --help
```
## Turndown the demo
This consists of:
* Cancelling the running chatbot.go binary
* Running `docker-compose down` in this directory
================================================
FILE: chapter/11/chatbot/.gitignore
================================================
.env
================================================
FILE: chapter/11/chatbot/bot/bot.go
================================================
// Package bot defines a basic slack bot that can listen for app mention events for our bot
// and send the message to a handler to handle the interaction.
package bot
import (
"context"
"encoding/json"
"fmt"
"log"
"regexp"
"strings"
"github.com/slack-go/slack"
"github.com/slack-go/slack/slackevents"
"github.com/slack-go/slack/socketmode"
)
// HandleFunc receive the user who sent a message and the message. It can then use api or client to respond to said message.
type HandleFunc func(ctx context.Context, m Message)
// Message details information about a message that was sent in an AppMention event.
type Message struct {
// User has the user information on who mentioned the bot.
User *slack.User
// AppMention gives information on the event.
AppMention *slackevents.AppMentionEvent
// Text gives the text of the message without the @User stuff. If you want the full message, see AppMention.
Text string
}
type register struct {
r *regexp.Regexp
h HandleFunc
}
// Bot provides a slack bot for listening to slack channels.
type Bot struct {
api *slack.Client
client *socketmode.Client
ctx context.Context
cancel context.CancelFunc
defaultHandler HandleFunc
reg []register
}
// New creates a new Bot.
func New(api *slack.Client, client *socketmode.Client) (*Bot, error) {
ctx, cancel := context.WithCancel(context.Background())
b := &Bot{
api: api,
client: client,
ctx: ctx,
cancel: cancel,
}
return b, nil
}
// Start starts listening for events from the socket client. This blocks until the client dies
// or Stop() is called.
func (b *Bot) Start() {
go b.loop()
b.client.RunContext(b.ctx)
}
// Stop stops the bot. The bot cannot be reused after this.
func (b *Bot) Stop() {
b.cancel()
}
// Register registers a function for handling a message to the bot. The regex is checked in the order
// that it is added. A nil regexp is considered the default handler. Only 1 default handler can be added and
// is always the choice of last resort.
func (b *Bot) Register(r *regexp.Regexp, h HandleFunc) {
if h == nil {
panic("HandleFunc cannot be nil")
}
if r == nil {
if b.defaultHandler != nil {
panic("cannot add two default handles")
}
b.defaultHandler = h
return
}
b.reg = append(b.reg, register{r, h})
}
// loop is the event loop.
func (b *Bot) loop() {
for {
ctx := context.Background()
select {
case <-b.ctx.Done():
return
case evt := <-b.client.Events:
switch evt.Type {
case socketmode.EventTypeConnecting, socketmode.EventTypeConnected:
case socketmode.EventTypeConnectionError:
log.Println("connection failed. Retrying later...")
case socketmode.EventTypeEventsAPI:
data, ok := evt.Data.(slackevents.EventsAPIEvent)
if !ok {
log.Printf("bug: got %T which should be a slackevents.EventsAPIEvent", evt.Data)
continue
}
b.client.Ack(*evt.Request)
go b.appMentioned(ctx, data)
}
}
}
}
// appMentioned handles an event socketmode.EventTypeEventsAPI that had a .Data that is a slackevents.EventsAPIEvent that eventually
// is a AppMentionEvent. This has a crazy amount of freaking event wrapping.
func (b *Bot) appMentioned(ctx context.Context, data slackevents.EventsAPIEvent) {
switch data.Type {
case slackevents.CallbackEvent:
callback := data.Data.(*slackevents.EventsAPICallbackEvent)
switch ev := data.InnerEvent.Data.(type) {
case *slackevents.AppMentionEvent:
if ev.BotID != "" {
_, _, err := b.api.PostMessage(ev.Channel, slack.MsgOptionText("I don't talk to other bots", false))
if err != nil {
log.Printf("failed posting message: %v", err)
}
return
}
msg, err := b.makeMsg(callback, ev)
if err != nil {
log.Println(err)
return
}
for _, reg := range b.reg {
if reg.r.MatchString(msg.Text) {
reg.h(ctx, msg)
return
}
}
if b.defaultHandler != nil {
b.defaultHandler(ctx, msg)
}
}
default:
b.client.Debugf("unsupported Events API event received")
}
}
// makeMsg extracts the user and text from an event and callback into a Message type.
func (b *Bot) makeMsg(callback *slackevents.EventsAPICallbackEvent, event *slackevents.AppMentionEvent) (Message, error) {
user, err := b.api.GetUserInfo(event.User)
if err != nil {
return Message{}, fmt.Errorf("could not get user data: %w", err)
}
rm := rawMessage{}
if err := json.Unmarshal(*callback.InnerEvent, &rm); err != nil {
return Message{}, fmt.Errorf("bot received a callback with no InnerEvent: %w", err)
}
return Message{User: user, AppMention: event, Text: rm.getText()}, nil
}
// rawMessage is used to covert a slackevents.EventsAPICallbackEvent.InnerEvent, which is the raw JSON, into
// a form in which I can abstract the message sent by the user without things like @user in it. This is
// not carried into the exposed Go type and I want to use Slack's pre-filtering instead of doing it myself.
type rawMessage struct {
Blocks []interface{}
}
// getText gets the text without all the extra @user stuff.
func (r rawMessage) getText() string {
for _, block := range r.Blocks {
blockReal := block.(map[string]interface{})
if blockReal["type"] != "rich_text" {
continue
}
elements := blockReal["elements"].([]interface{})
for _, el := range elements {
elReal := el.(map[string]interface{})
if elReal["type"].(string) != "rich_text_section" {
continue
}
subElements := elReal["elements"].([]interface{})
for _, subEl := range subElements {
subElReal := subEl.(map[string]interface{})
if subElReal["type"] != "text" {
continue
}
return strings.TrimSpace(subElReal["text"].(string))
}
}
}
return ""
}
================================================
FILE: chapter/11/chatbot/chatbot.go
================================================
package main
import (
"flag"
"log"
"os"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/chatbot/bot"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/chatbot/internal/handlers"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/client"
"github.com/joho/godotenv"
"github.com/slack-go/slack"
"github.com/slack-go/slack/socketmode"
)
var (
opsAddr = flag.String("opsAddr", "127.0.0.1:7000", "The address the Ops service runs on.")
debug = flag.Bool("debug", false, "If turned on will log debug information to the screen.")
)
func main() {
flag.Parse()
err := godotenv.Load()
if err != nil {
panic("could not load .env file")
}
api := slack.New(
os.Getenv("AUTH_TOKEN"),
slack.OptionAppLevelToken(os.Getenv("APP_TOKEN")),
slack.OptionDebug(*debug),
)
smClient := socketmode.New(
api,
socketmode.OptionDebug(*debug),
socketmode.OptionLog(
log.New(
os.Stdout,
"socketmode: ",
log.Lshortfile|log.LstdFlags,
),
),
)
opsClient, err := client.New(*opsAddr)
if err != nil {
panic(err)
}
b, err := bot.New(api, smClient)
if err != nil {
panic(err)
}
h := handlers.Ops{OpsClient: opsClient, API: api, SMClient: smClient}
h.Register(b)
log.Println("Bot started")
b.Start()
panic("Bot stopped functioning")
}
================================================
FILE: chapter/11/chatbot/internal/handlers/handlers.go
================================================
// Package handlers provides an Ops type that has methods that implement bot.HandleFunc for various commands that could be sent to a bot.
package handlers
import (
"context"
"errors"
"fmt"
"log"
"regexp"
"sort"
"strconv"
"strings"
"time"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/chatbot/bot"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/client"
"github.com/olekukonko/tablewriter"
"github.com/slack-go/slack"
"github.com/slack-go/slack/socketmode"
pb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto"
)
// Ops provides bot.HandleFunc methods that can reuse the connections to the Ops service.
type Ops struct {
OpsClient *client.Ops
API *slack.Client
SMClient *socketmode.Client
}
// write writes a formatted string to the event output in the bot.Message.
func (o Ops) write(m bot.Message, s string, i ...interface{}) error {
_, _, err := o.API.PostMessage(
m.AppMention.Channel,
slack.MsgOptionText(fmt.Sprintf(s, i...), false),
)
return err
}
// Register registers all the commands held in Ops with the bot.
func (o Ops) Register(b *bot.Bot) {
b.Register(regexp.MustCompile(`^\s*help`), o.Help)
b.Register(regexp.MustCompile(`^\s*list traces`), o.ListTraces)
b.Register(regexp.MustCompile(`^\s*show trace`), o.ShowTrace)
b.Register(regexp.MustCompile(`^\s*change sampling`), o.ChangeSampling)
b.Register(regexp.MustCompile(`^\s*show logs`), o.ShowLogs)
b.Register(nil, o.lastResort)
}
// opt stores the key/value pair for an option to a command.
type opt struct {
key string
val string
}
// listTracesRE teases the options from a `list traces` command.
var listTracesRE = regexp.MustCompile(`(\S+)=(?:(\S+))`)
// ListTraces lists all the traces requested in a table that is output to the user.
func (o Ops) ListTraces(ctx context.Context, m bot.Message) {
sp := strings.Split(m.Text, "list traces")
if len(sp) != 2 {
o.write(m, "The 'list traces' command is malformed")
return
}
t := strings.TrimSpace(sp[1])
kvOpts := []opt{}
for _, match := range listTracesRE.FindAllStringSubmatch(t, -1) {
kvOpts = append(kvOpts, opt{strings.TrimSpace(match[1]), strings.TrimSpace(match[2])})
}
options := []client.CallOption{}
for _, opt := range kvOpts {
switch opt.key {
case "operation":
options = append(options, client.WithOperation(opt.val))
case "start":
t, err := time.Parse(`01/02/2006-15:04:05`, opt.val)
if err != nil {
o.write(m, "The start option must be in the form `01/02/2006-15:04:05` for UTC")
return
}
options = append(options, client.WithStart(t))
case "end":
if opt.val == "now" {
continue
}
t, err := time.Parse(`01/02/2006-15:04:05`, opt.val)
if err != nil {
o.write(m, "The end option must be in the form `01/02/2006-15:04:05` for UTC")
return
}
options = append(options, client.WithEnd(t))
case "limit":
i, err := strconv.Atoi(opt.val)
if err != nil {
o.write(m, "The limit option must be an integer")
return
}
if i > 100 {
o.write(m, "Cannot request more than 100 traces")
return
}
options = append(options, client.WithLimit(int32(i)))
case "tags":
tags, err := convertList(opt.val)
if err != nil {
o.write(m, "tags: must enclosed in [], like tags=[tag,tag2]")
return
}
options = append(options, client.WithLabels(tags))
default:
o.write(m, "don't understand an option type(%s)", opt.key)
return
}
}
traces, err := o.OpsClient.ListTraces(ctx, options...)
if err != nil {
o.write(m, "Ops server had an error: %s", err)
return
}
b := strings.Builder{}
b.WriteString("Here are the traces you requested:\n")
table := tablewriter.NewWriter(&b)
table.SetHeader([]string{"Start Time(UTC)", "Trace ID"})
for _, item := range traces {
table.Append(
[]string{
item.Start.Format("01/02/2006 04:05"),
"http://127.0.0.1:16686/trace/" + item.ID,
},
)
}
table.Render()
o.write(m, b.String())
}
// ShowTrace gives the URL to a trace ID.
func (o Ops) ShowTrace(ctx context.Context, m bot.Message) {
sp := strings.Split(m.Text, "show trace")
if len(sp) != 2 {
o.write(m, `show trace command should be in form: show trace <id>`)
return
}
id := strings.TrimSpace(sp[1])
trace, err := o.OpsClient.ShowTrace(ctx, id)
if err != nil {
o.write(m, "Ops server had an error: %s", err)
return
}
b := strings.Builder{}
table := tablewriter.NewWriter(&b)
b.WriteString("Here is some basic trace data:\n")
table.Append([]string{"ID", trace.Id})
table.Append([]string{"Duration", trace.Duration.AsDuration().String()})
table.Append([]string{"Jaeger URL", "http://127.0.0.1:16686/trace/" + trace.Id})
if len(trace.Errors) > 0 {
table.Append([]string{"Had Errors", "true"})
} else {
table.Append([]string{"Had Errors", "false"})
}
table.Render()
b.WriteString("\n")
if len(trace.Errors) > 0 {
table = tablewriter.NewWriter(&b)
b.WriteString("Here are the errors from the trace:\n")
for _, err := range trace.Errors {
table.Append([]string{err})
}
table.Render()
b.WriteString("\n")
}
b.WriteString("Here are the operations in the trace:\n")
table = tablewriter.NewWriter(&b)
for _, op := range trace.Operations {
table.Append([]string{op})
}
table.Render()
b.WriteString("\n")
o.write(m, "%s,\nHere is the trace info you requested:\n\n%s", m.User.Name, b.String())
}
// ShowLogs outputs the logs given a trace ID.
func (o Ops) ShowLogs(ctx context.Context, m bot.Message) {
sp := strings.Split(m.Text, "show logs")
if len(sp) != 2 {
o.write(m, `show logs command should be in form: show logs <id>`)
return
}
id := strings.TrimSpace(sp[1])
log.Println("show logs id==", id)
logs, err := o.OpsClient.ShowLogs(ctx, id)
if err != nil {
o.write(m, "Ops server had an error: %s", err)
return
}
b := strings.Builder{}
n := time.Now().UTC()
for _, l := range logs {
var t string
if l.Time.Year() == n.Year() && l.Time.Month() == n.Month() && l.Time.Day() == n.Day() {
t = l.Time.Format(`15:04:05`)
} else {
t = l.Time.Format(`a01/02/2006 15:04:05`)
}
b.WriteString(fmt.Sprintf("%s: %s: %s\n", t, l.Key, l.Value))
}
o.write(m, "%s,\nHere are the logs you requested for trace %s:\n\n%s", m.User.Name, id, b.String())
}
var sampleTypeRE = regexp.MustCompile(`^\s*(never|always|float)`)
// ChangeSampling changes the sampling type/rate on the server.
func (o Ops) ChangeSampling(ctx context.Context, m bot.Message) {
sp := strings.Split(m.Text, "change sampling")
if len(sp) != 2 {
o.write(m, `change sampling command should be in form: change sampling <type> <options>`)
return
}
t := strings.TrimSpace((sp[1]))
sub := sampleTypeRE.FindStringSubmatch(t)
if len(sub) == 0 {
o.write(m, `I don't have support for the samplling type you requested, sorry...`)
return
}
req := &pb.ChangeSamplingReq{}
switch sub[1] {
case "never":
req.Type = pb.SamplerType_STNever
case "always":
req.Type = pb.SamplerType_STAlways
case "float":
req.Type = pb.SamplerType_STFloat
sp := strings.Split(t, "float")
if len(sp) != 2 {
o.write(m, `'change sampling float' must be followed by a float that is > 0 and <= 1`)
return
}
f, err := strconv.ParseFloat(strings.TrimSpace(sp[1]), 64)
if err != nil {
o.write(m, `'change sampling float' had an invalid float option: %q`, strings.TrimSpace(sp[1]))
return
}
if f <= 0 || f > 1 {
o.write(m, `'change sampling float' must be followed by a float that is > 0 and <= 1`)
return
}
req.FloatValue = f
default:
o.write(m, `sorry, I hit a bug, I kinda understand %q, so you need to talk to my creator`, m.Text)
return
}
err := o.OpsClient.ChangeSampling(ctx, req)
if err != nil {
o.write(m, "Ops server gave an error on changing the sampling: %s", err)
return
}
}
var cmdList string
func init() {
cmds := []string{}
for k := range help {
cmds = append(cmds, k)
}
sort.Strings(cmds)
b := strings.Builder{}
for _, cmd := range cmds {
b.WriteString(cmd + "\n")
}
b.WriteString("You can get more help by saying `help <cmd>` with a command from above.\n")
cmdList = b.String()
}
// Help returns help about various commands.
func (o Ops) Help(ctx context.Context, m bot.Message) {
sp := strings.Split(m.Text, "help")
if len(sp) < 2 {
o.write(m, "%s,\nYou have to give me a command you want help with", m.User.Name)
return
}
cmd := strings.TrimSpace(strings.Join(sp[1:], ""))
if cmd == "" {
o.write(m, "Here are all the commands that I can help you with:\n%s", cmdList)
return
}
if v, ok := help[cmd]; ok {
o.write(m, "I can help you waith that:\n%s", v)
return
}
o.write(m, "%s,\nI don't know what %q is to give you help", m.User.Name, cmd)
}
func (o Ops) lastResort(ctx context.Context, m bot.Message) {
o.write(m, "%s,\nI don't have anything that handles what you sent", m.User.Name)
}
func convertList(s string) ([]string, error) {
if string(s[0]) != `[` || string(s[len(s)-1]) != `]` {
return nil, errors.New("must enclosed in [], like [tag,tag2] comma deliminated with no spaces")
}
s = strings.TrimPrefix(s, `[`)
s = strings.TrimSuffix(s, `]`)
sp := strings.Split(s, ",")
tags := []string{}
for _, t := range sp {
tags = append(tags, strings.TrimSpace(t))
}
return tags, nil
}
================================================
FILE: chapter/11/chatbot/internal/handlers/help.go
================================================
package handlers
var help = map[string]string{
"list traces": `
list traces <opt1=val1 op2=val2>
Ex: list traces operation=AddPets() limit=5
list traces returns a list of Open Telemetry traces. Various
options are provided to allow for filtering what traces you see.
Options:
operation
Desc: Filter the traces that include this operation
Ex: operation=server.AddPets()
start
Desc: Filter the trace by when in the past the trace started
Ex: start=01/02/2021-15:04:05
end:
Desc: Filter the trace by when the trace ends
Ex: end=01/02/2021-16:00:00
limit:
Desc: Limit the number of traces returned (default is 20)
Ex: limit=5
tags:
Desc: Only include traces with these tags
Ex: tags=[tag,tag2]
Note: no spaces are allowed in the tag list
`,
"show trace": `
show trace <trace id>
Ex: show trace 17b4f65b0d9f038e2a7bc5ea84309af2
show trace returns information about a particular Open Telemetry trace.
This command has no options.
`,
"change sampling": `
change sampling <type> <required value for type>
Ex: change sampling float .1
Sampling types:
never
Desc: Never sample unless another service or the RPC requests a trace
always
Desc: Sample very incoming RPC
float
Desc: Sample at a specific rate
Required arg:
<float>: Must be > 0 and <= 1
Ex: change sampling float .1
`,
"show logs": `
show logs <trace id>
Ex: show logs 17b4f65b0d9f038e2a7bc5ea84309af2
show logs returns all logs contained in a Open Telemetry trace.
This command has no options.
`,
}
================================================
FILE: chapter/11/chatbot/slack.manifest
================================================
display_information:
name: PetStore
features:
app_home:
home_tab_enabled: true
messages_tab_enabled: false
messages_tab_read_only_enabled: false
bot_user:
display_name: PetStore
always_online: false
oauth_config:
scopes:
bot:
- app_mentions:read
- channels:history
- channels:join
- chat:write
- chat:write.public
- commands
- files:write
- groups:read
- incoming-webhook
- links:write
- usergroups:read
- users.profile:read
- users:read
- chat:write.customize
- im:read
settings:
event_subscriptions:
bot_events:
- app_mention
interactivity:
is_enabled: true
org_deploy_enabled: false
socket_mode_enabled: true
token_rotation_enabled: false
================================================
FILE: chapter/11/docker-compose.yaml
================================================
version: "2"
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
ports:
- "16685:16685" # Query service port
- "16686:16686"
- "14268:14268"
- "14250:14250"
# Collector
otel-collector:
image: ${OTELCOL_IMG}
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "55670:55679" # zpages extension
depends_on:
- jaeger-all-in-one
prometheus:
container_name: prometheus
image: prom/prometheus:latest
volumes:
- ./prometheus.yaml:/etc/prometheus/prometheus.yml
ports:
- "9090:9090"
petstore:
build:
dockerfile: Dockerfile
context: ./petstore
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
ports:
- "6742:6742"
depends_on:
- otel-collector
- prometheus
ops:
build:
dockerfile: Dockerfile
context: ./
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
ports:
- "7000:7000"
depends_on:
- petstore
petstore-client-demo:
build:
dockerfile: ./client/demo/Dockerfile
context: ./petstore
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
depends_on:
- petstore
================================================
FILE: chapter/11/ops/README.md
================================================
# Ops Service
The Ops service provides API access to various operational information that we want to allow various tool access to. While this could be built into the chatbot.go binary that implements the ChatOps interface, this abstraction allows us to have multiple programs that can access these API calls. In addition, if we want to migrate to another chat service instead of Slack (like Microsoft Teams), we can easily do so without impacting users during a migration.
## Basic Architecture
This is your standard gRPC service with a nice Go client ready made to access the service. We stick the important parts in `internal` to keep anyone from using the packages that are just for the service. `proto/` contains the protocol buffer messages we have for the client/server communication.
The file directory layout is as follows (with some highlighted files, but not all files):
```
├── client
│ └── client.go
├── internal
│ ├── jaeger
│ │ └── client
│ │ ├── client.go
│ │ └── test
│ ├── prom
│ │ └── prom.go
│ └── server
│ └── server.go
├── ops.go
└── proto
├── jaeger
│ ├── model
├── ops.pb.go
├── ops.proto
└── ops_grpc.pb.go
```
* `ops.go` is the main file for the Ops service
* `client/ provides` a client library for accessing our Ops service using Go
* `internal/jaeger` provides a client wrapper for accessing Jaeger and some end to end testing
* `internal/prom` provides a client wrapper for accessing prometheus
* `proto/` contains protocol buffer messages and services for accessing the Ops service via gRPC
* `proto/jaeger` provides various protocol buffers required to access Jaeger
================================================
FILE: chapter/11/ops/client/client.go
================================================
package client
import (
"context"
"fmt"
"strconv"
"time"
"google.golang.org/grpc"
pb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto"
mpb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto/jaeger/model"
)
// Ops is a client for interacting with the Ops service.
type Ops struct {
client pb.OpsClient
conn *grpc.ClientConn
}
// New is the constructor for Client. addr is the server's [host]:[port].
func New(addr string) (*Ops, error) {
conn, err := grpc.Dial(addr, grpc.WithInsecure())
if err != nil {
return nil, err
}
return &Ops{
client: pb.NewOpsClient(conn),
conn: conn,
}, nil
}
type callOptions struct {
l *listTracesOpts
a *alertsOpts
}
type listTracesOpts struct {
operation string
tags []string
start time.Time
end time.Time
limit int32
}
type alertsOpts struct {
labels []string
activeAt time.Time
states []string
}
func (l *listTracesOpts) defaults() {
l.limit = 10
l.end = time.Now().Add(5 * time.Second)
}
// CallOption is an option for method.
type CallOption func(o *callOptions) error
// WithStart sets the minimum time a trace had to start in order to be included.
func WithStart(t time.Time) CallOption {
return func(o *callOptions) error {
if o.l == nil {
return fmt.Errorf("WithStart can only be used on ListTraces()")
}
o.l.start = t
return nil
}
}
// Withend sets the maximum time a trace had to start in order to be included.
func WithEnd(t time.Time) CallOption {
return func(o *callOptions) error {
if o.l == nil {
return fmt.Errorf("WithEnd can only be used on ListTraces()")
}
o.l.end = t
return nil
}
}
// WithLimt sets the maximum amount of return values. When using Cassandra, this is
// not a limit, it is some weird value where increasing it can increase how deep
// cassandra searches for traces. In that case, setting 20 might return 10 results
// but setting 100 might return 20.
func WithLimit(i int32) CallOption {
return func(o *callOptions) error {
if o.l == nil {
return fmt.Errorf("WithLimit can only be used on ListTraces()")
}
o.l.limit = i
return nil
}
}
// WithOperation restricts traces to ones that have this operation.
func WithOperation(s string) CallOption {
return func(o *callOptions) error {
if o.l == nil {
return fmt.Errorf("WithOperation can only be used on ListTraces()")
}
o.l.operation = s
return nil
}
}
// WithTags restricts resuts to ones that have all these tags.
func WithTags(tags []string) CallOption {
return func(o *callOptions) error {
if o.l == nil {
return fmt.Errorf("WithTags can only be used on ListTraces()")
}
o.l.tags = tags
return nil
}
}
// TraceItem details information on a trace.
type TraceItem struct {
// ID is the ID of the trace in hex form.
ID string
// Start is the start time of the trace.
Start time.Time
}
// ListTraces lists traces for the Petstore. By default it pulls the latest 10 items.
func (o *Ops) ListTraces(ctx context.Context, options ...CallOption) ([]TraceItem, error) {
opts := callOptions{l: &listTracesOpts{}}
opts.l.defaults()
for _, o := range options {
o(&opts)
}
req := &pb.ListTracesReq{
Service: "petstore",
Operation: opts.l.operation,
Tags: opts.l.tags,
Start: opts.l.start.UnixNano(),
End: opts.l.end.UnixNano(),
SearchDepth: opts.l.limit,
}
resp, err := o.client.ListTraces(ctx, req)
if err != nil {
return nil, err
}
items := make([]TraceItem, 0, len(resp.Traces))
for _, ti := range resp.Traces {
items = append(items, TraceItem{ID: ti.Id, Start: time.Unix(0, ti.Start)})
}
return items, nil
}
type TraceData struct {
ID string
Operations []string
Errors []string
Tags []string
Duration time.Time
}
// ShowTrace returns the Jaeger URL that is going to have the trace.
func (o *Ops) ShowTrace(ctx context.Context, id string) (*pb.ShowTraceResp, error) {
resp, err := o.client.ShowTrace(ctx, &pb.ShowTraceReq{Id: id})
if err != nil {
return nil, err
}
return resp, nil
}
type Log struct {
Time time.Time
Key string
Value string
}
func (o *Ops) ShowLogs(ctx context.Context, id string) ([]Log, error) {
resp, err := o.client.ShowLogs(ctx, &pb.ShowLogsReq{Id: id})
if err != nil {
return nil, err
}
if resp.Id == "" {
return nil, fmt.Errorf("no trace with ID(%s) was found", id)
}
logs := make([]Log, 0, len(resp.Logs))
for _, l := range resp.Logs {
t := l.Timestamp.AsTime().UTC()
var v string
for _, f := range l.Fields {
switch f.VType {
case mpb.ValueType_BINARY:
v = string(f.VBinary)
case mpb.ValueType_BOOL:
if f.VBool {
v = "true"
} else {
v = "false"
}
case mpb.ValueType_FLOAT64:
v = strconv.FormatFloat(f.VFloat64, 'e', 2, 64)
case mpb.ValueType_INT64:
v = strconv.FormatInt(f.VInt64, 10)
case mpb.ValueType_STRING:
v = f.VStr
default:
v = fmt.Sprintf("unsupported type: %T", f.VType)
}
logs = append(logs, Log{Time: t, Key: f.Key, Value: v})
}
}
return logs, nil
}
// ChangeSampling is used to change the sampling rate of the service.
func (o *Ops) ChangeSampling(ctx context.Context, sampler *pb.ChangeSamplingReq) error {
_, err := o.client.ChangeSampling(ctx, sampler)
if err != nil {
return err
}
return nil
}
// DeployedVersion will return the deployed version of the application according
// to Prometheus.
func (o *Ops) DeployedVersion(ctx context.Context) (string, error) {
resp, err := o.client.DeployedVersion(ctx, &pb.DeployedVersionReq{})
if err != nil {
return "", err
}
return resp.Version, nil
}
// WithLabels restricts alerts to ones that have all these labels.
func WithLabels(labels []string) CallOption {
return func(o *callOptions) error {
if o.a == nil {
return fmt.Errorf("WithLabels can only be used on Alerts()")
}
o.a.labels = labels
return nil
}
}
// WithActiveAt restrics alerts to ones from this time to now.
func WithActiveAt(t time.Time) CallOption {
return func(o *callOptions) error {
if o.a == nil {
return fmt.Errorf("WithActiveAt can only be used on Alerts()")
}
o.a.activeAt = t
return nil
}
}
// WithStates restrics alerts to ones that have one of these states.
func WithStates(states []string) CallOption {
return func(o *callOptions) error {
if o.a == nil {
return fmt.Errorf("WithStates can only be used on Alerts()")
}
o.a.states = states
return nil
}
}
// Alert represents a Prometheus alert.
type Alert struct {
// State is the state of the alert.
State string
// Value is the value of the alert.
Value string
// ActiveAt was when the alert started.
ActiveAt time.Time
}
func (a *Alert) fromProto(p *pb.Alert) {
a.State = p.State
a.Value = p.Value
a.ActiveAt = time.Unix(0, p.ActiveAt)
}
// Alerts returns a list of Prometheus alerts that are firing.
func (o *Ops) Alerts(ctx context.Context, options ...CallOption) ([]Alert, error) {
opts := callOptions{a: &alertsOpts{}}
for _, o := range options {
o(&opts)
}
req := &pb.AlertsReq{
Labels: opts.a.labels,
ActiveAt: opts.a.activeAt.UnixNano(),
States: opts.a.states,
}
resp, err := o.client.Alerts(ctx, req)
if err != nil {
return nil, err
}
alerts := make([]Alert, 0, len(resp.Alerts))
for _, p := range resp.Alerts {
a := Alert{}
a.fromProto(p)
alerts = append(alerts, a)
}
return alerts, nil
}
================================================
FILE: chapter/11/ops/internal/jaeger/client/client.go
================================================
// Package client provides a Jaegar client for grabbing traces from the Jaegar service.
// It is a wrapper around the undocumented Jaegar gRPC client.
package client
import (
"context"
"errors"
"fmt"
"io"
"time"
otelTrace "go.opentelemetry.io/otel/trace"
"google.golang.org/grpc"
duration "google.golang.org/protobuf/types/known/durationpb"
timestamp "google.golang.org/protobuf/types/known/timestamppb"
pb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto/jaeger"
mpb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto/jaeger/model"
)
var (
// ErrNotFound indicates that no trace with an ID was found.
ErrNotFound = errors.New("trace with that ID was not found")
)
// Trace represents a OTEL trace that was stored in Jaegar.
type Trace struct {
// ID is the identity of the trace.
ID string
// Spans are the spans that make up the trace.
Spans []Span
// Err indicates if there was a error in the trace stream if the
// Trace is being returned in a channel. If not, this will always be nil.
Err error
}
// Span is a convienence wrapper around *mpb.Span.
type Span struct {
*mpb.Span
}
// Proto returns the encapsulated proto. Remember that these are generated with
// gogo proto and not Google/Buf.build proto engine.
func (s Span) Proto() *mpb.Span {
return s.Span
}
// TraceID returns the converted human readable Trace ID.
func (s Span) TraceID() string {
if len(s.Span.TraceId) < 16 {
return ""
}
// This is a go 1.17 conversion of a slice to an array.
t := (*otelTrace.TraceID)(s.Span.TraceId[0:16])
return t.String()
}
// SpanID returns the converted human readable Span ID.
func (s Span) SpanID() string {
if len(s.Span.SpanId) < 16 {
return ""
}
t := (*otelTrace.SpanID)(s.Span.SpanId[0:16])
return t.String()
}
// Jaeger provides a client for interacting with Jaeger to retrieve traces.
type Jaeger struct {
client pb.QueryServiceClient
conn *grpc.ClientConn
addr string
}
// New creates a new Jaeger client that connects to addr.
func New(addr string) (*Jaeger, error) {
conn, err := grpc.Dial(addr, grpc.WithInsecure())
if err != nil {
return nil, err
}
return &Jaeger{
client: pb.NewQueryServiceClient(conn),
conn: conn,
addr: addr,
}, nil
}
// Addr returns the address of the Jaeger server we are connected to.
func (j *Jaeger) Addr() string {
return j.addr
}
// SearchParams are parameters used to filter a search for trace data.
type SearchParams struct {
// Service is the name of the service you are querying. Required.
Service string
// Operation is the name of the operation you want to filter by.
Operation string
// Tag values you want to filter by.
Tags []string
// Start is the lower bounds (inclusive) that a trace can start at.
Start time.Time
// End is the uppper bounds (exclusive) a trace can end at.
End time.Time
// DurationMin is the minimum duration a trace (inclusive) must have.
DurationMin time.Duration
// DurationMax is the maximum duration a trace (exclusive) can have.
DurationMax time.Duration
// SearchDepth is a quirky setting. It is kinda tells the data store how hard to search.
// On data stores like Cassandra, settting this to a higher number will cause it
// to search deeper in its trees for the data. So a setting of 20 might get 8 results, but 200 will get
// 15. This looks to have only a limit like effect on other storage systems. This defaults to 200.
SearchDepth int32
}
func (s SearchParams) validate() error {
if s.Service == "" {
return errors.New("Service field must not be an empty string")
}
return nil
}
func (s SearchParams) proto() *pb.FindTracesRequest {
if s.SearchDepth == 0 {
s.SearchDepth = 20
}
var t map[string]string
if len(s.Tags) > 0 {
t = make(map[string]string, len(s.Tags))
for _, tag := range s.Tags {
t[tag] = ""
}
}
return &pb.FindTracesRequest{
Query: &pb.TraceQueryParameters{
ServiceName: s.Service,
OperationName: s.Operation,
Tags: t,
StartTimeMin: timestamp.New(s.Start),
StartTimeMax: timestamp.New(s.End),
DurationMin: duration.New(s.DurationMin),
DurationMax: duration.New(s.DurationMax),
SearchDepth: s.SearchDepth,
},
}
}
// Search searches Jaeger for traces that match the SearchParams. Each result is the set of spans that make up a trace.
func (j *Jaeger) Search(ctx context.Context, params SearchParams) (chan Trace, error) {
if err := params.validate(); err != nil {
return nil, err
}
stream, err := j.client.FindTraces(ctx, params.proto())
if err != nil {
return nil, err
}
// Traces come in chunks of spans. So we look at the chunks that come in and combine spans with the same IDs into traces.
return unwind(ctx, stream), nil
}
// Trace allows retreival of a specific trace from Jaegar by its ID.
func (j *Jaeger) Trace(ctx context.Context, id string) (Trace, error) {
tid, err := otelTrace.TraceIDFromHex(id)
if err != nil {
return Trace{}, fmt.Errorf("trace ID was invalid: %w", err)
}
req := &pb.GetTraceRequest{
TraceId: tid[0:16],
}
stream, err := j.client.GetTrace(ctx, req)
if err != nil {
return Trace{}, err
}
ch := unwind(ctx, stream)
traces := make([]Trace, 0, 1)
for trace := range ch {
traces = append(traces, trace)
}
switch len(traces) {
case 0:
return Trace{}, ErrNotFound
case 1:
return traces[0], nil
}
return Trace{}, fmt.Errorf("bug: received more that a single Trace")
}
type receiver interface {
Recv() (*pb.SpansResponseChunk, error)
grpc.ClientStream
}
// unwind unwinds traces that come in chunks of spans. So we look at the chunks that come in and combine spans with the same IDs into traces.
func unwind(ctx context.Context, stream receiver) chan Trace {
ch := make(chan Trace, 1)
go func() {
defer close(ch)
var lastTrace Trace
for {
if ctx.Err() != nil {
ch <- Trace{Err: ctx.Err()}
return
}
chunk, err := stream.Recv()
if err == io.EOF {
if lastTrace.ID != "" {
ch <- lastTrace
}
return
}
if err != nil {
ch <- Trace{Err: err}
return
}
spans := chunkToSpan(chunk)
if len(spans) == 0 {
continue
}
if spans[0].TraceID() != lastTrace.ID {
if lastTrace.ID != "" {
ch <- lastTrace
}
lastTrace = Trace{ID: spans[0].TraceID(), Spans: spans}
} else {
lastTrace.Spans = append(lastTrace.Spans, spans...)
}
}
}()
return ch
}
func chunkToSpan(chunk *pb.SpansResponseChunk) []Span {
if len(chunk.Spans) == 0 {
return nil
}
var spans []Span
for _, s := range chunk.Spans {
spans = append(spans, Span{Span: s})
}
return spans
}
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/README.md
================================================
This provides an end to end test using docker to turn up Jaeger and an http server using Jaeger.
We kick off some traces using the client and then use our jaeger client to find the traces.
The test will kick off the docker-compose environment on its own.
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/client/client.go
================================================
package client
import (
"context"
"log"
"net/http"
"strconv"
"sync"
"time"
"github.com/google/uuid"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"go.opentelemetry.io/otel/trace"
"google.golang.org/grpc"
)
// NestedSpans is the number of nested spans to create. Ths is set to 2560, because for some
// reason that is the maximum number of spans. That may be due to some byte limit or a fixed number.
// I could find no documentation to indicate why, thought I didn't look throughthe source.
const NestedSpans = 2560
// Initializes an OTLP exporter, and configures the corresponding trace providers.
func initProvider() func() {
ctx := context.Background()
traceExp := initTracer(ctx, "127.0.0.1:4317")
log.Println("intTracer done")
return func() {
ctx, cancel := context.WithTimeout(ctx, time.Second)
defer cancel()
if err := traceExp.Shutdown(ctx); err != nil {
otel.Handle(err)
}
}
}
func initTracer(ctx context.Context, otelAgentAddr string) *otlptrace.Exporter {
traceClient := otlptracegrpc.NewClient(
otlptracegrpc.WithInsecure(),
otlptracegrpc.WithEndpoint(otelAgentAddr),
otlptracegrpc.WithDialOption(grpc.WithBlock(), grpc.WithTimeout(time.Second)))
traceExp, err := otlptrace.New(ctx, traceClient)
handleErr(err, "Failed to create the collector trace exporter")
res, err := resource.New(ctx,
resource.WithFromEnv(),
resource.WithProcess(),
resource.WithTelemetrySDK(),
resource.WithHost(),
resource.WithAttributes(
// the service name used to display traces in backends
semconv.ServiceNameKey.String("demo-client"),
),
)
handleErr(err, "failed to create resource")
bsp := sdktrace.NewBatchSpanProcessor(traceExp)
tracerProvider := sdktrace.NewTracerProvider(
sdktrace.WithSampler(sdktrace.AlwaysSample()),
sdktrace.WithResource(res),
sdktrace.WithSpanProcessor(bsp),
)
// set global propagator to tracecontext (the default is no-op).
otel.SetTextMapPropagator(propagation.TraceContext{})
otel.SetTracerProvider(tracerProvider)
return traceExp
}
func handleErr(err error, message string) {
if err != nil {
log.Fatalf("%s: %v", message, err)
}
}
var once sync.Once
var Shutdown func() = func() {}
type HTTP struct {
addr string
client http.Client
}
func New(addr string) (*HTTP, error) {
once.Do(
func() {
log.Println("before initProvider")
Shutdown = initProvider()
log.Println("after initProvider")
},
)
h := &HTTP{client: http.Client{Transport: otelhttp.NewTransport(http.DefaultTransport)}}
log.Println("after *HTTP client")
return h, nil
}
func (h *HTTP) Call(ctx context.Context) (traceID string, err error) {
tracer := otel.Tracer("demo-client-tracer")
ctx, span := tracer.Start(ctx, "ExecuteRequest")
defer span.End()
ctx = h.makeNestedSpans(ctx, tracer)
h.makeRequest(ctx)
log.Println("trace says: ", span.SpanContext().TraceID().String())
log.Println("convert says: ", convertTraceID(span.SpanContext().TraceID().String()))
return span.SpanContext().TraceID().String(), nil
}
func (h *HTTP) makeRequest(ctx context.Context) error {
// Make sure we pass the context to the request to avoid broken traces.
req, err := http.NewRequestWithContext(ctx, "GET", h.addr, nil)
if err != nil {
return err
}
// All requests made with this client will create spans.
res, err := h.client.Do(req)
if err != nil {
return err
}
res.Body.Close()
return nil
}
func (h *HTTP) makeNestedSpans(ctx context.Context, tracer trace.Tracer) context.Context {
spans := []trace.Span{}
for i := 0; i < NestedSpans; i++ {
var span trace.Span
ctx, span = tracer.Start(ctx, uuid.New().String())
spans = append(spans, span)
}
for i := NestedSpans - 1; i > -1; i-- {
spans[i].End()
}
return ctx
}
func convertTraceID(id string) string {
if len(id) < 16 {
return ""
}
if len(id) > 16 {
id = id[16:]
}
intValue, err := strconv.ParseUint(id, 16, 64)
if err != nil {
return ""
}
return strconv.FormatUint(intValue, 10)
}
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/docker-compose.yaml
================================================
version: "2"
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
ports:
- "16685:16685"
- "16686:16686"
- "14268:14268"
- "14250:14250"
# Collector
otel-collector:
image: ${OTELCOL_IMG}
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317:4317" # OTLP gRPC receiver
- "55670:55679" # zpages extension
depends_on:
- jaeger-all-in-one
demo-server:
build:
dockerfile: Dockerfile
context: ./server
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
ports:
- "7080:7080"
depends_on:
- otel-collector
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/etoe_test.go
================================================
package etoe
import (
"context"
"log"
"os/exec"
"testing"
"time"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/jaeger/client"
httpClient "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/jaeger/client/test/client"
)
func TestTrace(t *testing.T) {
start := exec.Command("docker-compose", "up", "-d")
b, err := start.CombinedOutput()
if err != nil {
panic(string(b))
}
time.Sleep(5 * time.Second)
end := exec.Command("docker-compose", "down")
defer func() {
b, err = end.CombinedOutput()
if err != nil {
panic(string(b))
}
}()
c, err := client.New("127.0.0.1:16685")
if err != nil {
panic(err)
}
h, err := httpClient.New("127.0.0.1:7080")
if err != nil {
panic(err)
}
ids := []string{}
for i := 0; i < 10; i++ {
callCtx, callCancel := context.WithTimeout(context.Background(), 2*time.Second)
id, err := h.Call(callCtx)
if err != nil {
panic(err)
}
callCancel()
ids = append(ids, id)
}
log.Println("sleeping to let trace get exported")
time.Sleep(20 * time.Second)
traceCtx, traceCancel := context.WithTimeout(context.Background(), 10*time.Second)
defer traceCancel()
trace, err := c.Trace(traceCtx, ids[0])
if err != nil {
panic(err)
}
if len(trace.Spans) != httpClient.NestedSpans {
t.Errorf("TestTrace(number of Spans): got %d, want %d", len(trace.Spans), httpClient.NestedSpans)
}
for _, id := range ids {
_, err := c.Trace(traceCtx, id)
if err != nil {
panic(err)
}
}
// So, I don't know what the deal is.
/*
ch, err := c.Search(traceCtx, client.SearchParams{Service: "demo-client", SearchDepth: 100})
if err != nil {
panic(err)
}
found := []string{}
for e := range ch {
found = append(found, e.ID)
}
sort.Strings(found)
sort.Strings(ids)
if len(ids) != len(found){
t.Fatalf("TestTrace(Search): number of IDs: got %d, want %d", len(found), len(ids))
}
for i, id := range ids {
if id != found[i] {
t.Fatalf("TestTrace(Search): trace ids[%d]: got %s, want %s", i, found[i], id)
}
}
*/
}
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/otel-collector-config.yaml
================================================
receivers:
otlp:
protocols:
grpc:
exporters:
jaeger:
endpoint: jaeger-all-in-one:14250
tls:
insecure: true
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [jaeger]
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/Dockerfile
================================================
FROM golang:1.17
COPY . /usr/src/server/
WORKDIR /usr/src/server/
RUN go env -w GOPROXY=direct
RUN go install ./main.go
CMD ["/go/bin/main"]
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/docker-compose.yaml
================================================
version: "2"
services:
# Jaeger
jaeger-all-in-one:
image: jaegertracing/all-in-one:latest
ports:
- "16686:16686"
- "14268"
- "14250"
# Collector
otel-collector:
image: ${OTELCOL_IMG}
command: ["--config=/etc/otel-collector-config.yaml", "${OTELCOL_ARGS}"]
volumes:
- ./otel-collector-config.yaml:/etc/otel-collector-config.yaml
ports:
- "1888:1888" # pprof extension
- "13133:13133" # health_check extension
- "4317" # OTLP gRPC receiver
- "55670:55679" # zpages extension
depends_on:
- jaeger-all-in-one
demo-client:
build:
dockerfile: Dockerfile
context: ./client
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
- DEMO_SERVER_ENDPOINT=http://demo-server:7080/hello
depends_on:
- demo-server
demo-server:
build:
dockerfile: Dockerfile
context: ./server
environment:
- OTEL_EXPORTER_OTLP_ENDPOINT=otel-collector:4317
ports:
- "7080"
depends_on:
- otel-collector
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/go.mod
================================================
module github.com/PacktPublishing/Go-for-DevOps/chapter/9/tracing/demo/server
go 1.17
require (
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.28.0
go.opentelemetry.io/otel v1.3.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0
go.opentelemetry.io/otel/sdk v1.3.0
go.opentelemetry.io/otel/trace v1.3.0
google.golang.org/grpc v1.43.0
)
require (
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.2 // indirect
github.com/go-logr/logr v1.2.1 // indirect
github.com/go-logr/stdr v1.2.0 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 // indirect
go.opentelemetry.io/otel/internal/metric v0.26.0 // indirect
go.opentelemetry.io/otel/metric v0.26.0 // indirect
go.opentelemetry.io/proto/otlp v0.11.0 // indirect
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
golang.org/x/text v0.3.3 // indirect
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece // indirect
google.golang.org/protobuf v1.27.1 // indirect
)
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/go.sum
================================================
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/cenkalti/backoff/v4 v4.1.2 h1:6Yo7N8UP2K6LWZnW94DLVSSrbobcWdVzAYOisuDPIFo=
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI=
github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98=
github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk=
github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0=
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
github.com/felixge/httpsnoop v1.0.2/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.1 h1:DX7uPQ4WgAWfoh+NGGlbJQswnYIVvz0SRlLS3rPZQDA=
github.com/go-logr/logr v1.2.1/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/stdr v1.2.0 h1:j4LrlVXgrbIWO83mmQUnK0Hi+YnbD+vzrE1z/EphbFE=
github.com/go-logr/stdr v1.2.0/go.mod h1:YkVgnZu1ZjjL7xTxrfm/LLZBfkhTqSR1ydtm6jTKKwI=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI=
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ=
github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.28.0 h1:hpEoMBvKLC6CqFZogJypr9IHwwSNF3ayEkNzD502QAM=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.28.0/go.mod h1:Ihno+mNBfZlT0Qot3XyRTdZ/9U/Cg2Pfgj75DTdIfq4=
go.opentelemetry.io/otel v1.3.0 h1:APxLf0eiBwLl+SOXiJJCVYzA1OOJNyAoV8C5RNRyy7Y=
go.opentelemetry.io/otel v1.3.0/go.mod h1:PWIKzi6JCp7sM0k9yZ43VX+T345uNbAkDKwHVjb2PTs=
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0 h1:R/OBkMoGgfy2fLhs2QhkCI1w4HLEQX92GCcJB6SSdNk=
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.3.0/go.mod h1:VpP4/RMn8bv8gNo9uK7/IMY4mtWLELsS+JIP0inH0h4=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0 h1:giGm8w67Ja7amYNfYMdme7xSp2pIxThWopw8+QP51Yk=
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.3.0/go.mod h1:hO1KLR7jcKaDDKDkvI9dP/FIhpmna5lkqPUQdEjFAM8=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0 h1:VQbUHoJqytHHSJ1OZodPH9tvZZSVzUHjPHpkO85sT6k=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.3.0/go.mod h1:keUU7UfnwWTWpJ+FWnyqmogPa82nuU5VUANFq49hlMY=
go.opentelemetry.io/otel/internal/metric v0.26.0 h1:dlrvawyd/A+X8Jp0EBT4wWEe4k5avYaXsXrBr4dbfnY=
go.opentelemetry.io/otel/internal/metric v0.26.0/go.mod h1:CbBP6AxKynRs3QCbhklyLUtpfzbqCLiafV9oY2Zj1Jk=
go.opentelemetry.io/otel/metric v0.26.0 h1:VaPYBTvA13h/FsiWfxa3yZnZEm15BhStD8JZQSA773M=
go.opentelemetry.io/otel/metric v0.26.0/go.mod h1:c6YL0fhRo4YVoNs6GoByzUgBp36hBL523rECoZA5UWg=
go.opentelemetry.io/otel/sdk v1.3.0 h1:3278edCoH89MEJ0Ky8WQXVmDQv3FX4ZJ3Pp+9fJreAI=
go.opentelemetry.io/otel/sdk v1.3.0/go.mod h1:rIo4suHNhQwBIPg9axF8V9CA72Wz2mKF1teNrup8yzs=
go.opentelemetry.io/otel/trace v1.3.0 h1:doy8Hzb1RJ+I3yFhtDmwNc7tIyw1tNMOIsyPzp1NOGY=
go.opentelemetry.io/otel/trace v1.3.0/go.mod h1:c/VDhno8888bvQYmbYLqe41/Ldmr/KKunbvWM4/fEjk=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.opentelemetry.io/proto/otlp v0.11.0 h1:cLDgIBTf4lLOlztkhzAEdQsJ4Lj+i5Wc9k6Nn0K1VyU=
go.opentelemetry.io/proto/otlp v0.11.0/go.mod h1:QpEjXPrNQzrFDZgoTo49dgHR9RYRSrg3NAKnUGl9YpQ=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece h1:1YM0uhfumvoDu9sx8+RyWwTI63zoCQvI23IYFRlvte0=
google.golang.org/genproto v0.0.0-20200527145253-8367513e4ece/go.mod h1:jDfRM7FcilCzHH/e9qn6dsT145K34l5v+OpcnNgKAAA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.43.0 h1:Eeu7bZtDZ2DpRCsLhUlcrLnvYaMK1Gz86a+hMVvELmM=
google.golang.org/grpc v1.43.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.27.1 h1:SnqbnDw1V7RiZcXPx5MEeqPv2s79L9i7BJUlG/+RurQ=
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/main.go
================================================
package main
import (
"context"
"log"
"net/http"
"os"
"time"
"go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/attribute"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace"
"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/resource"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
semconv "go.opentelemetry.io/otel/semconv/v1.4.0"
"go.opentelemetry.io/otel/trace"
"google.golang.org/grpc"
)
// Initializes an OTLP exporter, and configures the corresponding trace providers.
func initProvider() func() {
ctx := context.Background()
otelAgentAddr, ok := os.LookupEnv("OTEL_EXPORTER_OTLP_ENDPOINT")
if !ok {
otelAgentAddr = "0.0.0.0:4317"
}
traceExp := initTracer(ctx, otelAgentAddr)
return func() {
cxt, cancel := context.WithTimeout(ctx, time.Second)
defer cancel()
if err := traceExp.Shutdown(cxt); err != nil {
otel.Handle(err)
}
}
}
func initTracer(ctx context.Context, otelAgentAddr string) *otlptrace.Exporter {
traceClient := otlptracegrpc.NewClient(
otlptracegrpc.WithInsecure(),
otlptracegrpc.WithEndpoint(otelAgentAddr),
otlptracegrpc.WithDialOption(grpc.WithBlock()))
traceExp, err := otlptrace.New(ctx, traceClient)
handleErr(err, "Failed to create the collector trace exporter")
res, err := resource.New(ctx,
resource.WithFromEnv(),
resource.WithProcess(),
resource.WithTelemetrySDK(),
resource.WithHost(),
resource.WithAttributes(
// the service name used to display traces in backends
semconv.ServiceNameKey.String("demo-server"),
),
)
handleErr(err, "failed to create resource")
bsp := sdktrace.NewBatchSpanProcessor(traceExp)
tracerProvider := sdktrace.NewTracerProvider(
sdktrace.WithSampler(sdktrace.AlwaysSample()),
sdktrace.WithResource(res),
sdktrace.WithSpanProcessor(bsp),
)
// set global propagator to tracecontext (the default is no-op).
otel.SetTextMapPropagator(propagation.TraceContext{})
otel.SetTracerProvider(tracerProvider)
return traceExp
}
func handleErr(err error, message string) {
if err != nil {
log.Fatalf("%s: %v", message, err)
}
}
func main() {
shutdown := initProvider()
defer shutdown()
serverAttribute := attribute.String("server-attribute", "foo")
// create a handler wrapped in OpenTelemetry instrumentation
handler := http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) {
ctx := req.Context()
span := trace.SpanFromContext(ctx)
span.SetAttributes(serverAttribute)
w.Write([]byte("Hello World"))
log.Println("got called")
})
wrappedHandler := otelhttp.NewHandler(handler, "/hello")
// serve up the wrapped handler
http.Handle("/hello", wrappedHandler)
log.Println("server started")
http.ListenAndServe(":7080", nil)
}
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/otel-collector-config.yaml
================================================
receivers:
otlp:
protocols:
grpc:
exporters:
jaeger:
endpoint: jaeger-all-in-one:14250
tls:
insecure: true
processors:
batch:
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [jaeger]
================================================
FILE: chapter/11/ops/internal/jaeger/client/test/server/readme.md
================================================
# Tracing with OpenTelemetry and Jaeger
TODO: fill in the walk through
## Running this example
- `docker-compose up -d`
- Once started the client application will periodically send requests to the server. Distributed traces will be collected for the requests and responses, then exported for analysis in Jaeger. To view the traces in Jaeger, open http://localhost:16686.
If you see something like:
```bash
docker-compose up -d
Traceback (most recent call last):
File "urllib3/connectionpool.py", line 670, in urlopen
File "urllib3/connectionpool.py", line 392, in _make_request
```
This indicates that you aren't running docker. Make sure you have docker installed and it is running.
## Tearing down this example
- `docker-compose down`
## Influences / Credit
The code in this demo was heavily influenced from the example application in https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/examples/demo
which carries the following license.
```
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
```
See also: [OTEL License](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/10cfdaac1387b4df7a525c3050ce18ec8f8068be/LICENSE
================================================
FILE: chapter/11/ops/internal/prom/prom.go
================================================
package prom
import (
"context"
"fmt"
"regexp"
"runtime"
"strings"
"sync"
"time"
"github.com/prometheus/client_golang/api"
v1 "github.com/prometheus/client_golang/api/prometheus/v1"
"github.com/prometheus/common/model"
//"github.com/prometheus/common/config"
)
// Client is a wrapper around the prometheus Go client for our needs.
type Client struct {
client v1.API
}
// New creates a new client connecting to the HTTP address provided. This should be in the form of http[s]://[domain,host,ip]:[port] .
func New(httpAddr string) (*Client, error) {
client, err := api.NewClient(
api.Config{
Address: httpAddr,
},
)
if err != nil {
return nil, err
}
return &Client{client: v1.NewAPI(client)}, nil
}
// Metric returns the metrics current value.
func (c *Client) Metric(ctx context.Context, metric string) (model.Value, v1.Warnings, error) {
return c.client.Query(ctx, metric, time.Now())
}
// Range does a query within a range of time and returns the result. A query might be something like:
// "rate(prometheus_tsdb_head_samples_appended_total[5m])".
func (c *Client) Range(ctx context.Context, query string, r v1.Range) (model.Value, v1.Warnings, error) {
return c.client.QueryRange(ctx, query, r)
}
// AlertFilter represents a filter you can use to filter out alerts.
type AlertFilter struct {
// Labels filters alerts by attached labels. If only a key is provided, we only match on the key.
// Values that start with "regexp/" are regexp compiled and then matched against a value stored at that key.
// Defaults to all labels.
Labels map[string]string
labelRegexes map[string]*regexp.Regexp
// ActiveAt filters out any alerts that are before this time. Defaults to all alerts.
ActiveAt time.Time
// States filters alerts to only ones in these states. Defaults to all states.
States []string
states map[string]bool
// Value filters out all values that don't match the regex.
Value *regexp.Regexp
compiled bool
}
// Compile compiles the AlertFilter. If this is a one off query, no need to do this. If you plan
// to reuse the filter, this will increase the speed. Changing a filter after Compile() is called
// will not give you the desired result, create a new filter instead.
func (a *AlertFilter) Compile() error {
if a.compiled {
return nil
}
if len(a.Labels) > 0 {
regexes := make(map[string]*regexp.Regexp, len(a.Labels))
for k, v := range a.Labels {
if strings.TrimSpace(k) == "" {
return fmt.Errorf("cannot have a empty string label key")
}
if strings.HasPrefix(v, "regexp/") {
sp := strings.Split(v, "regexp/")
if len(sp) == 1 {
return fmt.Errorf("label value with regexp/ must have more content")
}
if len(sp) > 2 {
return fmt.Errorf("regexp/ can only be at the beginning of a label value")
}
r, err := regexp.Compile(sp[1])
if err != nil {
return fmt.Errorf("label with value(%s) cannot be regexp compiled: %w", v, err)
}
regexes[k] = r
}
}
a.labelRegexes = regexes
}
if len(a.States) > 0 {
a.states = map[string]bool{}
for _, s := range a.States {
a.states[s] = true
}
}
a.compiled = true
return nil
}
func (a *AlertFilter) filter(items []v1.Alert) (chan v1.Alert, error) {
if !a.compiled {
if err := a.Compile(); err != nil {
return nil, err
}
}
ch := make(chan v1.Alert, runtime.NumCPU())
limit := make(chan struct{}, runtime.NumCPU())
wg := sync.WaitGroup{}
wg.Add(1)
go func() {
defer wg.Done()
for _, item := range items {
item := item
limit <- struct{}{}
wg.Add(1)
func() {
defer wg.Done()
defer func() { <-limit }()
go a.pipeline(item, ch)
}()
}
}()
go func() {
wg.Wait()
close(ch)
}()
return ch, nil
}
func (a *AlertFilter) pipeline(item v1.Alert, out chan v1.Alert) {
if len(a.Labels) > 0 {
if !a.matchLabel(item) {
return
}
}
if !a.ActiveAt.IsZero() {
if item.ActiveAt.Before(a.ActiveAt) {
return
}
}
if len(a.States) > 0 {
if !a.states[string(item.State)] {
return
}
}
if a.Value != nil {
if !a.Value.MatchString(item.Value) {
return
}
}
out <- item
}
func (a *AlertFilter) matchLabel(item v1.Alert) bool {
for k, v := range item.Labels {
matched, ok := a.Labels[string(k)]
if !ok {
continue
}
// Exact match or we aren't matching on values.
switch string(v) {
case "", matched:
return true
}
// Let's see if this was a regex match.
r := a.labelRegexes[string(k)]
// It wasn't, so return false because we didn't have an exact match.
if r == nil {
continue
}
if r.MatchString(string(v)) {
return true
}
}
return false
}
// Alerts will return all the alerts that match the filter.
func (c *Client) Alerts(ctx context.Context, filter AlertFilter) (chan v1.Alert, error) {
r, err := c.client.Alerts(ctx)
if err != nil {
return nil, err
}
return filter.filter(r.Alerts)
}
================================================
FILE: chapter/11/ops/internal/server/server.go
================================================
// Package server contains our gRPC server implementation for the ops server.
package server
import (
"context"
"errors"
"fmt"
"log"
"net"
"sort"
"sync"
"time"
jaeger "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/jaeger/client"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/prom"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/petstore/client"
"google.golang.org/grpc"
"google.golang.org/grpc/reflection"
"google.golang.org/protobuf/types/known/durationpb"
pb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto"
mpb "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto/jaeger/model"
)
// API implements our gRPC server's API.
type API struct {
pb.UnimplementedOpsServer
addr string
grpcServer *grpc.Server
gOpts []grpc.ServerOption
mu sync.Mutex
clients Clients
}
// Clients holds the remote clients requires to do ops.
type Clients struct {
// Jaeger provides access to traces.
Jaeger *jaeger.Jaeger
// Prom provides access to metrics.
Prom *prom.Client
// Petstore provides access to the petstore.
Petstore *client.Client
}
func (c Clients) validate() error {
if c.Jaeger == nil {
return errors.New("Jaeger cannot be nil")
}
if c.Prom == nil {
return errors.New("Prom cannot be nil")
}
if c.Petstore == nil {
return errors.New("PetStore cannot be nil")
}
return nil
}
// Option is an optional arguments to New().
type Option func(a *API)
// WithGRPCOpts creates the gRPC server with the options passed.
func WithGRPCOpts(opts ...grpc.ServerOption) Option {
return func(a *API) {
a.gOpts = append(a.gOpts, opts...)
}
}
// New is the constructore for API.
func New(addr string, clients Clients, options ...Option) (*API, error) {
if err := clients.validate(); err != nil {
return nil, err
}
a := &API{addr: addr, clients: clients}
for _, o := range options {
o(a)
}
a.grpcServer = grpc.NewServer(a.gOpts...)
a.grpcServer.RegisterService(&pb.Ops_ServiceDesc, a)
reflection.Register(a.grpcServer)
return a, nil
}
// Start starts the server. This blocks until Stop() is called.
func (a *API) Start() error {
a.mu.Lock()
defer a.mu.Unlock()
lis, err := net.Listen("tcp", a.addr)
if err != nil {
return err
}
return a.grpcServer.Serve(lis)
}
// Stop stops the server.
func (a *API) Stop() {
a.mu.Lock()
defer a.mu.Unlock()
a.grpcServer.Stop()
}
// ListTraces lists recent traces from Jaeger for the petstore service.
func (a *API) ListTraces(ctx context.Context, req *pb.ListTracesReq) (*pb.ListTracesResp, error) {
log.Println("tags:", req.Tags)
params := jaeger.SearchParams{
Service: "petstore",
Operation: req.Operation,
Tags: req.Tags,
DurationMin: time.Duration(req.DurationMin),
DurationMax: time.Duration(req.DurationMax),
SearchDepth: req.SearchDepth,
}
if req.Start > 0 {
params.Start = time.Unix(0, req.Start)
}
if req.End > 0 {
params.End = time.Unix(0, req.End)
}
ch, err := a.clients.Jaeger.Search(ctx, params)
if err != nil {
return nil, err
}
resp := &pb.ListTracesResp{}
for trace := range ch {
if len(trace.Spans) < 0 {
continue
}
if trace.Err != nil {
return nil, trace.Err
}
start := trace.Spans[0].Span.StartTime
t := time.Unix(int64(start.Seconds), int64(start.Nanos)).UTC()
resp.Traces = append(resp.Traces, &pb.TraceItem{Start: t.UnixNano(), Id: trace.ID})
}
sort.Slice(
resp.Traces,
func(i, j int) bool {
if resp.Traces[i].Start > resp.Traces[j].Start {
return true
}
return false
},
)
return resp, nil
}
func (a *API) ShowLogs(ctx context.Context, req *pb.ShowLogsReq) (*pb.ShowLogsResp, error) {
t, err := a.clients.Jaeger.Trace(ctx, req.Id)
if err != nil {
if err == jaeger.ErrNotFound {
return &pb.ShowLogsResp{}, nil
}
return nil, err
}
logs := []*mpb.Log{}
for _, span := range t.Spans {
logs = append(logs, span.Logs...)
}
/*
sort.SliceStable(
logs,
func(i, j int) bool {
if logs[i].Timestamp.AsTime().Before(logs[j].Timestamp.AsTime()) {
return true
}
return false
},
)
*/
return &pb.ShowLogsResp{
Id: t.ID,
Logs: logs,
}, nil
}
func (a *API) ShowTrace(ctx context.Context, req *pb.ShowTraceReq) (*pb.ShowTraceResp, error) {
t, err := a.clients.Jaeger.Trace(ctx, req.Id)
if err != nil {
if err == jaeger.ErrNotFound {
return &pb.ShowTraceResp{}, nil
}
return nil, err
}
var (
ops []string
errors []string
tags []string
dur *durationpb.Duration
)
for _, span := range t.Spans {
ops = append(ops, span.OperationName)
for _, kv := range span.Tags {
if kv.Key == "error" {
errors = append(errors, kv.VStr)
}
tags = append(tags, kv.Key)
}
if span.Duration.AsDuration() > dur.AsDuration() {
dur = span.Duration
}
}
return &pb.ShowTraceResp{
Id: t.ID,
Operations: ops,
Errors: errors,
Tags: tags,
Duration: dur,
}, nil
}
// ChangeSampling changes the sampling type and rate for the Petstore.
func (a *API) ChangeSampling(ctx context.Context, req *pb.ChangeSamplingReq) (*pb.ChangeSamplingResp, error) {
sc := client.Sampler{
Type: client.SamplerType(req.Type),
Rate: req.FloatValue,
}
if err := a.clients.Petstore.ChangeSampler(ctx, sc); err != nil {
return nil, err
}
return &pb.ChangeSamplingResp{}, nil
}
// DeployedVersion returns the version of the Petstore that prometheus says is current.
func (a *API) DeployedVersion(ctx context.Context, req *pb.DeployedVersionReq) (*pb.DeployedVersionResp, error) {
mv, _, err := a.clients.Prom.Metric(ctx, "deployedVersion")
if err != nil {
return nil, fmt.Errorf("problem getting metric: %w", err)
}
return &pb.DeployedVersionResp{Version: mv.String()}, nil
}
// Alerts grabs all currnetly firing alerts.
func (a *API) Alerts(ctx context.Context, req *pb.AlertsReq) (*pb.AlertsResp, error) {
labels := map[string]string{}
for _, l := range req.Labels {
labels[l] = ""
}
filter := prom.AlertFilter{
Labels: labels,
ActiveAt: time.Unix(0, req.ActiveAt),
States: req.States,
}
ch, err := a.clients.Prom.Alerts(ctx, filter)
if err != nil {
return nil, err
}
resp := &pb.AlertsResp{}
for a := range ch {
resp.Alerts = append(
resp.Alerts,
&pb.Alert{
State: string(a.State),
Value: a.Value,
ActiveAt: a.ActiveAt.UnixNano(),
},
)
}
return resp, nil
}
================================================
FILE: chapter/11/ops/ops.go
================================================
package main
import (
"flag"
"log"
jaegerClient "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/jaeger/client"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/prom"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/server"
"github.com/PacktPublishing/Go-for-DevOps/chapter/11/petstore/client"
)
var (
addr = flag.String("addr", "0.0.0.0:7000", "The address to run the service on.")
jaegerAddr = flag.String("jaegerAddr", "127.0.0.1:16685", "The address of the Jaeger query service.")
promAddr = flag.String("promAddr", "127.0.0.1:9000", "The address of the Prometheus service.")
petstoreAddr = flag.String("petstoreAddr", "127.0.0.1:6742", "The address of the Petstore.")
)
func main() {
flag.Parse()
j, err := jaegerClient.New(*jaegerAddr)
if err != nil {
log.Fatalf("could not connect to Jaeger: %s", err)
}
p, err := prom.New("http://" + *promAddr)
if err != nil {
log.Fatalf("could not connect to Prometheus: %s", err)
}
ps, err := client.New(*petstoreAddr)
if err != nil {
log.Fatalf("could not connecto the Petstore: %s", err)
}
clients := server.Clients{
Jaeger: j,
Prom: p,
Petstore: ps,
}
serv, err := server.New(*addr, clients)
if err != nil {
panic(err)
}
log.Println("serving starting on: ", *addr)
serv.Start()
}
================================================
FILE: chapter/11/ops/proto/buf.gen.yaml
================================================
version: v1
plugins:
- name: go
out: ./
opt:
- paths=source_relative
- name: go-grpc
out: ./
opt:
- paths=source_relative
================================================
FILE: chapter/11/ops/proto/buf.yaml
================================================
version: v1
deps:
- buf.build/googleapis/googleapis
- buf.build/gogo/protobuf
lint:
use:
- DEFAULT
breaking:
use:
- FILE
================================================
FILE: chapter/11/ops/proto/jaeger/collector.pb.go
================================================
// Copyright (c) 2019 The Jaeger Authors.
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.18.0
// source: jaeger/collector.proto
package jaeger
import (
model "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto/jaeger/model"
_ "github.com/gogo/protobuf/gogoproto"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type PostSpansRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Batch *model.Batch `protobuf:"bytes,1,opt,name=batch,proto3" json:"batch,omitempty"`
}
func (x *PostSpansRequest) Reset() {
*x = PostSpansRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_collector_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PostSpansRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PostSpansRequest) ProtoMessage() {}
func (x *PostSpansRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_collector_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PostSpansRequest.ProtoReflect.Descriptor instead.
func (*PostSpansRequest) Descriptor() ([]byte, []int) {
return file_jaeger_collector_proto_rawDescGZIP(), []int{0}
}
func (x *PostSpansRequest) GetBatch() *model.Batch {
if x != nil {
return x.Batch
}
return nil
}
type PostSpansResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *PostSpansResponse) Reset() {
*x = PostSpansResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_collector_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *PostSpansResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*PostSpansResponse) ProtoMessage() {}
func (x *PostSpansResponse) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_collector_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use PostSpansResponse.ProtoReflect.Descriptor instead.
func (*PostSpansResponse) Descriptor() ([]byte, []int) {
return file_jaeger_collector_proto_rawDescGZIP(), []int{1}
}
var File_jaeger_collector_proto protoreflect.FileDescriptor
var file_jaeger_collector_proto_rawDesc = []byte{
0x0a, 0x16, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2f, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74,
0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72,
0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x1a, 0x18, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2f,
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67,
0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f,
0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x10, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x61,
0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x05, 0x62, 0x61, 0x74,
0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65,
0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x42, 0x61, 0x74, 0x63, 0x68, 0x42, 0x04,
0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x62, 0x61, 0x74, 0x63, 0x68, 0x22, 0x13, 0x0a, 0x11, 0x50,
0x6f, 0x73, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x32, 0x7c, 0x0a, 0x10, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72,
0x76, 0x69, 0x63, 0x65, 0x12, 0x68, 0x0a, 0x09, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x61, 0x6e,
0x73, 0x12, 0x1f, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76,
0x32, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x20, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f,
0x76, 0x32, 0x2e, 0x50, 0x6f, 0x73, 0x74, 0x53, 0x70, 0x61, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x22, 0x18, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x12, 0x22, 0x0d, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x3a, 0x01, 0x2a, 0x42, 0x6b,
0x0a, 0x17, 0x69, 0x6f, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, 0x69,
0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x5a, 0x44, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x61, 0x63, 0x6b, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69,
0x73, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x47, 0x6f, 0x2d, 0x66, 0x6f, 0x72, 0x2d, 0x44, 0x65, 0x76,
0x4f, 0x70, 0x73, 0x2f, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x2f, 0x31, 0x30, 0x2f, 0x6f,
0x70, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0xc8,
0xe2, 0x1e, 0x01, 0xd0, 0xe2, 0x1e, 0x01, 0xe0, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f,
0x74, 0x6f, 0x33,
}
var (
file_jaeger_collector_proto_rawDescOnce sync.Once
file_jaeger_collector_proto_rawDescData = file_jaeger_collector_proto_rawDesc
)
func file_jaeger_collector_proto_rawDescGZIP() []byte {
file_jaeger_collector_proto_rawDescOnce.Do(func() {
file_jaeger_collector_proto_rawDescData = protoimpl.X.CompressGZIP(file_jaeger_collector_proto_rawDescData)
})
return file_jaeger_collector_proto_rawDescData
}
var file_jaeger_collector_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_jaeger_collector_proto_goTypes = []interface{}{
(*PostSpansRequest)(nil), // 0: jaeger.api_v2.PostSpansRequest
(*PostSpansResponse)(nil), // 1: jaeger.api_v2.PostSpansResponse
(*model.Batch)(nil), // 2: jaeger.api_v2.Batch
}
var file_jaeger_collector_proto_depIdxs = []int32{
2, // 0: jaeger.api_v2.PostSpansRequest.batch:type_name -> jaeger.api_v2.Batch
0, // 1: jaeger.api_v2.CollectorService.PostSpans:input_type -> jaeger.api_v2.PostSpansRequest
1, // 2: jaeger.api_v2.CollectorService.PostSpans:output_type -> jaeger.api_v2.PostSpansResponse
2, // [2:3] is the sub-list for method output_type
1, // [1:2] is the sub-list for method input_type
1, // [1:1] is the sub-list for extension type_name
1, // [1:1] is the sub-list for extension extendee
0, // [0:1] is the sub-list for field type_name
}
func init() { file_jaeger_collector_proto_init() }
func file_jaeger_collector_proto_init() {
if File_jaeger_collector_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_jaeger_collector_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PostSpansRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_collector_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*PostSpansResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_jaeger_collector_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_jaeger_collector_proto_goTypes,
DependencyIndexes: file_jaeger_collector_proto_depIdxs,
MessageInfos: file_jaeger_collector_proto_msgTypes,
}.Build()
File_jaeger_collector_proto = out.File
file_jaeger_collector_proto_rawDesc = nil
file_jaeger_collector_proto_goTypes = nil
file_jaeger_collector_proto_depIdxs = nil
}
================================================
FILE: chapter/11/ops/proto/jaeger/collector.proto
================================================
// Copyright (c) 2019 The Jaeger Authors.
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax="proto3";
package jaeger.api_v2;
import "jaeger/model/model.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
option go_package = "github.com/PacktPublishing/Go-for-DevOps/chapter/10/ops/proto/jaeger";
option java_package = "io.jaegertracing.api_v2";
// Enable gogoprotobuf extensions (https://github.com/gogo/protobuf/blob/master/extensions.md).
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
message PostSpansRequest {
Batch batch = 1 [
(gogoproto.nullable) = false
];
}
message PostSpansResponse {
}
service CollectorService {
rpc PostSpans(PostSpansRequest) returns (PostSpansResponse) {
option (google.api.http) = {
post: "/api/v2/spans"
body: "*"
};
}
}
================================================
FILE: chapter/11/ops/proto/jaeger/collector_grpc.pb.go
================================================
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
package jaeger
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// CollectorServiceClient is the client API for CollectorService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type CollectorServiceClient interface {
PostSpans(ctx context.Context, in *PostSpansRequest, opts ...grpc.CallOption) (*PostSpansResponse, error)
}
type collectorServiceClient struct {
cc grpc.ClientConnInterface
}
func NewCollectorServiceClient(cc grpc.ClientConnInterface) CollectorServiceClient {
return &collectorServiceClient{cc}
}
func (c *collectorServiceClient) PostSpans(ctx context.Context, in *PostSpansRequest, opts ...grpc.CallOption) (*PostSpansResponse, error) {
out := new(PostSpansResponse)
err := c.cc.Invoke(ctx, "/jaeger.api_v2.CollectorService/PostSpans", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// CollectorServiceServer is the server API for CollectorService service.
// All implementations must embed UnimplementedCollectorServiceServer
// for forward compatibility
type CollectorServiceServer interface {
PostSpans(context.Context, *PostSpansRequest) (*PostSpansResponse, error)
mustEmbedUnimplementedCollectorServiceServer()
}
// UnimplementedCollectorServiceServer must be embedded to have forward compatible implementations.
type UnimplementedCollectorServiceServer struct {
}
func (UnimplementedCollectorServiceServer) PostSpans(context.Context, *PostSpansRequest) (*PostSpansResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PostSpans not implemented")
}
func (UnimplementedCollectorServiceServer) mustEmbedUnimplementedCollectorServiceServer() {}
// UnsafeCollectorServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to CollectorServiceServer will
// result in compilation errors.
type UnsafeCollectorServiceServer interface {
mustEmbedUnimplementedCollectorServiceServer()
}
func RegisterCollectorServiceServer(s grpc.ServiceRegistrar, srv CollectorServiceServer) {
s.RegisterService(&CollectorService_ServiceDesc, srv)
}
func _CollectorService_PostSpans_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(PostSpansRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(CollectorServiceServer).PostSpans(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/jaeger.api_v2.CollectorService/PostSpans",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(CollectorServiceServer).PostSpans(ctx, req.(*PostSpansRequest))
}
return interceptor(ctx, in, info, handler)
}
// CollectorService_ServiceDesc is the grpc.ServiceDesc for CollectorService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var CollectorService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "jaeger.api_v2.CollectorService",
HandlerType: (*CollectorServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "PostSpans",
Handler: _CollectorService_PostSpans_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "jaeger/collector.proto",
}
================================================
FILE: chapter/11/ops/proto/jaeger/model/model.pb.go
================================================
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.18.0
// source: jaeger/model/model.proto
package model
import (
_ "github.com/gogo/protobuf/gogoproto"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
durationpb "google.golang.org/protobuf/types/known/durationpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type ValueType int32
const (
ValueType_STRING ValueType = 0
ValueType_BOOL ValueType = 1
ValueType_INT64 ValueType = 2
ValueType_FLOAT64 ValueType = 3
ValueType_BINARY ValueType = 4
)
// Enum value maps for ValueType.
var (
ValueType_name = map[int32]string{
0: "STRING",
1: "BOOL",
2: "INT64",
3: "FLOAT64",
4: "BINARY",
}
ValueType_value = map[string]int32{
"STRING": 0,
"BOOL": 1,
"INT64": 2,
"FLOAT64": 3,
"BINARY": 4,
}
)
func (x ValueType) Enum() *ValueType {
p := new(ValueType)
*p = x
return p
}
func (x ValueType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (ValueType) Descriptor() protoreflect.EnumDescriptor {
return file_jaeger_model_model_proto_enumTypes[0].Descriptor()
}
func (ValueType) Type() protoreflect.EnumType {
return &file_jaeger_model_model_proto_enumTypes[0]
}
func (x ValueType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use ValueType.Descriptor instead.
func (ValueType) EnumDescriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{0}
}
type SpanRefType int32
const (
SpanRefType_CHILD_OF SpanRefType = 0
SpanRefType_FOLLOWS_FROM SpanRefType = 1
)
// Enum value maps for SpanRefType.
var (
SpanRefType_name = map[int32]string{
0: "CHILD_OF",
1: "FOLLOWS_FROM",
}
SpanRefType_value = map[string]int32{
"CHILD_OF": 0,
"FOLLOWS_FROM": 1,
}
)
func (x SpanRefType) Enum() *SpanRefType {
p := new(SpanRefType)
*p = x
return p
}
func (x SpanRefType) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (SpanRefType) Descriptor() protoreflect.EnumDescriptor {
return file_jaeger_model_model_proto_enumTypes[1].Descriptor()
}
func (SpanRefType) Type() protoreflect.EnumType {
return &file_jaeger_model_model_proto_enumTypes[1]
}
func (x SpanRefType) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use SpanRefType.Descriptor instead.
func (SpanRefType) EnumDescriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{1}
}
type KeyValue struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
VType ValueType `protobuf:"varint,2,opt,name=v_type,json=vType,proto3,enum=jaeger.api_v2.ValueType" json:"v_type,omitempty"`
VStr string `protobuf:"bytes,3,opt,name=v_str,json=vStr,proto3" json:"v_str,omitempty"`
VBool bool `protobuf:"varint,4,opt,name=v_bool,json=vBool,proto3" json:"v_bool,omitempty"`
VInt64 int64 `protobuf:"varint,5,opt,name=v_int64,json=vInt64,proto3" json:"v_int64,omitempty"`
VFloat64 float64 `protobuf:"fixed64,6,opt,name=v_float64,json=vFloat64,proto3" json:"v_float64,omitempty"`
VBinary []byte `protobuf:"bytes,7,opt,name=v_binary,json=vBinary,proto3" json:"v_binary,omitempty"`
}
func (x *KeyValue) Reset() {
*x = KeyValue{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *KeyValue) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*KeyValue) ProtoMessage() {}
func (x *KeyValue) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use KeyValue.ProtoReflect.Descriptor instead.
func (*KeyValue) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{0}
}
func (x *KeyValue) GetKey() string {
if x != nil {
return x.Key
}
return ""
}
func (x *KeyValue) GetVType() ValueType {
if x != nil {
return x.VType
}
return ValueType_STRING
}
func (x *KeyValue) GetVStr() string {
if x != nil {
return x.VStr
}
return ""
}
func (x *KeyValue) GetVBool() bool {
if x != nil {
return x.VBool
}
return false
}
func (x *KeyValue) GetVInt64() int64 {
if x != nil {
return x.VInt64
}
return 0
}
func (x *KeyValue) GetVFloat64() float64 {
if x != nil {
return x.VFloat64
}
return 0
}
func (x *KeyValue) GetVBinary() []byte {
if x != nil {
return x.VBinary
}
return nil
}
type Log struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timestamp *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
Fields []*KeyValue `protobuf:"bytes,2,rep,name=fields,proto3" json:"fields,omitempty"`
}
func (x *Log) Reset() {
*x = Log{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Log) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Log) ProtoMessage() {}
func (x *Log) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Log.ProtoReflect.Descriptor instead.
func (*Log) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{1}
}
func (x *Log) GetTimestamp() *timestamppb.Timestamp {
if x != nil {
return x.Timestamp
}
return nil
}
func (x *Log) GetFields() []*KeyValue {
if x != nil {
return x.Fields
}
return nil
}
type SpanRef struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"`
RefType SpanRefType `protobuf:"varint,3,opt,name=ref_type,json=refType,proto3,enum=jaeger.api_v2.SpanRefType" json:"ref_type,omitempty"`
}
func (x *SpanRef) Reset() {
*x = SpanRef{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SpanRef) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpanRef) ProtoMessage() {}
func (x *SpanRef) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SpanRef.ProtoReflect.Descriptor instead.
func (*SpanRef) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{2}
}
func (x *SpanRef) GetTraceId() []byte {
if x != nil {
return x.TraceId
}
return nil
}
func (x *SpanRef) GetSpanId() []byte {
if x != nil {
return x.SpanId
}
return nil
}
func (x *SpanRef) GetRefType() SpanRefType {
if x != nil {
return x.RefType
}
return SpanRefType_CHILD_OF
}
type Process struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
Tags []*KeyValue `protobuf:"bytes,2,rep,name=tags,proto3" json:"tags,omitempty"`
}
func (x *Process) Reset() {
*x = Process{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Process) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Process) ProtoMessage() {}
func (x *Process) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Process.ProtoReflect.Descriptor instead.
func (*Process) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{3}
}
func (x *Process) GetServiceName() string {
if x != nil {
return x.ServiceName
}
return ""
}
func (x *Process) GetTags() []*KeyValue {
if x != nil {
return x.Tags
}
return nil
}
type Span struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"`
OperationName string `protobuf:"bytes,3,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"`
References []*SpanRef `protobuf:"bytes,4,rep,name=references,proto3" json:"references,omitempty"`
Flags uint32 `protobuf:"varint,5,opt,name=flags,proto3" json:"flags,omitempty"`
StartTime *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
Duration *durationpb.Duration `protobuf:"bytes,7,opt,name=duration,proto3" json:"duration,omitempty"`
Tags []*KeyValue `protobuf:"bytes,8,rep,name=tags,proto3" json:"tags,omitempty"`
Logs []*Log `protobuf:"bytes,9,rep,name=logs,proto3" json:"logs,omitempty"`
Process *Process `protobuf:"bytes,10,opt,name=process,proto3" json:"process,omitempty"`
ProcessId string `protobuf:"bytes,11,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"`
Warnings []string `protobuf:"bytes,12,rep,name=warnings,proto3" json:"warnings,omitempty"`
}
func (x *Span) Reset() {
*x = Span{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Span) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Span) ProtoMessage() {}
func (x *Span) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Span.ProtoReflect.Descriptor instead.
func (*Span) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{4}
}
func (x *Span) GetTraceId() []byte {
if x != nil {
return x.TraceId
}
return nil
}
func (x *Span) GetSpanId() []byte {
if x != nil {
return x.SpanId
}
return nil
}
func (x *Span) GetOperationName() string {
if x != nil {
return x.OperationName
}
return ""
}
func (x *Span) GetReferences() []*SpanRef {
if x != nil {
return x.References
}
return nil
}
func (x *Span) GetFlags() uint32 {
if x != nil {
return x.Flags
}
return 0
}
func (x *Span) GetStartTime() *timestamppb.Timestamp {
if x != nil {
return x.StartTime
}
return nil
}
func (x *Span) GetDuration() *durationpb.Duration {
if x != nil {
return x.Duration
}
return nil
}
func (x *Span) GetTags() []*KeyValue {
if x != nil {
return x.Tags
}
return nil
}
func (x *Span) GetLogs() []*Log {
if x != nil {
return x.Logs
}
return nil
}
func (x *Span) GetProcess() *Process {
if x != nil {
return x.Process
}
return nil
}
func (x *Span) GetProcessId() string {
if x != nil {
return x.ProcessId
}
return ""
}
func (x *Span) GetWarnings() []string {
if x != nil {
return x.Warnings
}
return nil
}
type Trace struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Spans []*Span `protobuf:"bytes,1,rep,name=spans,proto3" json:"spans,omitempty"`
ProcessMap []*Trace_ProcessMapping `protobuf:"bytes,2,rep,name=process_map,json=processMap,proto3" json:"process_map,omitempty"`
Warnings []string `protobuf:"bytes,3,rep,name=warnings,proto3" json:"warnings,omitempty"`
}
func (x *Trace) Reset() {
*x = Trace{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Trace) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Trace) ProtoMessage() {}
func (x *Trace) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Trace.ProtoReflect.Descriptor instead.
func (*Trace) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{5}
}
func (x *Trace) GetSpans() []*Span {
if x != nil {
return x.Spans
}
return nil
}
func (x *Trace) GetProcessMap() []*Trace_ProcessMapping {
if x != nil {
return x.ProcessMap
}
return nil
}
func (x *Trace) GetWarnings() []string {
if x != nil {
return x.Warnings
}
return nil
}
// Note that both Span and Batch may contain a Process.
// This is different from the Thrift model which was only used
// for transport, because Proto model is also used by the backend
// as the domain model, where once a batch is received it is split
// into individual spans which are all processed independently,
// and therefore they all need a Process. As far as on-the-wire
// semantics, both Batch and Spans in the same message may contain
// their own instances of Process, with span.Process taking priority
// over batch.Process.
type Batch struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Spans []*Span `protobuf:"bytes,1,rep,name=spans,proto3" json:"spans,omitempty"`
Process *Process `protobuf:"bytes,2,opt,name=process,proto3" json:"process,omitempty"`
}
func (x *Batch) Reset() {
*x = Batch{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Batch) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Batch) ProtoMessage() {}
func (x *Batch) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Batch.ProtoReflect.Descriptor instead.
func (*Batch) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{6}
}
func (x *Batch) GetSpans() []*Span {
if x != nil {
return x.Spans
}
return nil
}
func (x *Batch) GetProcess() *Process {
if x != nil {
return x.Process
}
return nil
}
type DependencyLink struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Parent string `protobuf:"bytes,1,opt,name=parent,proto3" json:"parent,omitempty"`
Child string `protobuf:"bytes,2,opt,name=child,proto3" json:"child,omitempty"`
CallCount uint64 `protobuf:"varint,3,opt,name=call_count,json=callCount,proto3" json:"call_count,omitempty"`
Source string `protobuf:"bytes,4,opt,name=source,proto3" json:"source,omitempty"`
}
func (x *DependencyLink) Reset() {
*x = DependencyLink{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DependencyLink) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DependencyLink) ProtoMessage() {}
func (x *DependencyLink) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use DependencyLink.ProtoReflect.Descriptor instead.
func (*DependencyLink) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{7}
}
func (x *DependencyLink) GetParent() string {
if x != nil {
return x.Parent
}
return ""
}
func (x *DependencyLink) GetChild() string {
if x != nil {
return x.Child
}
return ""
}
func (x *DependencyLink) GetCallCount() uint64 {
if x != nil {
return x.CallCount
}
return 0
}
func (x *DependencyLink) GetSource() string {
if x != nil {
return x.Source
}
return ""
}
type Trace_ProcessMapping struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ProcessId string `protobuf:"bytes,1,opt,name=process_id,json=processId,proto3" json:"process_id,omitempty"`
Process *Process `protobuf:"bytes,2,opt,name=process,proto3" json:"process,omitempty"`
}
func (x *Trace_ProcessMapping) Reset() {
*x = Trace_ProcessMapping{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_model_model_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Trace_ProcessMapping) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Trace_ProcessMapping) ProtoMessage() {}
func (x *Trace_ProcessMapping) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_model_model_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Trace_ProcessMapping.ProtoReflect.Descriptor instead.
func (*Trace_ProcessMapping) Descriptor() ([]byte, []int) {
return file_jaeger_model_model_proto_rawDescGZIP(), []int{5, 0}
}
func (x *Trace_ProcessMapping) GetProcessId() string {
if x != nil {
return x.ProcessId
}
return ""
}
func (x *Trace_ProcessMapping) GetProcess() *Process {
if x != nil {
return x.Process
}
return nil
}
var File_jaeger_model_model_proto protoreflect.FileDescriptor
var file_jaeger_model_model_proto_rawDesc = []byte{
0x0a, 0x18, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2f, 0x6d,
0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6a, 0x61, 0x65, 0x67,
0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a,
0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66,
0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x1e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x22, 0xd4, 0x01, 0x0a, 0x08, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x10, 0x0a,
0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
0x2f, 0x0a, 0x06, 0x76, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32,
0x18, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e,
0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x52, 0x05, 0x76, 0x54, 0x79, 0x70, 0x65,
0x12, 0x13, 0x0a, 0x05, 0x76, 0x5f, 0x73, 0x74, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52,
0x04, 0x76, 0x53, 0x74, 0x72, 0x12, 0x15, 0x0a, 0x06, 0x76, 0x5f, 0x62, 0x6f, 0x6f, 0x6c, 0x18,
0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x76, 0x42, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07,
0x76, 0x5f, 0x69, 0x6e, 0x74, 0x36, 0x34, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x76,
0x49, 0x6e, 0x74, 0x36, 0x34, 0x12, 0x1b, 0x0a, 0x09, 0x76, 0x5f, 0x66, 0x6c, 0x6f, 0x61, 0x74,
0x36, 0x34, 0x18, 0x06, 0x20, 0x01, 0x28, 0x01, 0x52, 0x08, 0x76, 0x46, 0x6c, 0x6f, 0x61, 0x74,
0x36, 0x34, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x5f, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x18, 0x07,
0x20, 0x01, 0x28, 0x0c, 0x52, 0x07, 0x76, 0x42, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x3a, 0x08, 0xe8,
0xa0, 0x1f, 0x01, 0xe8, 0xa1, 0x1f, 0x01, 0x22, 0x80, 0x01, 0x0a, 0x03, 0x4c, 0x6f, 0x67, 0x12,
0x42, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x01, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08,
0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74,
0x61, 0x6d, 0x70, 0x12, 0x35, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69,
0x5f, 0x76, 0x32, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x04, 0xc8, 0xde,
0x1f, 0x00, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x22, 0xaa, 0x01, 0x0a, 0x07, 0x53,
0x70, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x12, 0x35, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f,
0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x1a, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde,
0x1f, 0x07, 0x54, 0x72, 0x61, 0x63, 0x65, 0x49, 0x44, 0xe2, 0xde, 0x1f, 0x07, 0x54, 0x72, 0x61,
0x63, 0x65, 0x49, 0x44, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a,
0x07, 0x73, 0x70, 0x61, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x18,
0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x06, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x44, 0xe2, 0xde,
0x1f, 0x06, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x44, 0x52, 0x06, 0x73, 0x70, 0x61, 0x6e, 0x49, 0x64,
0x12, 0x35, 0x0a, 0x08, 0x72, 0x65, 0x66, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01,
0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f,
0x76, 0x32, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x54, 0x79, 0x70, 0x65, 0x52, 0x07,
0x72, 0x65, 0x66, 0x54, 0x79, 0x70, 0x65, 0x22, 0x5f, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x63, 0x65,
0x73, 0x73, 0x12, 0x21, 0x0a, 0x0c, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x6e, 0x61,
0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63,
0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x74, 0x61, 0x67, 0x73, 0x18, 0x02, 0x20,
0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69,
0x5f, 0x76, 0x32, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x42, 0x04, 0xc8, 0xde,
0x1f, 0x00, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x22, 0xdd, 0x04, 0x0a, 0x04, 0x53, 0x70, 0x61,
0x6e, 0x12, 0x35, 0x0a, 0x08, 0x74, 0x72, 0x61, 0x63, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0c, 0x42, 0x1a, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x07, 0x54, 0x72, 0x61,
0x63, 0x65, 0x49, 0x44, 0xe2, 0xde, 0x1f, 0x07, 0x54, 0x72, 0x61, 0x63, 0x65, 0x49, 0x44, 0x52,
0x07, 0x74, 0x72, 0x61, 0x63, 0x65, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x07, 0x73, 0x70, 0x61, 0x6e,
0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x42, 0x18, 0xc8, 0xde, 0x1f, 0x00, 0xda,
0xde, 0x1f, 0x06, 0x53, 0x70, 0x61, 0x6e, 0x49, 0x44, 0xe2, 0xde, 0x1f, 0x06, 0x53, 0x70, 0x61,
0x6e, 0x49, 0x44, 0x52, 0x06, 0x73, 0x70, 0x61, 0x6e, 0x49, 0x64, 0x12, 0x25, 0x0a, 0x0e, 0x6f,
0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20,
0x01, 0x28, 0x09, 0x52, 0x0d, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x61,
0x6d, 0x65, 0x12, 0x3c, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e,
0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x42, 0x04,
0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
0x12, 0x23, 0x0a, 0x05, 0x66, 0x6c, 0x61, 0x67, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x42,
0x0d, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x05, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x52, 0x05,
0x66, 0x6c, 0x61, 0x67, 0x73, 0x12, 0x43, 0x0a, 0x0a, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74,
0x69, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
0x73, 0x74, 0x61, 0x6d, 0x70, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x90, 0xdf, 0x1f, 0x01, 0x52,
0x09, 0x73, 0x74, 0x61, 0x72, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x3f, 0x0a, 0x08, 0x64, 0x75,
0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x44,
0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x08, 0xc8, 0xde, 0x1f, 0x00, 0x98, 0xdf, 0x1f,
0x01, 0x52, 0x08, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x31, 0x0a, 0x04, 0x74,
0x61, 0x67, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x6a, 0x61, 0x65, 0x67,
0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x4b, 0x65, 0x79, 0x56, 0x61, 0x6c,
0x75, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x2c,
0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x6a,
0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x4c, 0x6f, 0x67,
0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x12, 0x30, 0x0a, 0x07,
0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e,
0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x50, 0x72,
0x6f, 0x63, 0x65, 0x73, 0x73, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x12, 0x2c,
0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x0b, 0x20, 0x01,
0x28, 0x09, 0x42, 0x0d, 0xe2, 0xde, 0x1f, 0x09, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49,
0x44, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x64, 0x12, 0x1a, 0x0a, 0x08,
0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x0c, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
0x77, 0x61, 0x72, 0x6e, 0x69, 0x6e, 0x67, 0x73, 0x22, 0x92, 0x02, 0x0a, 0x05, 0x54, 0x72, 0x61,
0x63, 0x65, 0x12, 0x29, 0x0a, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x0b, 0x32, 0x13, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76,
0x32, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x12, 0x4a, 0x0a,
0x0b, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0b, 0x32, 0x23, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f,
0x76, 0x32, 0x2e, 0x54, 0x72, 0x61, 0x63, 0x65, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70,
0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x4d, 0x61, 0x70, 0x12, 0x1a, 0x0a, 0x08, 0x77, 0x61, 0x72,
0x6e, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x77, 0x61, 0x72,
0x6e, 0x69, 0x6e, 0x67, 0x73, 0x1a, 0x76, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x2c, 0x0a, 0x0a, 0x70, 0x72, 0x6f, 0x63, 0x65,
0x73, 0x73, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x0d, 0xe2, 0xde, 0x1f,
0x09, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x49, 0x44, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x63,
0x65, 0x73, 0x73, 0x49, 0x64, 0x12, 0x36, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73,
0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e,
0x61, 0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x42, 0x04,
0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x22, 0x6a, 0x0a,
0x05, 0x42, 0x61, 0x74, 0x63, 0x68, 0x12, 0x29, 0x0a, 0x05, 0x73, 0x70, 0x61, 0x6e, 0x73, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61,
0x70, 0x69, 0x5f, 0x76, 0x32, 0x2e, 0x53, 0x70, 0x61, 0x6e, 0x52, 0x05, 0x73, 0x70, 0x61, 0x6e,
0x73, 0x12, 0x36, 0x0a, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0b, 0x32, 0x16, 0x2e, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69, 0x5f,
0x76, 0x32, 0x2e, 0x50, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x01,
0x52, 0x07, 0x70, 0x72, 0x6f, 0x63, 0x65, 0x73, 0x73, 0x22, 0x75, 0x0a, 0x0e, 0x44, 0x65, 0x70,
0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x4c, 0x69, 0x6e, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x70,
0x61, 0x72, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72,
0x65, 0x6e, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x09, 0x52, 0x05, 0x63, 0x68, 0x69, 0x6c, 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x61, 0x6c,
0x6c, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x63,
0x61, 0x6c, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72,
0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
0x2a, 0x45, 0x0a, 0x09, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0a, 0x0a,
0x06, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x42, 0x4f, 0x4f,
0x4c, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x49, 0x4e, 0x54, 0x36, 0x34, 0x10, 0x02, 0x12, 0x0b,
0x0a, 0x07, 0x46, 0x4c, 0x4f, 0x41, 0x54, 0x36, 0x34, 0x10, 0x03, 0x12, 0x0a, 0x0a, 0x06, 0x42,
0x49, 0x4e, 0x41, 0x52, 0x59, 0x10, 0x04, 0x2a, 0x2d, 0x0a, 0x0b, 0x53, 0x70, 0x61, 0x6e, 0x52,
0x65, 0x66, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0c, 0x0a, 0x08, 0x43, 0x48, 0x49, 0x4c, 0x44, 0x5f,
0x4f, 0x46, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x46, 0x4f, 0x4c, 0x4c, 0x4f, 0x57, 0x53, 0x5f,
0x46, 0x52, 0x4f, 0x4d, 0x10, 0x01, 0x42, 0x71, 0x0a, 0x17, 0x69, 0x6f, 0x2e, 0x6a, 0x61, 0x65,
0x67, 0x65, 0x72, 0x74, 0x72, 0x61, 0x63, 0x69, 0x6e, 0x67, 0x2e, 0x61, 0x70, 0x69, 0x5f, 0x76,
0x32, 0x5a, 0x4a, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x50, 0x61,
0x63, 0x6b, 0x74, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x73, 0x68, 0x69, 0x6e, 0x67, 0x2f, 0x47, 0x6f,
0x2d, 0x66, 0x6f, 0x72, 0x2d, 0x44, 0x65, 0x76, 0x4f, 0x70, 0x73, 0x2f, 0x63, 0x68, 0x61, 0x70,
0x74, 0x65, 0x72, 0x2f, 0x31, 0x30, 0x2f, 0x6f, 0x70, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x2f, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0xc8, 0xe2, 0x1e,
0x01, 0xd0, 0xe2, 0x1e, 0x01, 0xe0, 0xe2, 0x1e, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_jaeger_model_model_proto_rawDescOnce sync.Once
file_jaeger_model_model_proto_rawDescData = file_jaeger_model_model_proto_rawDesc
)
func file_jaeger_model_model_proto_rawDescGZIP() []byte {
file_jaeger_model_model_proto_rawDescOnce.Do(func() {
file_jaeger_model_model_proto_rawDescData = protoimpl.X.CompressGZIP(file_jaeger_model_model_proto_rawDescData)
})
return file_jaeger_model_model_proto_rawDescData
}
var file_jaeger_model_model_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_jaeger_model_model_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_jaeger_model_model_proto_goTypes = []interface{}{
(ValueType)(0), // 0: jaeger.api_v2.ValueType
(SpanRefType)(0), // 1: jaeger.api_v2.SpanRefType
(*KeyValue)(nil), // 2: jaeger.api_v2.KeyValue
(*Log)(nil), // 3: jaeger.api_v2.Log
(*SpanRef)(nil), // 4: jaeger.api_v2.SpanRef
(*Process)(nil), // 5: jaeger.api_v2.Process
(*Span)(nil), // 6: jaeger.api_v2.Span
(*Trace)(nil), // 7: jaeger.api_v2.Trace
(*Batch)(nil), // 8: jaeger.api_v2.Batch
(*DependencyLink)(nil), // 9: jaeger.api_v2.DependencyLink
(*Trace_ProcessMapping)(nil), // 10: jaeger.api_v2.Trace.ProcessMapping
(*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp
(*durationpb.Duration)(nil), // 12: google.protobuf.Duration
}
var file_jaeger_model_model_proto_depIdxs = []int32{
0, // 0: jaeger.api_v2.KeyValue.v_type:type_name -> jaeger.api_v2.ValueType
11, // 1: jaeger.api_v2.Log.timestamp:type_name -> google.protobuf.Timestamp
2, // 2: jaeger.api_v2.Log.fields:type_name -> jaeger.api_v2.KeyValue
1, // 3: jaeger.api_v2.SpanRef.ref_type:type_name -> jaeger.api_v2.SpanRefType
2, // 4: jaeger.api_v2.Process.tags:type_name -> jaeger.api_v2.KeyValue
4, // 5: jaeger.api_v2.Span.references:type_name -> jaeger.api_v2.SpanRef
11, // 6: jaeger.api_v2.Span.start_time:type_name -> google.protobuf.Timestamp
12, // 7: jaeger.api_v2.Span.duration:type_name -> google.protobuf.Duration
2, // 8: jaeger.api_v2.Span.tags:type_name -> jaeger.api_v2.KeyValue
3, // 9: jaeger.api_v2.Span.logs:type_name -> jaeger.api_v2.Log
5, // 10: jaeger.api_v2.Span.process:type_name -> jaeger.api_v2.Process
6, // 11: jaeger.api_v2.Trace.spans:type_name -> jaeger.api_v2.Span
10, // 12: jaeger.api_v2.Trace.process_map:type_name -> jaeger.api_v2.Trace.ProcessMapping
6, // 13: jaeger.api_v2.Batch.spans:type_name -> jaeger.api_v2.Span
5, // 14: jaeger.api_v2.Batch.process:type_name -> jaeger.api_v2.Process
5, // 15: jaeger.api_v2.Trace.ProcessMapping.process:type_name -> jaeger.api_v2.Process
16, // [16:16] is the sub-list for method output_type
16, // [16:16] is the sub-list for method input_type
16, // [16:16] is the sub-list for extension type_name
16, // [16:16] is the sub-list for extension extendee
0, // [0:16] is the sub-list for field type_name
}
func init() { file_jaeger_model_model_proto_init() }
func file_jaeger_model_model_proto_init() {
if File_jaeger_model_model_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_jaeger_model_model_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*KeyValue); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Log); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SpanRef); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Process); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Span); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Trace); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Batch); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DependencyLink); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_jaeger_model_model_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Trace_ProcessMapping); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_jaeger_model_model_proto_rawDesc,
NumEnums: 2,
NumMessages: 9,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_jaeger_model_model_proto_goTypes,
DependencyIndexes: file_jaeger_model_model_proto_depIdxs,
EnumInfos: file_jaeger_model_model_proto_enumTypes,
MessageInfos: file_jaeger_model_model_proto_msgTypes,
}.Build()
File_jaeger_model_model_proto = out.File
file_jaeger_model_model_proto_rawDesc = nil
file_jaeger_model_model_proto_goTypes = nil
file_jaeger_model_model_proto_depIdxs = nil
}
================================================
FILE: chapter/11/ops/proto/jaeger/model/model.proto
================================================
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax="proto3";
package jaeger.api_v2;
import "gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "google/protobuf/duration.proto";
// TODO: document all types and fields
// TODO: once this moves to jaeger-idl repo, we may want to change Go pkg to api_v2
// and rewrite it to model only in this repo. That should make it easier to generate
// classes in other languages.
option go_package = "github.com/PacktPublishing/Go-for-DevOps/chapter/10/ops/proto/jaeger/model";
option java_package = "io.jaegertracing.api_v2";
// Enable gogoprotobuf extensions (https://github.com/gogo/protobuf/blob/master/extensions.md).
// Enable custom Marshal method.
option (gogoproto.marshaler_all) = true;
// Enable custom Unmarshal method.
option (gogoproto.unmarshaler_all) = true;
// Enable custom Size method (Required by Marshal and Unmarshal).
option (gogoproto.sizer_all) = true;
enum ValueType {
STRING = 0;
BOOL = 1;
INT64 = 2;
FLOAT64 = 3;
BINARY = 4;
};
message KeyValue {
option (gogoproto.equal) = true;
option (gogoproto.compare) = true;
string key = 1;
ValueType v_type = 2;
string v_str = 3;
bool v_bool = 4;
int64 v_int64 = 5;
double v_float64 = 6;
bytes v_binary = 7;
}
message Log {
google.protobuf.Timestamp timestamp = 1 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
repeated KeyValue fields = 2 [
(gogoproto.nullable) = false
];
}
enum SpanRefType {
CHILD_OF = 0;
FOLLOWS_FROM = 1;
};
message SpanRef {
bytes trace_id = 1 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "TraceID",
(gogoproto.customname) = "TraceID"
];
bytes span_id = 2 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "SpanID",
(gogoproto.customname) = "SpanID"
];
SpanRefType ref_type = 3;
}
message Process {
string service_name = 1;
repeated KeyValue tags = 2 [
(gogoproto.nullable) = false
];
}
message Span {
bytes trace_id = 1 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "TraceID",
(gogoproto.customname) = "TraceID"
];
bytes span_id = 2 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "SpanID",
(gogoproto.customname) = "SpanID"
];
string operation_name = 3;
repeated SpanRef references = 4 [
(gogoproto.nullable) = false
];
uint32 flags = 5 [
(gogoproto.nullable) = false,
(gogoproto.customtype) = "Flags"
];
google.protobuf.Timestamp start_time = 6 [
(gogoproto.stdtime) = true,
(gogoproto.nullable) = false
];
google.protobuf.Duration duration = 7 [
(gogoproto.stdduration) = true,
(gogoproto.nullable) = false
];
repeated KeyValue tags = 8 [
(gogoproto.nullable) = false
];
repeated Log logs = 9 [
(gogoproto.nullable) = false
];
Process process = 10;
string process_id = 11 [
(gogoproto.customname) = "ProcessID"
];
repeated string warnings = 12;
}
message Trace {
message ProcessMapping {
string process_id = 1 [
(gogoproto.customname) = "ProcessID"
];
Process process = 2 [
(gogoproto.nullable) = false
];
}
repeated Span spans = 1;
repeated ProcessMapping process_map = 2 [
(gogoproto.nullable) = false
];
repeated string warnings = 3;
}
// Note that both Span and Batch may contain a Process.
// This is different from the Thrift model which was only used
// for transport, because Proto model is also used by the backend
// as the domain model, where once a batch is received it is split
// into individual spans which are all processed independently,
// and therefore they all need a Process. As far as on-the-wire
// semantics, both Batch and Spans in the same message may contain
// their own instances of Process, with span.Process taking priority
// over batch.Process.
message Batch {
repeated Span spans = 1;
Process process = 2 [
(gogoproto.nullable) = true
];
}
message DependencyLink {
string parent = 1;
string child = 2;
uint64 call_count = 3;
string source = 4;
}
================================================
FILE: chapter/11/ops/proto/jaeger/query.pb.go
================================================
// Copyright (c) 2019 The Jaeger Authors.
// Copyright (c) 2018 Uber Technologies, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.18.0
// source: jaeger/query.proto
package jaeger
import (
model "github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/proto/jaeger/model"
_ "github.com/gogo/protobuf/gogoproto"
_ "google.golang.org/genproto/googleapis/api/annotations"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
durationpb "google.golang.org/protobuf/types/known/durationpb"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetTraceRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
}
func (x *GetTraceRequest) Reset() {
*x = GetTraceRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetTraceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetTraceRequest) ProtoMessage() {}
func (x *GetTraceRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetTraceRequest.ProtoReflect.Descriptor instead.
func (*GetTraceRequest) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{0}
}
func (x *GetTraceRequest) GetTraceId() []byte {
if x != nil {
return x.TraceId
}
return nil
}
type SpansResponseChunk struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Spans []*model.Span `protobuf:"bytes,1,rep,name=spans,proto3" json:"spans,omitempty"`
}
func (x *SpansResponseChunk) Reset() {
*x = SpansResponseChunk{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *SpansResponseChunk) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*SpansResponseChunk) ProtoMessage() {}
func (x *SpansResponseChunk) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use SpansResponseChunk.ProtoReflect.Descriptor instead.
func (*SpansResponseChunk) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{1}
}
func (x *SpansResponseChunk) GetSpans() []*model.Span {
if x != nil {
return x.Spans
}
return nil
}
type ArchiveTraceRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"`
}
func (x *ArchiveTraceRequest) Reset() {
*x = ArchiveTraceRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ArchiveTraceRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ArchiveTraceRequest) ProtoMessage() {}
func (x *ArchiveTraceRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ArchiveTraceRequest.ProtoReflect.Descriptor instead.
func (*ArchiveTraceRequest) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{2}
}
func (x *ArchiveTraceRequest) GetTraceId() []byte {
if x != nil {
return x.TraceId
}
return nil
}
type ArchiveTraceResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *ArchiveTraceResponse) Reset() {
*x = ArchiveTraceResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *ArchiveTraceResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*ArchiveTraceResponse) ProtoMessage() {}
func (x *ArchiveTraceResponse) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use ArchiveTraceResponse.ProtoReflect.Descriptor instead.
func (*ArchiveTraceResponse) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{3}
}
type TraceQueryParameters struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
OperationName string `protobuf:"bytes,2,opt,name=operation_name,json=operationName,proto3" json:"operation_name,omitempty"`
Tags map[string]string `protobuf:"bytes,3,rep,name=tags,proto3" json:"tags,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
StartTimeMin *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=start_time_min,json=startTimeMin,proto3" json:"start_time_min,omitempty"`
StartTimeMax *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=start_time_max,json=startTimeMax,proto3" json:"start_time_max,omitempty"`
DurationMin *durationpb.Duration `protobuf:"bytes,6,opt,name=duration_min,json=durationMin,proto3" json:"duration_min,omitempty"`
DurationMax *durationpb.Duration `protobuf:"bytes,7,opt,name=duration_max,json=durationMax,proto3" json:"duration_max,omitempty"`
SearchDepth int32 `protobuf:"varint,8,opt,name=search_depth,json=searchDepth,proto3" json:"search_depth,omitempty"`
}
func (x *TraceQueryParameters) Reset() {
*x = TraceQueryParameters{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *TraceQueryParameters) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*TraceQueryParameters) ProtoMessage() {}
func (x *TraceQueryParameters) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use TraceQueryParameters.ProtoReflect.Descriptor instead.
func (*TraceQueryParameters) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{4}
}
func (x *TraceQueryParameters) GetServiceName() string {
if x != nil {
return x.ServiceName
}
return ""
}
func (x *TraceQueryParameters) GetOperationName() string {
if x != nil {
return x.OperationName
}
return ""
}
func (x *TraceQueryParameters) GetTags() map[string]string {
if x != nil {
return x.Tags
}
return nil
}
func (x *TraceQueryParameters) GetStartTimeMin() *timestamppb.Timestamp {
if x != nil {
return x.StartTimeMin
}
return nil
}
func (x *TraceQueryParameters) GetStartTimeMax() *timestamppb.Timestamp {
if x != nil {
return x.StartTimeMax
}
return nil
}
func (x *TraceQueryParameters) GetDurationMin() *durationpb.Duration {
if x != nil {
return x.DurationMin
}
return nil
}
func (x *TraceQueryParameters) GetDurationMax() *durationpb.Duration {
if x != nil {
return x.DurationMax
}
return nil
}
func (x *TraceQueryParameters) GetSearchDepth() int32 {
if x != nil {
return x.SearchDepth
}
return 0
}
type FindTracesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Query *TraceQueryParameters `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
}
func (x *FindTracesRequest) Reset() {
*x = FindTracesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *FindTracesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*FindTracesRequest) ProtoMessage() {}
func (x *FindTracesRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use FindTracesRequest.ProtoReflect.Descriptor instead.
func (*FindTracesRequest) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{5}
}
func (x *FindTracesRequest) GetQuery() *TraceQueryParameters {
if x != nil {
return x.Query
}
return nil
}
type GetServicesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *GetServicesRequest) Reset() {
*x = GetServicesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetServicesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetServicesRequest) ProtoMessage() {}
func (x *GetServicesRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetServicesRequest.ProtoReflect.Descriptor instead.
func (*GetServicesRequest) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{6}
}
type GetServicesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Services []string `protobuf:"bytes,1,rep,name=services,proto3" json:"services,omitempty"`
}
func (x *GetServicesResponse) Reset() {
*x = GetServicesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetServicesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetServicesResponse) ProtoMessage() {}
func (x *GetServicesResponse) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetServicesResponse.ProtoReflect.Descriptor instead.
func (*GetServicesResponse) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{7}
}
func (x *GetServicesResponse) GetServices() []string {
if x != nil {
return x.Services
}
return nil
}
type GetOperationsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
SpanKind string `protobuf:"bytes,2,opt,name=span_kind,json=spanKind,proto3" json:"span_kind,omitempty"`
}
func (x *GetOperationsRequest) Reset() {
*x = GetOperationsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetOperationsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetOperationsRequest) ProtoMessage() {}
func (x *GetOperationsRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[8]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetOperationsRequest.ProtoReflect.Descriptor instead.
func (*GetOperationsRequest) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{8}
}
func (x *GetOperationsRequest) GetService() string {
if x != nil {
return x.Service
}
return ""
}
func (x *GetOperationsRequest) GetSpanKind() string {
if x != nil {
return x.SpanKind
}
return ""
}
type Operation struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
SpanKind string `protobuf:"bytes,2,opt,name=span_kind,json=spanKind,proto3" json:"span_kind,omitempty"`
}
func (x *Operation) Reset() {
*x = Operation{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Operation) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Operation) ProtoMessage() {}
func (x *Operation) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use Operation.ProtoReflect.Descriptor instead.
func (*Operation) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{9}
}
func (x *Operation) GetName() string {
if x != nil {
return x.Name
}
return ""
}
func (x *Operation) GetSpanKind() string {
if x != nil {
return x.SpanKind
}
return ""
}
type GetOperationsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OperationNames []string `protobuf:"bytes,1,rep,name=operationNames,proto3" json:"operationNames,omitempty"` //deprecated
Operations []*Operation `protobuf:"bytes,2,rep,name=operations,proto3" json:"operations,omitempty"`
}
func (x *GetOperationsResponse) Reset() {
*x = GetOperationsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetOperationsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetOperationsResponse) ProtoMessage() {}
func (x *GetOperationsResponse) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetOperationsResponse.ProtoReflect.Descriptor instead.
func (*GetOperationsResponse) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{10}
}
func (x *GetOperationsResponse) GetOperationNames() []string {
if x != nil {
return x.OperationNames
}
return nil
}
func (x *GetOperationsResponse) GetOperations() []*Operation {
if x != nil {
return x.Operations
}
return nil
}
type GetDependenciesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
StartTime *timestamppb.Timestamp `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
EndTime *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
}
func (x *GetDependenciesRequest) Reset() {
*x = GetDependenciesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetDependenciesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetDependenciesRequest) ProtoMessage() {}
func (x *GetDependenciesRequest) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[11]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetDependenciesRequest.ProtoReflect.Descriptor instead.
func (*GetDependenciesRequest) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{11}
}
func (x *GetDependenciesRequest) GetStartTime() *timestamppb.Timestamp {
if x != nil {
return x.StartTime
}
return nil
}
func (x *GetDependenciesRequest) GetEndTime() *timestamppb.Timestamp {
if x != nil {
return x.EndTime
}
return nil
}
type GetDependenciesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Dependencies []*model.DependencyLink `protobuf:"bytes,1,rep,name=dependencies,proto3" json:"dependencies,omitempty"`
}
func (x *GetDependenciesResponse) Reset() {
*x = GetDependenciesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_jaeger_query_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetDependenciesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetDependenciesResponse) ProtoMessage() {}
func (x *GetDependenciesResponse) ProtoReflect() protoreflect.Message {
mi := &file_jaeger_query_proto_msgTypes[12]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetDependenciesResponse.ProtoReflect.Descriptor instead.
func (*GetDependenciesResponse) Descriptor() ([]byte, []int) {
return file_jaeger_query_proto_rawDescGZIP(), []int{12}
}
func (x *GetDependenciesResponse) GetDependencies() []*model.DependencyLink {
if x != nil {
return x.Dependencies
}
return nil
}
var File_jaeger_query_proto protoreflect.FileDescriptor
var file_jaeger_query_proto_rawDesc = []byte{
0x0a, 0x12, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2f, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2e, 0x61, 0x70, 0x69,
0x5f, 0x76, 0x32, 0x1a, 0x18, 0x6a, 0x61, 0x65, 0x67, 0x65, 0x72, 0x2f, 0x6d, 0x6f, 0x64, 0x65,
0x6c, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
gitextract_rgfwv7jv/ ├── .gitignore ├── LICENSE ├── README.md ├── chapter/ │ ├── 10/ │ │ ├── .github/ │ │ │ ├── release.yml │ │ │ └── workflows/ │ │ │ ├── action-version.yaml │ │ │ ├── first.yaml │ │ │ ├── image-release.yaml │ │ │ └── tweeter-automation.yaml │ │ ├── .gitignore │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── action.yaml │ │ ├── go.mod │ │ ├── go.sum │ │ ├── main.go │ │ └── pkg/ │ │ └── tweeter/ │ │ ├── tweeter.go │ │ └── tweeter_test.go │ ├── 11/ │ │ ├── Dockerfile │ │ ├── README.md │ │ ├── chatbot/ │ │ │ ├── .gitignore │ │ │ ├── bot/ │ │ │ │ └── bot.go │ │ │ ├── chatbot.go │ │ │ ├── internal/ │ │ │ │ └── handlers/ │ │ │ │ ├── handlers.go │ │ │ │ └── help.go │ │ │ └── slack.manifest │ │ ├── docker-compose.yaml │ │ ├── ops/ │ │ │ ├── README.md │ │ │ ├── client/ │ │ │ │ └── client.go │ │ │ ├── internal/ │ │ │ │ ├── jaeger/ │ │ │ │ │ └── client/ │ │ │ │ │ ├── client.go │ │ │ │ │ └── test/ │ │ │ │ │ ├── README.md │ │ │ │ │ ├── client/ │ │ │ │ │ │ └── client.go │ │ │ │ │ ├── docker-compose.yaml │ │ │ │ │ ├── etoe_test.go │ │ │ │ │ ├── otel-collector-config.yaml │ │ │ │ │ └── server/ │ │ │ │ │ ├── Dockerfile │ │ │ │ │ ├── docker-compose.yaml │ │ │ │ │ ├── go.mod │ │ │ │ │ ├── go.sum │ │ │ │ │ ├── main.go │ │ │ │ │ ├── otel-collector-config.yaml │ │ │ │ │ └── readme.md │ │ │ │ ├── prom/ │ │ │ │ │ └── prom.go │ │ │ │ └── server/ │ │ │ │ └── server.go │ │ │ ├── ops.go │ │ │ └── proto/ │ │ │ ├── buf.gen.yaml │ │ │ ├── buf.yaml │ │ │ ├── jaeger/ │ │ │ │ ├── collector.pb.go │ │ │ │ ├── collector.proto │ │ │ │ ├── collector_grpc.pb.go │ │ │ │ ├── model/ │ │ │ │ │ ├── model.pb.go │ │ │ │ │ └── model.proto │ │ │ │ ├── query.pb.go │ │ │ │ ├── query.proto │ │ │ │ ├── query_grpc.pb.go │ │ │ │ ├── sampling.pb.go │ │ │ │ ├── sampling.proto │ │ │ │ └── sampling_grpc.pb.go │ │ │ ├── ops.pb.go │ │ │ ├── ops.proto │ │ │ └── ops_grpc.pb.go │ │ ├── otel-collector-config.yaml │ │ ├── petstore/ │ │ │ ├── Dockerfile │ │ │ ├── README.md │ │ │ ├── client/ │ │ │ │ ├── cli/ │ │ │ │ │ └── petstore/ │ │ │ │ │ └── petstore.go │ │ │ │ ├── client.go │ │ │ │ └── demo/ │ │ │ │ ├── Dockerfile │ │ │ │ ├── demo.go │ │ │ │ └── names.txt │ │ │ ├── docker-compose.yaml │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── internal/ │ │ │ │ └── server/ │ │ │ │ ├── errors/ │ │ │ │ │ └── errors.go │ │ │ │ ├── log/ │ │ │ │ │ └── log.go │ │ │ │ ├── server.go │ │ │ │ ├── storage/ │ │ │ │ │ ├── mem/ │ │ │ │ │ │ ├── mem.go │ │ │ │ │ │ └── mem_test.go │ │ │ │ │ └── storage.go │ │ │ │ └── telemetry/ │ │ │ │ ├── metrics/ │ │ │ │ │ ├── metrics.go │ │ │ │ │ └── start.go │ │ │ │ └── tracing/ │ │ │ │ ├── sampler/ │ │ │ │ │ └── sampler.go │ │ │ │ └── tracing.go │ │ │ ├── otel-collector-config.yaml │ │ │ ├── petstore.go │ │ │ ├── prometheus.yaml │ │ │ └── proto/ │ │ │ ├── buf.gen.yaml │ │ │ ├── buf.yaml │ │ │ ├── petstore.pb.go │ │ │ ├── petstore.proto │ │ │ └── petstore_grpc.pb.go │ │ └── prometheus.yaml │ ├── 12/ │ │ ├── agent.service │ │ ├── goss/ │ │ │ └── allfiles/ │ │ │ └── allfiles.go │ │ └── packer/ │ │ ├── README │ │ ├── amazon.final.pkr.hcl │ │ ├── amazon.goenv.pkr.hcl │ │ └── plugins/ │ │ └── goenv/ │ │ ├── GNUmakefile │ │ ├── LICENSE │ │ ├── goenv.go │ │ └── internal/ │ │ └── config/ │ │ ├── config.go │ │ └── config.hcl2spec.go │ ├── 13/ │ │ └── petstore-provider/ │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── docker-compose.yml │ │ ├── examples/ │ │ │ └── main.tf │ │ ├── go.mod │ │ ├── go.sum │ │ ├── internal/ │ │ │ ├── client/ │ │ │ │ ├── client.go │ │ │ │ ├── internal/ │ │ │ │ │ └── server/ │ │ │ │ │ ├── errors/ │ │ │ │ │ │ └── errors.go │ │ │ │ │ ├── log/ │ │ │ │ │ │ └── log.go │ │ │ │ │ ├── storage/ │ │ │ │ │ │ ├── mem/ │ │ │ │ │ │ │ ├── mem.go │ │ │ │ │ │ │ └── mem_test.go │ │ │ │ │ │ └── storage.go │ │ │ │ │ └── telemetry/ │ │ │ │ │ ├── metrics/ │ │ │ │ │ │ ├── metrics.go │ │ │ │ │ │ └── start.go │ │ │ │ │ └── tracing/ │ │ │ │ │ ├── sampler/ │ │ │ │ │ │ └── sampler.go │ │ │ │ │ └── tracing.go │ │ │ │ └── proto/ │ │ │ │ ├── buf.gen.yaml │ │ │ │ ├── buf.yaml │ │ │ │ ├── petstore.pb.go │ │ │ │ ├── petstore.proto │ │ │ │ └── petstore_grpc.pb.go │ │ │ ├── data_source_pet.go │ │ │ ├── provider.go │ │ │ ├── resource_pets.go │ │ │ └── schema.go │ │ └── main.go │ ├── 14/ │ │ ├── petstore-operator/ │ │ │ ├── .dockerignore │ │ │ ├── .gitignore │ │ │ ├── Dockerfile │ │ │ ├── Makefile │ │ │ ├── PROJECT │ │ │ ├── Tiltfile │ │ │ ├── api/ │ │ │ │ └── v1alpha1/ │ │ │ │ ├── groupversion_info.go │ │ │ │ ├── pet_types.go │ │ │ │ └── zz_generated.deepcopy.go │ │ │ ├── client/ │ │ │ │ ├── client.go │ │ │ │ ├── internal/ │ │ │ │ │ └── server/ │ │ │ │ │ ├── errors/ │ │ │ │ │ │ └── errors.go │ │ │ │ │ ├── log/ │ │ │ │ │ │ └── log.go │ │ │ │ │ ├── storage/ │ │ │ │ │ │ ├── mem/ │ │ │ │ │ │ │ ├── mem.go │ │ │ │ │ │ │ └── mem_test.go │ │ │ │ │ │ └── storage.go │ │ │ │ │ └── telemetry/ │ │ │ │ │ ├── metrics/ │ │ │ │ │ │ ├── metrics.go │ │ │ │ │ │ └── start.go │ │ │ │ │ └── tracing/ │ │ │ │ │ ├── sampler/ │ │ │ │ │ │ └── sampler.go │ │ │ │ │ └── tracing.go │ │ │ │ └── proto/ │ │ │ │ ├── buf.gen.yaml │ │ │ │ ├── buf.yaml │ │ │ │ ├── petstore.pb.go │ │ │ │ ├── petstore.proto │ │ │ │ └── petstore_grpc.pb.go │ │ │ ├── config/ │ │ │ │ ├── crd/ │ │ │ │ │ ├── bases/ │ │ │ │ │ │ └── petstore.example.com_pets.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ ├── kustomizeconfig.yaml │ │ │ │ │ └── patches/ │ │ │ │ │ ├── cainjection_in_pets.yaml │ │ │ │ │ └── webhook_in_pets.yaml │ │ │ │ ├── default/ │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ ├── manager_auth_proxy_patch.yaml │ │ │ │ │ └── manager_config_patch.yaml │ │ │ │ ├── manager/ │ │ │ │ │ ├── controller_manager_config.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── manager.yaml │ │ │ │ ├── manifests/ │ │ │ │ │ └── kustomization.yaml │ │ │ │ ├── petstore-service/ │ │ │ │ │ └── service.yaml │ │ │ │ ├── prometheus/ │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── monitor.yaml │ │ │ │ ├── rbac/ │ │ │ │ │ ├── auth_proxy_client_clusterrole.yaml │ │ │ │ │ ├── auth_proxy_role.yaml │ │ │ │ │ ├── auth_proxy_role_binding.yaml │ │ │ │ │ ├── auth_proxy_service.yaml │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ ├── leader_election_role.yaml │ │ │ │ │ ├── leader_election_role_binding.yaml │ │ │ │ │ ├── pet_editor_role.yaml │ │ │ │ │ ├── pet_viewer_role.yaml │ │ │ │ │ ├── role.yaml │ │ │ │ │ ├── role_binding.yaml │ │ │ │ │ └── service_account.yaml │ │ │ │ ├── samples/ │ │ │ │ │ ├── kustomization.yaml │ │ │ │ │ └── petstore_v1alpha1_pet.yaml │ │ │ │ └── scorecard/ │ │ │ │ ├── bases/ │ │ │ │ │ └── config.yaml │ │ │ │ ├── kustomization.yaml │ │ │ │ └── patches/ │ │ │ │ ├── basic.config.yaml │ │ │ │ └── olm.config.yaml │ │ │ ├── controllers/ │ │ │ │ ├── pet_controller.go │ │ │ │ └── suite_test.go │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ ├── hack/ │ │ │ │ └── boilerplate.go.txt │ │ │ └── main.go │ │ └── workloads/ │ │ ├── Readme.md │ │ ├── go.mod │ │ ├── go.sum │ │ ├── kind-config.yaml │ │ └── main.go │ ├── 15/ │ │ ├── .gitignore │ │ ├── cloud-init/ │ │ │ └── init.yml │ │ ├── cmd/ │ │ │ ├── compute/ │ │ │ │ └── main.go │ │ │ └── storage/ │ │ │ └── main.go │ │ ├── go.mod │ │ ├── go.sum │ │ ├── pkg/ │ │ │ ├── helpers/ │ │ │ │ └── helpers.go │ │ │ └── mgmt/ │ │ │ ├── compute.go │ │ │ └── storage.go │ │ └── readme.md │ ├── 16/ │ │ └── workflow/ │ │ ├── README.md │ │ ├── client/ │ │ │ └── client.go │ │ ├── configs/ │ │ │ ├── README │ │ │ ├── es.json │ │ │ └── policies.json │ │ ├── data/ │ │ │ ├── README.md │ │ │ ├── generators/ │ │ │ │ ├── README │ │ │ │ └── mk/ │ │ │ │ ├── README │ │ │ │ └── mk.go │ │ │ ├── machines.json │ │ │ ├── packages/ │ │ │ │ └── sites/ │ │ │ │ └── sites.go │ │ │ └── sites.json │ │ ├── internal/ │ │ │ ├── es/ │ │ │ │ └── es.go │ │ │ ├── policy/ │ │ │ │ ├── config/ │ │ │ │ │ └── config.go │ │ │ │ ├── policy.go │ │ │ │ └── register/ │ │ │ │ ├── README │ │ │ │ ├── restrictjobtypes/ │ │ │ │ │ └── restrictjobtypes.go │ │ │ │ ├── sameargs/ │ │ │ │ │ └── sameargs.go │ │ │ │ └── startorend/ │ │ │ │ └── startOrEnd.go │ │ │ ├── service/ │ │ │ │ ├── executor/ │ │ │ │ │ └── executor.go │ │ │ │ ├── jobs/ │ │ │ │ │ ├── jobs.go │ │ │ │ │ └── register/ │ │ │ │ │ ├── diskerase/ │ │ │ │ │ │ └── diskerase.go │ │ │ │ │ ├── sleep/ │ │ │ │ │ │ └── sleep.go │ │ │ │ │ ├── tokenbucket/ │ │ │ │ │ │ └── tokenbucket.go │ │ │ │ │ └── validatedecom/ │ │ │ │ │ └── validatedecom.go │ │ │ │ └── service.go │ │ │ └── token/ │ │ │ └── token.go │ │ ├── proto/ │ │ │ ├── buf.gen.yaml │ │ │ ├── buf.yaml │ │ │ ├── custom.go │ │ │ ├── diskerase.pb.go │ │ │ ├── diskerase.proto │ │ │ └── diskerase_grpc.pb.go │ │ ├── samples/ │ │ │ └── diskerase/ │ │ │ ├── LICENSE │ │ │ ├── cmd/ │ │ │ │ ├── eraseSatellite.go │ │ │ │ ├── protoStatus.go │ │ │ │ ├── root.go │ │ │ │ └── status.go │ │ │ └── diskerase.go │ │ └── workflow.go │ ├── 5/ │ │ └── excel/ │ │ ├── simple/ │ │ │ └── excel.go │ │ └── visualization/ │ │ ├── excel.go │ │ └── internal/ │ │ └── chart/ │ │ └── chart.go │ ├── 6/ │ │ └── grpc/ │ │ ├── buf.work │ │ ├── client/ │ │ │ ├── bin/ │ │ │ │ └── qotd.go │ │ │ └── client.go │ │ ├── proto/ │ │ │ ├── buf.gen.yaml │ │ │ ├── buf.yaml │ │ │ ├── qotd.pb.go │ │ │ ├── qotd.proto │ │ │ └── qotd_grpc.pb.go │ │ ├── qotd.go │ │ └── server/ │ │ └── server.go │ ├── 7/ │ │ ├── cobra/ │ │ │ └── app/ │ │ │ ├── LICENSE │ │ │ ├── cmd/ │ │ │ │ ├── get.go │ │ │ │ └── root.go │ │ │ └── main.go │ │ ├── filter_errors/ │ │ │ └── main.go │ │ └── signals/ │ │ └── main.go │ ├── 8/ │ │ ├── agent/ │ │ │ ├── README.md │ │ │ ├── agent.go │ │ │ ├── bin/ │ │ │ │ ├── README.md │ │ │ │ ├── build.sh │ │ │ │ └── linux_amd64/ │ │ │ │ └── agent │ │ │ ├── buf.work │ │ │ ├── client/ │ │ │ │ ├── cli/ │ │ │ │ │ ├── LICENSE │ │ │ │ │ ├── cmd/ │ │ │ │ │ │ ├── auth.go │ │ │ │ │ │ ├── install.go │ │ │ │ │ │ ├── remove.go │ │ │ │ │ │ └── root.go │ │ │ │ │ ├── main.go │ │ │ │ │ └── sample/ │ │ │ │ │ └── helloweb/ │ │ │ │ │ ├── helloweb │ │ │ │ │ └── helloweb.go │ │ │ │ └── client.go │ │ │ ├── internal/ │ │ │ │ └── service/ │ │ │ │ ├── service.go │ │ │ │ └── unit_file.go │ │ │ └── proto/ │ │ │ ├── agent.pb.go │ │ │ ├── agent.proto │ │ │ ├── agent_grpc.pb.go │ │ │ ├── buf.gen.yaml │ │ │ ├── buf.yaml │ │ │ └── extra.go │ │ ├── rollout/ │ │ │ ├── README.md │ │ │ ├── config.go │ │ │ ├── endstate_string.go │ │ │ ├── lb/ │ │ │ │ ├── README.md │ │ │ │ ├── buf.work │ │ │ │ ├── client/ │ │ │ │ │ ├── cli/ │ │ │ │ │ │ └── cli.go │ │ │ │ │ └── client.go │ │ │ │ ├── lb.go │ │ │ │ ├── proto/ │ │ │ │ │ ├── buf.gen.yaml │ │ │ │ │ ├── buf.yaml │ │ │ │ │ ├── lb.pb.go │ │ │ │ │ ├── lb.proto │ │ │ │ │ └── lb_grpc.pb.go │ │ │ │ ├── sample/ │ │ │ │ │ └── web/ │ │ │ │ │ └── main.go │ │ │ │ └── server/ │ │ │ │ ├── grpc/ │ │ │ │ │ └── server.go │ │ │ │ └── http/ │ │ │ │ ├── p2c.go │ │ │ │ └── server.go │ │ │ ├── rollout.go │ │ │ ├── service.json │ │ │ └── workflow.go │ │ ├── scanner/ │ │ │ └── scanner.go │ │ └── ssh/ │ │ └── client/ │ │ ├── expect/ │ │ │ └── expect.go │ │ └── remotecmd/ │ │ └── remotecmd.go │ ├── 9/ │ │ ├── alerting/ │ │ │ ├── alertmanager.yml │ │ │ ├── client/ │ │ │ │ ├── Dockerfile │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── main.go │ │ │ ├── docker-compose.yaml │ │ │ ├── otel-collector-config.yaml │ │ │ ├── prometheus.yaml │ │ │ ├── readme.md │ │ │ ├── rules/ │ │ │ │ └── demo-server.yml │ │ │ └── server/ │ │ │ ├── Dockerfile │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ └── main.go │ │ ├── logging/ │ │ │ ├── docker-compose.yml │ │ │ ├── otel-collector-config.yml │ │ │ ├── readme.md │ │ │ └── varlogpods/ │ │ │ ├── containerd_logs-0_000011112222333344445555666677778888/ │ │ │ │ └── logs/ │ │ │ │ └── 0.log │ │ │ ├── crio_logs-0_111122223333444455556666777788889999/ │ │ │ │ └── logs/ │ │ │ │ └── 0.log │ │ │ ├── docker_logs-0_222233334444555566667777888899990000/ │ │ │ │ └── logs/ │ │ │ │ └── 0.log │ │ │ └── otel_otel_888877776666555544443333222211110000/ │ │ │ └── otel-collector/ │ │ │ └── 0.log │ │ ├── metrics/ │ │ │ ├── client/ │ │ │ │ ├── Dockerfile │ │ │ │ ├── go.mod │ │ │ │ ├── go.sum │ │ │ │ └── main.go │ │ │ ├── docker-compose.yaml │ │ │ ├── otel-collector-config.yaml │ │ │ ├── prometheus.yaml │ │ │ ├── readme.md │ │ │ └── server/ │ │ │ ├── Dockerfile │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ └── main.go │ │ └── tracing/ │ │ ├── client/ │ │ │ ├── Dockerfile │ │ │ ├── go.mod │ │ │ ├── go.sum │ │ │ └── main.go │ │ ├── docker-compose.yaml │ │ ├── otel-collector-config.yaml │ │ ├── readme.md │ │ └── server/ │ │ ├── Dockerfile │ │ ├── go.mod │ │ ├── go.sum │ │ └── main.go │ ├── build_check.sh │ ├── mod_tidy.sh │ └── rename.sh ├── go.mod └── go.sum
Showing preview only (204K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (2477 symbols across 158 files)
FILE: chapter/10/main.go
function main (line 19) | func main() {
function parseAndValidateInput (line 55) | func parseAndValidateInput() {
function printVersion (line 102) | func printVersion() {
function printOutput (line 110) | func printOutput(key, message string) {
FILE: chapter/10/pkg/tweeter/tweeter.go
type Config (line 17) | type Config struct
method Validate (line 31) | func (cfg Config) Validate() error {
type Client (line 25) | type Client struct
method Tweet (line 69) | func (c *Client) Tweet(message string) error {
function New (line 52) | func New(cfg Config) (*Client, error) {
FILE: chapter/10/pkg/tweeter/tweeter_test.go
function TestNew (line 10) | func TestNew(t *testing.T) {
function TestConfig_Validate (line 27) | func TestConfig_Validate(t *testing.T) {
FILE: chapter/11/chatbot/bot/bot.go
type HandleFunc (line 19) | type HandleFunc
type Message (line 22) | type Message struct
type register (line 31) | type register struct
type Bot (line 37) | type Bot struct
method Start (line 61) | func (b *Bot) Start() {
method Stop (line 68) | func (b *Bot) Stop() {
method Register (line 75) | func (b *Bot) Register(r *regexp.Regexp, h HandleFunc) {
method loop (line 90) | func (b *Bot) loop() {
method appMentioned (line 116) | func (b *Bot) appMentioned(ctx context.Context, data slackevents.Event...
method makeMsg (line 152) | func (b *Bot) makeMsg(callback *slackevents.EventsAPICallbackEvent, ev...
function New (line 48) | func New(api *slack.Client, client *socketmode.Client) (*Bot, error) {
type rawMessage (line 167) | type rawMessage struct
method getText (line 172) | func (r rawMessage) getText() string {
FILE: chapter/11/chatbot/chatbot.go
function main (line 22) | func main() {
FILE: chapter/11/chatbot/internal/handlers/handlers.go
type Ops (line 26) | type Ops struct
method write (line 33) | func (o Ops) write(m bot.Message, s string, i ...interface{}) error {
method Register (line 42) | func (o Ops) Register(b *bot.Bot) {
method ListTraces (line 61) | func (o Ops) ListTraces(ctx context.Context, m bot.Message) {
method ShowTrace (line 142) | func (o Ops) ShowTrace(ctx context.Context, m bot.Message) {
method ShowLogs (line 192) | func (o Ops) ShowLogs(ctx context.Context, m bot.Message) {
method ChangeSampling (line 225) | func (o Ops) ChangeSampling(ctx context.Context, m bot.Message) {
method Help (line 294) | func (o Ops) Help(ctx context.Context, m bot.Message) {
method lastResort (line 314) | func (o Ops) lastResort(ctx context.Context, m bot.Message) {
type opt (line 52) | type opt struct
function init (line 278) | func init() {
function convertList (line 318) | func convertList(s string) ([]string, error) {
FILE: chapter/11/ops/client/client.go
type Ops (line 16) | type Ops struct
method ListTraces (line 128) | func (o *Ops) ListTraces(ctx context.Context, options ...CallOption) (...
method ShowTrace (line 166) | func (o *Ops) ShowTrace(ctx context.Context, id string) (*pb.ShowTrace...
method ShowLogs (line 181) | func (o *Ops) ShowLogs(ctx context.Context, id string) ([]Log, error) {
method ChangeSampling (line 219) | func (o *Ops) ChangeSampling(ctx context.Context, sampler *pb.ChangeSa...
method DeployedVersion (line 229) | func (o *Ops) DeployedVersion(ctx context.Context) (string, error) {
method Alerts (line 287) | func (o *Ops) Alerts(ctx context.Context, options ...CallOption) ([]Al...
function New (line 22) | func New(addr string) (*Ops, error) {
type callOptions (line 34) | type callOptions struct
type listTracesOpts (line 39) | type listTracesOpts struct
method defaults (line 53) | func (l *listTracesOpts) defaults() {
type alertsOpts (line 47) | type alertsOpts struct
type CallOption (line 59) | type CallOption
function WithStart (line 62) | func WithStart(t time.Time) CallOption {
function WithEnd (line 73) | func WithEnd(t time.Time) CallOption {
function WithLimit (line 87) | func WithLimit(i int32) CallOption {
function WithOperation (line 98) | func WithOperation(s string) CallOption {
function WithTags (line 109) | func WithTags(tags []string) CallOption {
type TraceItem (line 120) | type TraceItem struct
type TraceData (line 157) | type TraceData struct
type Log (line 175) | type Log struct
function WithLabels (line 238) | func WithLabels(labels []string) CallOption {
function WithActiveAt (line 249) | func WithActiveAt(t time.Time) CallOption {
function WithStates (line 260) | func WithStates(states []string) CallOption {
type Alert (line 271) | type Alert struct
method fromProto (line 280) | func (a *Alert) fromProto(p *pb.Alert) {
FILE: chapter/11/ops/internal/jaeger/client/client.go
type Trace (line 27) | type Trace struct
type Span (line 39) | type Span struct
method Proto (line 45) | func (s Span) Proto() *mpb.Span {
method TraceID (line 50) | func (s Span) TraceID() string {
method SpanID (line 60) | func (s Span) SpanID() string {
type Jaeger (line 69) | type Jaeger struct
method Addr (line 90) | func (j *Jaeger) Addr() string {
method Search (line 151) | func (j *Jaeger) Search(ctx context.Context, params SearchParams) (cha...
method Trace (line 166) | func (j *Jaeger) Trace(ctx context.Context, id string) (Trace, error) {
function New (line 76) | func New(addr string) (*Jaeger, error) {
type SearchParams (line 95) | type SearchParams struct
method validate (line 117) | func (s SearchParams) validate() error {
method proto (line 124) | func (s SearchParams) proto() *pb.FindTracesRequest {
type receiver (line 195) | type receiver interface
function unwind (line 201) | func unwind(ctx context.Context, stream receiver) chan Trace {
function chunkToSpan (line 239) | func chunkToSpan(chunk *pb.SpansResponseChunk) []Span {
FILE: chapter/11/ops/internal/jaeger/client/test/client/client.go
constant NestedSpans (line 27) | NestedSpans = 2560
function initProvider (line 30) | func initProvider() func() {
function initTracer (line 44) | func initTracer(ctx context.Context, otelAgentAddr string) *otlptrace.Ex...
function handleErr (line 77) | func handleErr(err error, message string) {
type HTTP (line 87) | type HTTP struct
method Call (line 106) | func (h *HTTP) Call(ctx context.Context) (traceID string, err error) {
method makeRequest (line 121) | func (h *HTTP) makeRequest(ctx context.Context) error {
method makeNestedSpans (line 137) | func (h *HTTP) makeNestedSpans(ctx context.Context, tracer trace.Trace...
function New (line 92) | func New(addr string) (*HTTP, error) {
function convertTraceID (line 150) | func convertTraceID(id string) string {
FILE: chapter/11/ops/internal/jaeger/client/test/etoe_test.go
function TestTrace (line 15) | func TestTrace(t *testing.T) {
FILE: chapter/11/ops/internal/jaeger/client/test/server/main.go
function initProvider (line 24) | func initProvider() func() {
function initTracer (line 42) | func initTracer(ctx context.Context, otelAgentAddr string) *otlptrace.Ex...
function handleErr (line 75) | func handleErr(err error, message string) {
function main (line 81) | func main() {
FILE: chapter/11/ops/internal/prom/prom.go
type Client (line 19) | type Client struct
method Metric (line 38) | func (c *Client) Metric(ctx context.Context, metric string) (model.Val...
method Range (line 44) | func (c *Client) Range(ctx context.Context, query string, r v1.Range) ...
method Alerts (line 192) | func (c *Client) Alerts(ctx context.Context, filter AlertFilter) (chan...
function New (line 24) | func New(httpAddr string) (*Client, error) {
type AlertFilter (line 49) | type AlertFilter struct
method Compile (line 69) | func (a *AlertFilter) Compile() error {
method filter (line 106) | func (a *AlertFilter) filter(items []v1.Alert) (chan v1.Alert, error) {
method pipeline (line 140) | func (a *AlertFilter) pipeline(item v1.Alert, out chan v1.Alert) {
method matchLabel (line 165) | func (a *AlertFilter) matchLabel(item v1.Alert) bool {
FILE: chapter/11/ops/internal/server/server.go
type API (line 27) | type API struct
method Start (line 92) | func (a *API) Start() error {
method Stop (line 105) | func (a *API) Stop() {
method ListTraces (line 113) | func (a *API) ListTraces(ctx context.Context, req *pb.ListTracesReq) (...
method ShowLogs (line 161) | func (a *API) ShowLogs(ctx context.Context, req *pb.ShowLogsReq) (*pb....
method ShowTrace (line 193) | func (a *API) ShowTrace(ctx context.Context, req *pb.ShowTraceReq) (*p...
method ChangeSampling (line 230) | func (a *API) ChangeSampling(ctx context.Context, req *pb.ChangeSampli...
method DeployedVersion (line 243) | func (a *API) DeployedVersion(ctx context.Context, req *pb.DeployedVer...
method Alerts (line 252) | func (a *API) Alerts(ctx context.Context, req *pb.AlertsReq) (*pb.Aler...
type Clients (line 40) | type Clients struct
method validate (line 49) | func (c Clients) validate() error {
type Option (line 63) | type Option
function WithGRPCOpts (line 66) | func WithGRPCOpts(opts ...grpc.ServerOption) Option {
function New (line 73) | func New(addr string, clients Clients, options ...Option) (*API, error) {
FILE: chapter/11/ops/ops.go
function main (line 20) | func main() {
FILE: chapter/11/ops/proto/jaeger/collector.pb.go
constant _ (line 36) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 38) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type PostSpansRequest (line 41) | type PostSpansRequest struct
method Reset (line 49) | func (x *PostSpansRequest) Reset() {
method String (line 58) | func (x *PostSpansRequest) String() string {
method ProtoMessage (line 62) | func (*PostSpansRequest) ProtoMessage() {}
method ProtoReflect (line 64) | func (x *PostSpansRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 77) | func (*PostSpansRequest) Descriptor() ([]byte, []int) {
method GetBatch (line 81) | func (x *PostSpansRequest) GetBatch() *model.Batch {
type PostSpansResponse (line 88) | type PostSpansResponse struct
method Reset (line 94) | func (x *PostSpansResponse) Reset() {
method String (line 103) | func (x *PostSpansResponse) String() string {
method ProtoMessage (line 107) | func (*PostSpansResponse) ProtoMessage() {}
method ProtoReflect (line 109) | func (x *PostSpansResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 122) | func (*PostSpansResponse) Descriptor() ([]byte, []int) {
function file_jaeger_collector_proto_rawDescGZIP (line 165) | func file_jaeger_collector_proto_rawDescGZIP() []byte {
function init (line 189) | func init() { file_jaeger_collector_proto_init() }
function file_jaeger_collector_proto_init (line 190) | func file_jaeger_collector_proto_init() {
FILE: chapter/11/ops/proto/jaeger/collector_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type CollectorServiceClient (line 20) | type CollectorServiceClient interface
type collectorServiceClient (line 24) | type collectorServiceClient struct
method PostSpans (line 32) | func (c *collectorServiceClient) PostSpans(ctx context.Context, in *Po...
function NewCollectorServiceClient (line 28) | func NewCollectorServiceClient(cc grpc.ClientConnInterface) CollectorSer...
type CollectorServiceServer (line 44) | type CollectorServiceServer interface
type UnimplementedCollectorServiceServer (line 50) | type UnimplementedCollectorServiceServer struct
method PostSpans (line 53) | func (UnimplementedCollectorServiceServer) PostSpans(context.Context, ...
method mustEmbedUnimplementedCollectorServiceServer (line 56) | func (UnimplementedCollectorServiceServer) mustEmbedUnimplementedColle...
type UnsafeCollectorServiceServer (line 61) | type UnsafeCollectorServiceServer interface
function RegisterCollectorServiceServer (line 65) | func RegisterCollectorServiceServer(s grpc.ServiceRegistrar, srv Collect...
function _CollectorService_PostSpans_Handler (line 69) | func _CollectorService_PostSpans_Handler(srv interface{}, ctx context.Co...
FILE: chapter/11/ops/proto/jaeger/model/model.pb.go
constant _ (line 35) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 37) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type ValueType (line 40) | type ValueType
method Enum (line 68) | func (x ValueType) Enum() *ValueType {
method String (line 74) | func (x ValueType) String() string {
method Descriptor (line 78) | func (ValueType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 82) | func (ValueType) Type() protoreflect.EnumType {
method Number (line 86) | func (x ValueType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 91) | func (ValueType) EnumDescriptor() ([]byte, []int) {
constant ValueType_STRING (line 43) | ValueType_STRING ValueType = 0
constant ValueType_BOOL (line 44) | ValueType_BOOL ValueType = 1
constant ValueType_INT64 (line 45) | ValueType_INT64 ValueType = 2
constant ValueType_FLOAT64 (line 46) | ValueType_FLOAT64 ValueType = 3
constant ValueType_BINARY (line 47) | ValueType_BINARY ValueType = 4
type SpanRefType (line 95) | type SpanRefType
method Enum (line 114) | func (x SpanRefType) Enum() *SpanRefType {
method String (line 120) | func (x SpanRefType) String() string {
method Descriptor (line 124) | func (SpanRefType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 128) | func (SpanRefType) Type() protoreflect.EnumType {
method Number (line 132) | func (x SpanRefType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 137) | func (SpanRefType) EnumDescriptor() ([]byte, []int) {
constant SpanRefType_CHILD_OF (line 98) | SpanRefType_CHILD_OF SpanRefType = 0
constant SpanRefType_FOLLOWS_FROM (line 99) | SpanRefType_FOLLOWS_FROM SpanRefType = 1
type KeyValue (line 141) | type KeyValue struct
method Reset (line 155) | func (x *KeyValue) Reset() {
method String (line 164) | func (x *KeyValue) String() string {
method ProtoMessage (line 168) | func (*KeyValue) ProtoMessage() {}
method ProtoReflect (line 170) | func (x *KeyValue) ProtoReflect() protoreflect.Message {
method Descriptor (line 183) | func (*KeyValue) Descriptor() ([]byte, []int) {
method GetKey (line 187) | func (x *KeyValue) GetKey() string {
method GetVType (line 194) | func (x *KeyValue) GetVType() ValueType {
method GetVStr (line 201) | func (x *KeyValue) GetVStr() string {
method GetVBool (line 208) | func (x *KeyValue) GetVBool() bool {
method GetVInt64 (line 215) | func (x *KeyValue) GetVInt64() int64 {
method GetVFloat64 (line 222) | func (x *KeyValue) GetVFloat64() float64 {
method GetVBinary (line 229) | func (x *KeyValue) GetVBinary() []byte {
type Log (line 236) | type Log struct
method Reset (line 245) | func (x *Log) Reset() {
method String (line 254) | func (x *Log) String() string {
method ProtoMessage (line 258) | func (*Log) ProtoMessage() {}
method ProtoReflect (line 260) | func (x *Log) ProtoReflect() protoreflect.Message {
method Descriptor (line 273) | func (*Log) Descriptor() ([]byte, []int) {
method GetTimestamp (line 277) | func (x *Log) GetTimestamp() *timestamppb.Timestamp {
method GetFields (line 284) | func (x *Log) GetFields() []*KeyValue {
type SpanRef (line 291) | type SpanRef struct
method Reset (line 301) | func (x *SpanRef) Reset() {
method String (line 310) | func (x *SpanRef) String() string {
method ProtoMessage (line 314) | func (*SpanRef) ProtoMessage() {}
method ProtoReflect (line 316) | func (x *SpanRef) ProtoReflect() protoreflect.Message {
method Descriptor (line 329) | func (*SpanRef) Descriptor() ([]byte, []int) {
method GetTraceId (line 333) | func (x *SpanRef) GetTraceId() []byte {
method GetSpanId (line 340) | func (x *SpanRef) GetSpanId() []byte {
method GetRefType (line 347) | func (x *SpanRef) GetRefType() SpanRefType {
type Process (line 354) | type Process struct
method Reset (line 363) | func (x *Process) Reset() {
method String (line 372) | func (x *Process) String() string {
method ProtoMessage (line 376) | func (*Process) ProtoMessage() {}
method ProtoReflect (line 378) | func (x *Process) ProtoReflect() protoreflect.Message {
method Descriptor (line 391) | func (*Process) Descriptor() ([]byte, []int) {
method GetServiceName (line 395) | func (x *Process) GetServiceName() string {
method GetTags (line 402) | func (x *Process) GetTags() []*KeyValue {
type Span (line 409) | type Span struct
method Reset (line 428) | func (x *Span) Reset() {
method String (line 437) | func (x *Span) String() string {
method ProtoMessage (line 441) | func (*Span) ProtoMessage() {}
method ProtoReflect (line 443) | func (x *Span) ProtoReflect() protoreflect.Message {
method Descriptor (line 456) | func (*Span) Descriptor() ([]byte, []int) {
method GetTraceId (line 460) | func (x *Span) GetTraceId() []byte {
method GetSpanId (line 467) | func (x *Span) GetSpanId() []byte {
method GetOperationName (line 474) | func (x *Span) GetOperationName() string {
method GetReferences (line 481) | func (x *Span) GetReferences() []*SpanRef {
method GetFlags (line 488) | func (x *Span) GetFlags() uint32 {
method GetStartTime (line 495) | func (x *Span) GetStartTime() *timestamppb.Timestamp {
method GetDuration (line 502) | func (x *Span) GetDuration() *durationpb.Duration {
method GetTags (line 509) | func (x *Span) GetTags() []*KeyValue {
method GetLogs (line 516) | func (x *Span) GetLogs() []*Log {
method GetProcess (line 523) | func (x *Span) GetProcess() *Process {
method GetProcessId (line 530) | func (x *Span) GetProcessId() string {
method GetWarnings (line 537) | func (x *Span) GetWarnings() []string {
type Trace (line 544) | type Trace struct
method Reset (line 554) | func (x *Trace) Reset() {
method String (line 563) | func (x *Trace) String() string {
method ProtoMessage (line 567) | func (*Trace) ProtoMessage() {}
method ProtoReflect (line 569) | func (x *Trace) ProtoReflect() protoreflect.Message {
method Descriptor (line 582) | func (*Trace) Descriptor() ([]byte, []int) {
method GetSpans (line 586) | func (x *Trace) GetSpans() []*Span {
method GetProcessMap (line 593) | func (x *Trace) GetProcessMap() []*Trace_ProcessMapping {
method GetWarnings (line 600) | func (x *Trace) GetWarnings() []string {
type Batch (line 616) | type Batch struct
method Reset (line 625) | func (x *Batch) Reset() {
method String (line 634) | func (x *Batch) String() string {
method ProtoMessage (line 638) | func (*Batch) ProtoMessage() {}
method ProtoReflect (line 640) | func (x *Batch) ProtoReflect() protoreflect.Message {
method Descriptor (line 653) | func (*Batch) Descriptor() ([]byte, []int) {
method GetSpans (line 657) | func (x *Batch) GetSpans() []*Span {
method GetProcess (line 664) | func (x *Batch) GetProcess() *Process {
type DependencyLink (line 671) | type DependencyLink struct
method Reset (line 682) | func (x *DependencyLink) Reset() {
method String (line 691) | func (x *DependencyLink) String() string {
method ProtoMessage (line 695) | func (*DependencyLink) ProtoMessage() {}
method ProtoReflect (line 697) | func (x *DependencyLink) ProtoReflect() protoreflect.Message {
method Descriptor (line 710) | func (*DependencyLink) Descriptor() ([]byte, []int) {
method GetParent (line 714) | func (x *DependencyLink) GetParent() string {
method GetChild (line 721) | func (x *DependencyLink) GetChild() string {
method GetCallCount (line 728) | func (x *DependencyLink) GetCallCount() uint64 {
method GetSource (line 735) | func (x *DependencyLink) GetSource() string {
type Trace_ProcessMapping (line 742) | type Trace_ProcessMapping struct
method Reset (line 751) | func (x *Trace_ProcessMapping) Reset() {
method String (line 760) | func (x *Trace_ProcessMapping) String() string {
method ProtoMessage (line 764) | func (*Trace_ProcessMapping) ProtoMessage() {}
method ProtoReflect (line 766) | func (x *Trace_ProcessMapping) ProtoReflect() protoreflect.Message {
method Descriptor (line 779) | func (*Trace_ProcessMapping) Descriptor() ([]byte, []int) {
method GetProcessId (line 783) | func (x *Trace_ProcessMapping) GetProcessId() string {
method GetProcess (line 790) | func (x *Trace_ProcessMapping) GetProcess() *Process {
function file_jaeger_model_model_proto_rawDescGZIP (line 939) | func file_jaeger_model_model_proto_rawDescGZIP() []byte {
function init (line 987) | func init() { file_jaeger_model_model_proto_init() }
function file_jaeger_model_model_proto_init (line 988) | func file_jaeger_model_model_proto_init() {
FILE: chapter/11/ops/proto/jaeger/query.pb.go
constant _ (line 38) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 40) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type GetTraceRequest (line 43) | type GetTraceRequest struct
method Reset (line 51) | func (x *GetTraceRequest) Reset() {
method String (line 60) | func (x *GetTraceRequest) String() string {
method ProtoMessage (line 64) | func (*GetTraceRequest) ProtoMessage() {}
method ProtoReflect (line 66) | func (x *GetTraceRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 79) | func (*GetTraceRequest) Descriptor() ([]byte, []int) {
method GetTraceId (line 83) | func (x *GetTraceRequest) GetTraceId() []byte {
type SpansResponseChunk (line 90) | type SpansResponseChunk struct
method Reset (line 98) | func (x *SpansResponseChunk) Reset() {
method String (line 107) | func (x *SpansResponseChunk) String() string {
method ProtoMessage (line 111) | func (*SpansResponseChunk) ProtoMessage() {}
method ProtoReflect (line 113) | func (x *SpansResponseChunk) ProtoReflect() protoreflect.Message {
method Descriptor (line 126) | func (*SpansResponseChunk) Descriptor() ([]byte, []int) {
method GetSpans (line 130) | func (x *SpansResponseChunk) GetSpans() []*model.Span {
type ArchiveTraceRequest (line 137) | type ArchiveTraceRequest struct
method Reset (line 145) | func (x *ArchiveTraceRequest) Reset() {
method String (line 154) | func (x *ArchiveTraceRequest) String() string {
method ProtoMessage (line 158) | func (*ArchiveTraceRequest) ProtoMessage() {}
method ProtoReflect (line 160) | func (x *ArchiveTraceRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 173) | func (*ArchiveTraceRequest) Descriptor() ([]byte, []int) {
method GetTraceId (line 177) | func (x *ArchiveTraceRequest) GetTraceId() []byte {
type ArchiveTraceResponse (line 184) | type ArchiveTraceResponse struct
method Reset (line 190) | func (x *ArchiveTraceResponse) Reset() {
method String (line 199) | func (x *ArchiveTraceResponse) String() string {
method ProtoMessage (line 203) | func (*ArchiveTraceResponse) ProtoMessage() {}
method ProtoReflect (line 205) | func (x *ArchiveTraceResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 218) | func (*ArchiveTraceResponse) Descriptor() ([]byte, []int) {
type TraceQueryParameters (line 222) | type TraceQueryParameters struct
method Reset (line 237) | func (x *TraceQueryParameters) Reset() {
method String (line 246) | func (x *TraceQueryParameters) String() string {
method ProtoMessage (line 250) | func (*TraceQueryParameters) ProtoMessage() {}
method ProtoReflect (line 252) | func (x *TraceQueryParameters) ProtoReflect() protoreflect.Message {
method Descriptor (line 265) | func (*TraceQueryParameters) Descriptor() ([]byte, []int) {
method GetServiceName (line 269) | func (x *TraceQueryParameters) GetServiceName() string {
method GetOperationName (line 276) | func (x *TraceQueryParameters) GetOperationName() string {
method GetTags (line 283) | func (x *TraceQueryParameters) GetTags() map[string]string {
method GetStartTimeMin (line 290) | func (x *TraceQueryParameters) GetStartTimeMin() *timestamppb.Timestamp {
method GetStartTimeMax (line 297) | func (x *TraceQueryParameters) GetStartTimeMax() *timestamppb.Timestamp {
method GetDurationMin (line 304) | func (x *TraceQueryParameters) GetDurationMin() *durationpb.Duration {
method GetDurationMax (line 311) | func (x *TraceQueryParameters) GetDurationMax() *durationpb.Duration {
method GetSearchDepth (line 318) | func (x *TraceQueryParameters) GetSearchDepth() int32 {
type FindTracesRequest (line 325) | type FindTracesRequest struct
method Reset (line 333) | func (x *FindTracesRequest) Reset() {
method String (line 342) | func (x *FindTracesRequest) String() string {
method ProtoMessage (line 346) | func (*FindTracesRequest) ProtoMessage() {}
method ProtoReflect (line 348) | func (x *FindTracesRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 361) | func (*FindTracesRequest) Descriptor() ([]byte, []int) {
method GetQuery (line 365) | func (x *FindTracesRequest) GetQuery() *TraceQueryParameters {
type GetServicesRequest (line 372) | type GetServicesRequest struct
method Reset (line 378) | func (x *GetServicesRequest) Reset() {
method String (line 387) | func (x *GetServicesRequest) String() string {
method ProtoMessage (line 391) | func (*GetServicesRequest) ProtoMessage() {}
method ProtoReflect (line 393) | func (x *GetServicesRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 406) | func (*GetServicesRequest) Descriptor() ([]byte, []int) {
type GetServicesResponse (line 410) | type GetServicesResponse struct
method Reset (line 418) | func (x *GetServicesResponse) Reset() {
method String (line 427) | func (x *GetServicesResponse) String() string {
method ProtoMessage (line 431) | func (*GetServicesResponse) ProtoMessage() {}
method ProtoReflect (line 433) | func (x *GetServicesResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 446) | func (*GetServicesResponse) Descriptor() ([]byte, []int) {
method GetServices (line 450) | func (x *GetServicesResponse) GetServices() []string {
type GetOperationsRequest (line 457) | type GetOperationsRequest struct
method Reset (line 466) | func (x *GetOperationsRequest) Reset() {
method String (line 475) | func (x *GetOperationsRequest) String() string {
method ProtoMessage (line 479) | func (*GetOperationsRequest) ProtoMessage() {}
method ProtoReflect (line 481) | func (x *GetOperationsRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 494) | func (*GetOperationsRequest) Descriptor() ([]byte, []int) {
method GetService (line 498) | func (x *GetOperationsRequest) GetService() string {
method GetSpanKind (line 505) | func (x *GetOperationsRequest) GetSpanKind() string {
type Operation (line 512) | type Operation struct
method Reset (line 521) | func (x *Operation) Reset() {
method String (line 530) | func (x *Operation) String() string {
method ProtoMessage (line 534) | func (*Operation) ProtoMessage() {}
method ProtoReflect (line 536) | func (x *Operation) ProtoReflect() protoreflect.Message {
method Descriptor (line 549) | func (*Operation) Descriptor() ([]byte, []int) {
method GetName (line 553) | func (x *Operation) GetName() string {
method GetSpanKind (line 560) | func (x *Operation) GetSpanKind() string {
type GetOperationsResponse (line 567) | type GetOperationsResponse struct
method Reset (line 576) | func (x *GetOperationsResponse) Reset() {
method String (line 585) | func (x *GetOperationsResponse) String() string {
method ProtoMessage (line 589) | func (*GetOperationsResponse) ProtoMessage() {}
method ProtoReflect (line 591) | func (x *GetOperationsResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 604) | func (*GetOperationsResponse) Descriptor() ([]byte, []int) {
method GetOperationNames (line 608) | func (x *GetOperationsResponse) GetOperationNames() []string {
method GetOperations (line 615) | func (x *GetOperationsResponse) GetOperations() []*Operation {
type GetDependenciesRequest (line 622) | type GetDependenciesRequest struct
method Reset (line 631) | func (x *GetDependenciesRequest) Reset() {
method String (line 640) | func (x *GetDependenciesRequest) String() string {
method ProtoMessage (line 644) | func (*GetDependenciesRequest) ProtoMessage() {}
method ProtoReflect (line 646) | func (x *GetDependenciesRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 659) | func (*GetDependenciesRequest) Descriptor() ([]byte, []int) {
method GetStartTime (line 663) | func (x *GetDependenciesRequest) GetStartTime() *timestamppb.Timestamp {
method GetEndTime (line 670) | func (x *GetDependenciesRequest) GetEndTime() *timestamppb.Timestamp {
type GetDependenciesResponse (line 677) | type GetDependenciesResponse struct
method Reset (line 685) | func (x *GetDependenciesResponse) Reset() {
method String (line 694) | func (x *GetDependenciesResponse) String() string {
method ProtoMessage (line 698) | func (*GetDependenciesResponse) ProtoMessage() {}
method ProtoReflect (line 700) | func (x *GetDependenciesResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 713) | func (*GetDependenciesResponse) Descriptor() ([]byte, []int) {
method GetDependencies (line 717) | func (x *GetDependenciesResponse) GetDependencies() []*model.Dependenc...
function file_jaeger_query_proto_rawDescGZIP (line 893) | func file_jaeger_query_proto_rawDescGZIP() []byte {
function init (line 952) | func init() { file_jaeger_query_proto_init() }
function file_jaeger_query_proto_init (line 953) | func file_jaeger_query_proto_init() {
FILE: chapter/11/ops/proto/jaeger/query_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type QueryServiceClient (line 20) | type QueryServiceClient interface
type queryServiceClient (line 29) | type queryServiceClient struct
method GetTrace (line 37) | func (c *queryServiceClient) GetTrace(ctx context.Context, in *GetTrac...
method ArchiveTrace (line 69) | func (c *queryServiceClient) ArchiveTrace(ctx context.Context, in *Arc...
method FindTraces (line 78) | func (c *queryServiceClient) FindTraces(ctx context.Context, in *FindT...
method GetServices (line 110) | func (c *queryServiceClient) GetServices(ctx context.Context, in *GetS...
method GetOperations (line 119) | func (c *queryServiceClient) GetOperations(ctx context.Context, in *Ge...
method GetDependencies (line 128) | func (c *queryServiceClient) GetDependencies(ctx context.Context, in *...
function NewQueryServiceClient (line 33) | func NewQueryServiceClient(cc grpc.ClientConnInterface) QueryServiceClie...
type QueryService_GetTraceClient (line 52) | type QueryService_GetTraceClient interface
type queryServiceGetTraceClient (line 57) | type queryServiceGetTraceClient struct
method Recv (line 61) | func (x *queryServiceGetTraceClient) Recv() (*SpansResponseChunk, erro...
type QueryService_FindTracesClient (line 93) | type QueryService_FindTracesClient interface
type queryServiceFindTracesClient (line 98) | type queryServiceFindTracesClient struct
method Recv (line 102) | func (x *queryServiceFindTracesClient) Recv() (*SpansResponseChunk, er...
type QueryServiceServer (line 140) | type QueryServiceServer interface
type UnimplementedQueryServiceServer (line 151) | type UnimplementedQueryServiceServer struct
method GetTrace (line 154) | func (UnimplementedQueryServiceServer) GetTrace(*GetTraceRequest, Quer...
method ArchiveTrace (line 157) | func (UnimplementedQueryServiceServer) ArchiveTrace(context.Context, *...
method FindTraces (line 160) | func (UnimplementedQueryServiceServer) FindTraces(*FindTracesRequest, ...
method GetServices (line 163) | func (UnimplementedQueryServiceServer) GetServices(context.Context, *G...
method GetOperations (line 166) | func (UnimplementedQueryServiceServer) GetOperations(context.Context, ...
method GetDependencies (line 169) | func (UnimplementedQueryServiceServer) GetDependencies(context.Context...
method mustEmbedUnimplementedQueryServiceServer (line 172) | func (UnimplementedQueryServiceServer) mustEmbedUnimplementedQueryServ...
type UnsafeQueryServiceServer (line 177) | type UnsafeQueryServiceServer interface
function RegisterQueryServiceServer (line 181) | func RegisterQueryServiceServer(s grpc.ServiceRegistrar, srv QueryServic...
function _QueryService_GetTrace_Handler (line 185) | func _QueryService_GetTrace_Handler(srv interface{}, stream grpc.ServerS...
type QueryService_GetTraceServer (line 193) | type QueryService_GetTraceServer interface
type queryServiceGetTraceServer (line 198) | type queryServiceGetTraceServer struct
method Send (line 202) | func (x *queryServiceGetTraceServer) Send(m *SpansResponseChunk) error {
function _QueryService_ArchiveTrace_Handler (line 206) | func _QueryService_ArchiveTrace_Handler(srv interface{}, ctx context.Con...
function _QueryService_FindTraces_Handler (line 224) | func _QueryService_FindTraces_Handler(srv interface{}, stream grpc.Serve...
type QueryService_FindTracesServer (line 232) | type QueryService_FindTracesServer interface
type queryServiceFindTracesServer (line 237) | type queryServiceFindTracesServer struct
method Send (line 241) | func (x *queryServiceFindTracesServer) Send(m *SpansResponseChunk) err...
function _QueryService_GetServices_Handler (line 245) | func _QueryService_GetServices_Handler(srv interface{}, ctx context.Cont...
function _QueryService_GetOperations_Handler (line 263) | func _QueryService_GetOperations_Handler(srv interface{}, ctx context.Co...
function _QueryService_GetDependencies_Handler (line 281) | func _QueryService_GetDependencies_Handler(srv interface{}, ctx context....
FILE: chapter/11/ops/proto/jaeger/sampling.pb.go
constant _ (line 35) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 37) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type SamplingStrategyType (line 41) | type SamplingStrategyType
method Enum (line 60) | func (x SamplingStrategyType) Enum() *SamplingStrategyType {
method String (line 66) | func (x SamplingStrategyType) String() string {
method Descriptor (line 70) | func (SamplingStrategyType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 74) | func (SamplingStrategyType) Type() protoreflect.EnumType {
method Number (line 78) | func (x SamplingStrategyType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 83) | func (SamplingStrategyType) EnumDescriptor() ([]byte, []int) {
constant SamplingStrategyType_PROBABILISTIC (line 44) | SamplingStrategyType_PROBABILISTIC SamplingStrategyType = 0
constant SamplingStrategyType_RATE_LIMITING (line 45) | SamplingStrategyType_RATE_LIMITING SamplingStrategyType = 1
type ProbabilisticSamplingStrategy (line 88) | type ProbabilisticSamplingStrategy struct
method Reset (line 97) | func (x *ProbabilisticSamplingStrategy) Reset() {
method String (line 106) | func (x *ProbabilisticSamplingStrategy) String() string {
method ProtoMessage (line 110) | func (*ProbabilisticSamplingStrategy) ProtoMessage() {}
method ProtoReflect (line 112) | func (x *ProbabilisticSamplingStrategy) ProtoReflect() protoreflect.Me...
method Descriptor (line 125) | func (*ProbabilisticSamplingStrategy) Descriptor() ([]byte, []int) {
method GetSamplingRate (line 129) | func (x *ProbabilisticSamplingStrategy) GetSamplingRate() float64 {
type RateLimitingSamplingStrategy (line 138) | type RateLimitingSamplingStrategy struct
method Reset (line 147) | func (x *RateLimitingSamplingStrategy) Reset() {
method String (line 156) | func (x *RateLimitingSamplingStrategy) String() string {
method ProtoMessage (line 160) | func (*RateLimitingSamplingStrategy) ProtoMessage() {}
method ProtoReflect (line 162) | func (x *RateLimitingSamplingStrategy) ProtoReflect() protoreflect.Mes...
method Descriptor (line 175) | func (*RateLimitingSamplingStrategy) Descriptor() ([]byte, []int) {
method GetMaxTracesPerSecond (line 179) | func (x *RateLimitingSamplingStrategy) GetMaxTracesPerSecond() int32 {
type OperationSamplingStrategy (line 188) | type OperationSamplingStrategy struct
method Reset (line 197) | func (x *OperationSamplingStrategy) Reset() {
method String (line 206) | func (x *OperationSamplingStrategy) String() string {
method ProtoMessage (line 210) | func (*OperationSamplingStrategy) ProtoMessage() {}
method ProtoReflect (line 212) | func (x *OperationSamplingStrategy) ProtoReflect() protoreflect.Message {
method Descriptor (line 225) | func (*OperationSamplingStrategy) Descriptor() ([]byte, []int) {
method GetOperation (line 229) | func (x *OperationSamplingStrategy) GetOperation() string {
method GetProbabilisticSampling (line 236) | func (x *OperationSamplingStrategy) GetProbabilisticSampling() *Probab...
type PerOperationSamplingStrategies (line 247) | type PerOperationSamplingStrategies struct
method Reset (line 270) | func (x *PerOperationSamplingStrategies) Reset() {
method String (line 279) | func (x *PerOperationSamplingStrategies) String() string {
method ProtoMessage (line 283) | func (*PerOperationSamplingStrategies) ProtoMessage() {}
method ProtoReflect (line 285) | func (x *PerOperationSamplingStrategies) ProtoReflect() protoreflect.M...
method Descriptor (line 298) | func (*PerOperationSamplingStrategies) Descriptor() ([]byte, []int) {
method GetDefaultSamplingProbability (line 302) | func (x *PerOperationSamplingStrategies) GetDefaultSamplingProbability...
method GetDefaultLowerBoundTracesPerSecond (line 309) | func (x *PerOperationSamplingStrategies) GetDefaultLowerBoundTracesPer...
method GetPerOperationStrategies (line 316) | func (x *PerOperationSamplingStrategies) GetPerOperationStrategies() [...
method GetDefaultUpperBoundTracesPerSecond (line 323) | func (x *PerOperationSamplingStrategies) GetDefaultUpperBoundTracesPer...
type SamplingStrategyResponse (line 332) | type SamplingStrategyResponse struct
method Reset (line 351) | func (x *SamplingStrategyResponse) Reset() {
method String (line 360) | func (x *SamplingStrategyResponse) String() string {
method ProtoMessage (line 364) | func (*SamplingStrategyResponse) ProtoMessage() {}
method ProtoReflect (line 366) | func (x *SamplingStrategyResponse) ProtoReflect() protoreflect.Message {
method Descriptor (line 379) | func (*SamplingStrategyResponse) Descriptor() ([]byte, []int) {
method GetStrategyType (line 383) | func (x *SamplingStrategyResponse) GetStrategyType() SamplingStrategyT...
method GetProbabilisticSampling (line 390) | func (x *SamplingStrategyResponse) GetProbabilisticSampling() *Probabi...
method GetRateLimitingSampling (line 397) | func (x *SamplingStrategyResponse) GetRateLimitingSampling() *RateLimi...
method GetOperationSampling (line 404) | func (x *SamplingStrategyResponse) GetOperationSampling() *PerOperatio...
type SamplingStrategyParameters (line 412) | type SamplingStrategyParameters struct
method Reset (line 421) | func (x *SamplingStrategyParameters) Reset() {
method String (line 430) | func (x *SamplingStrategyParameters) String() string {
method ProtoMessage (line 434) | func (*SamplingStrategyParameters) ProtoMessage() {}
method ProtoReflect (line 436) | func (x *SamplingStrategyParameters) ProtoReflect() protoreflect.Messa...
method Descriptor (line 449) | func (*SamplingStrategyParameters) Descriptor() ([]byte, []int) {
method GetServiceName (line 453) | func (x *SamplingStrategyParameters) GetServiceName() string {
function file_jaeger_sampling_proto_rawDescGZIP (line 567) | func file_jaeger_sampling_proto_rawDescGZIP() []byte {
function init (line 601) | func init() { file_jaeger_sampling_proto_init() }
function file_jaeger_sampling_proto_init (line 602) | func file_jaeger_sampling_proto_init() {
FILE: chapter/11/ops/proto/jaeger/sampling_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type SamplingManagerClient (line 20) | type SamplingManagerClient interface
type samplingManagerClient (line 24) | type samplingManagerClient struct
method GetSamplingStrategy (line 32) | func (c *samplingManagerClient) GetSamplingStrategy(ctx context.Contex...
function NewSamplingManagerClient (line 28) | func NewSamplingManagerClient(cc grpc.ClientConnInterface) SamplingManag...
type SamplingManagerServer (line 44) | type SamplingManagerServer interface
type UnimplementedSamplingManagerServer (line 50) | type UnimplementedSamplingManagerServer struct
method GetSamplingStrategy (line 53) | func (UnimplementedSamplingManagerServer) GetSamplingStrategy(context....
method mustEmbedUnimplementedSamplingManagerServer (line 56) | func (UnimplementedSamplingManagerServer) mustEmbedUnimplementedSampli...
type UnsafeSamplingManagerServer (line 61) | type UnsafeSamplingManagerServer interface
function RegisterSamplingManagerServer (line 65) | func RegisterSamplingManagerServer(s grpc.ServiceRegistrar, srv Sampling...
function _SamplingManager_GetSamplingStrategy_Handler (line 69) | func _SamplingManager_GetSamplingStrategy_Handler(srv interface{}, ctx c...
FILE: chapter/11/ops/proto/ops.pb.go
constant _ (line 20) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 22) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type SamplerType (line 25) | type SamplerType
method Enum (line 50) | func (x SamplerType) Enum() *SamplerType {
method String (line 56) | func (x SamplerType) String() string {
method Descriptor (line 60) | func (SamplerType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 64) | func (SamplerType) Type() protoreflect.EnumType {
method Number (line 68) | func (x SamplerType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 73) | func (SamplerType) EnumDescriptor() ([]byte, []int) {
constant SamplerType_STUnknown (line 28) | SamplerType_STUnknown SamplerType = 0
constant SamplerType_STNever (line 29) | SamplerType_STNever SamplerType = 1
constant SamplerType_STAlways (line 30) | SamplerType_STAlways SamplerType = 2
constant SamplerType_STFloat (line 31) | SamplerType_STFloat SamplerType = 3
type ListTracesReq (line 78) | type ListTracesReq struct
method Reset (line 101) | func (x *ListTracesReq) Reset() {
method String (line 110) | func (x *ListTracesReq) String() string {
method ProtoMessage (line 114) | func (*ListTracesReq) ProtoMessage() {}
method ProtoReflect (line 116) | func (x *ListTracesReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 129) | func (*ListTracesReq) Descriptor() ([]byte, []int) {
method GetService (line 133) | func (x *ListTracesReq) GetService() string {
method GetOperation (line 140) | func (x *ListTracesReq) GetOperation() string {
method GetTags (line 147) | func (x *ListTracesReq) GetTags() []string {
method GetStart (line 154) | func (x *ListTracesReq) GetStart() int64 {
method GetEnd (line 161) | func (x *ListTracesReq) GetEnd() int64 {
method GetDurationMin (line 168) | func (x *ListTracesReq) GetDurationMin() int64 {
method GetDurationMax (line 175) | func (x *ListTracesReq) GetDurationMax() int64 {
method GetSearchDepth (line 182) | func (x *ListTracesReq) GetSearchDepth() int32 {
type TraceItem (line 190) | type TraceItem struct
method Reset (line 201) | func (x *TraceItem) Reset() {
method String (line 210) | func (x *TraceItem) String() string {
method ProtoMessage (line 214) | func (*TraceItem) ProtoMessage() {}
method ProtoReflect (line 216) | func (x *TraceItem) ProtoReflect() protoreflect.Message {
method Descriptor (line 229) | func (*TraceItem) Descriptor() ([]byte, []int) {
method GetId (line 233) | func (x *TraceItem) GetId() string {
method GetStart (line 240) | func (x *TraceItem) GetStart() int64 {
type ListTracesResp (line 248) | type ListTracesResp struct
method Reset (line 257) | func (x *ListTracesResp) Reset() {
method String (line 266) | func (x *ListTracesResp) String() string {
method ProtoMessage (line 270) | func (*ListTracesResp) ProtoMessage() {}
method ProtoReflect (line 272) | func (x *ListTracesResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 285) | func (*ListTracesResp) Descriptor() ([]byte, []int) {
method GetTraces (line 289) | func (x *ListTracesResp) GetTraces() []*TraceItem {
type ShowTraceReq (line 297) | type ShowTraceReq struct
method Reset (line 306) | func (x *ShowTraceReq) Reset() {
method String (line 315) | func (x *ShowTraceReq) String() string {
method ProtoMessage (line 319) | func (*ShowTraceReq) ProtoMessage() {}
method ProtoReflect (line 321) | func (x *ShowTraceReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 334) | func (*ShowTraceReq) Descriptor() ([]byte, []int) {
method GetId (line 338) | func (x *ShowTraceReq) GetId() string {
type ShowTraceResp (line 346) | type ShowTraceResp struct
method Reset (line 363) | func (x *ShowTraceResp) Reset() {
method String (line 372) | func (x *ShowTraceResp) String() string {
method ProtoMessage (line 376) | func (*ShowTraceResp) ProtoMessage() {}
method ProtoReflect (line 378) | func (x *ShowTraceResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 391) | func (*ShowTraceResp) Descriptor() ([]byte, []int) {
method GetId (line 395) | func (x *ShowTraceResp) GetId() string {
method GetOperations (line 402) | func (x *ShowTraceResp) GetOperations() []string {
method GetErrors (line 409) | func (x *ShowTraceResp) GetErrors() []string {
method GetTags (line 416) | func (x *ShowTraceResp) GetTags() []string {
method GetDuration (line 423) | func (x *ShowTraceResp) GetDuration() *durationpb.Duration {
type ShowLogsReq (line 430) | type ShowLogsReq struct
method Reset (line 439) | func (x *ShowLogsReq) Reset() {
method String (line 448) | func (x *ShowLogsReq) String() string {
method ProtoMessage (line 452) | func (*ShowLogsReq) ProtoMessage() {}
method ProtoReflect (line 454) | func (x *ShowLogsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 467) | func (*ShowLogsReq) Descriptor() ([]byte, []int) {
method GetId (line 471) | func (x *ShowLogsReq) GetId() string {
type ShowLogsResp (line 478) | type ShowLogsResp struct
method Reset (line 487) | func (x *ShowLogsResp) Reset() {
method String (line 496) | func (x *ShowLogsResp) String() string {
method ProtoMessage (line 500) | func (*ShowLogsResp) ProtoMessage() {}
method ProtoReflect (line 502) | func (x *ShowLogsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 515) | func (*ShowLogsResp) Descriptor() ([]byte, []int) {
method GetId (line 519) | func (x *ShowLogsResp) GetId() string {
method GetLogs (line 526) | func (x *ShowLogsResp) GetLogs() []*model.Log {
type ChangeSamplingReq (line 534) | type ChangeSamplingReq struct
method Reset (line 546) | func (x *ChangeSamplingReq) Reset() {
method String (line 555) | func (x *ChangeSamplingReq) String() string {
method ProtoMessage (line 559) | func (*ChangeSamplingReq) ProtoMessage() {}
method ProtoReflect (line 561) | func (x *ChangeSamplingReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 574) | func (*ChangeSamplingReq) Descriptor() ([]byte, []int) {
method GetType (line 578) | func (x *ChangeSamplingReq) GetType() SamplerType {
method GetFloatValue (line 585) | func (x *ChangeSamplingReq) GetFloatValue() float64 {
type ChangeSamplingResp (line 593) | type ChangeSamplingResp struct
method Reset (line 599) | func (x *ChangeSamplingResp) Reset() {
method String (line 608) | func (x *ChangeSamplingResp) String() string {
method ProtoMessage (line 612) | func (*ChangeSamplingResp) ProtoMessage() {}
method ProtoReflect (line 614) | func (x *ChangeSamplingResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 627) | func (*ChangeSamplingResp) Descriptor() ([]byte, []int) {
type DeployedVersionReq (line 632) | type DeployedVersionReq struct
method Reset (line 638) | func (x *DeployedVersionReq) Reset() {
method String (line 647) | func (x *DeployedVersionReq) String() string {
method ProtoMessage (line 651) | func (*DeployedVersionReq) ProtoMessage() {}
method ProtoReflect (line 653) | func (x *DeployedVersionReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 666) | func (*DeployedVersionReq) Descriptor() ([]byte, []int) {
type DeployedVersionResp (line 671) | type DeployedVersionResp struct
method Reset (line 680) | func (x *DeployedVersionResp) Reset() {
method String (line 689) | func (x *DeployedVersionResp) String() string {
method ProtoMessage (line 693) | func (*DeployedVersionResp) ProtoMessage() {}
method ProtoReflect (line 695) | func (x *DeployedVersionResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 708) | func (*DeployedVersionResp) Descriptor() ([]byte, []int) {
method GetVersion (line 712) | func (x *DeployedVersionResp) GetVersion() string {
type Alert (line 720) | type Alert struct
method Reset (line 733) | func (x *Alert) Reset() {
method String (line 742) | func (x *Alert) String() string {
method ProtoMessage (line 746) | func (*Alert) ProtoMessage() {}
method ProtoReflect (line 748) | func (x *Alert) ProtoReflect() protoreflect.Message {
method Descriptor (line 761) | func (*Alert) Descriptor() ([]byte, []int) {
method GetState (line 765) | func (x *Alert) GetState() string {
method GetValue (line 772) | func (x *Alert) GetValue() string {
method GetActiveAt (line 779) | func (x *Alert) GetActiveAt() int64 {
type AlertsReq (line 787) | type AlertsReq struct
method Reset (line 800) | func (x *AlertsReq) Reset() {
method String (line 809) | func (x *AlertsReq) String() string {
method ProtoMessage (line 813) | func (*AlertsReq) ProtoMessage() {}
method ProtoReflect (line 815) | func (x *AlertsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 828) | func (*AlertsReq) Descriptor() ([]byte, []int) {
method GetLabels (line 832) | func (x *AlertsReq) GetLabels() []string {
method GetActiveAt (line 839) | func (x *AlertsReq) GetActiveAt() int64 {
method GetStates (line 846) | func (x *AlertsReq) GetStates() []string {
type AlertsResp (line 854) | type AlertsResp struct
method Reset (line 863) | func (x *AlertsResp) Reset() {
method String (line 872) | func (x *AlertsResp) String() string {
method ProtoMessage (line 876) | func (*AlertsResp) ProtoMessage() {}
method ProtoReflect (line 878) | func (x *AlertsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 891) | func (*AlertsResp) Descriptor() ([]byte, []int) {
method GetAlerts (line 895) | func (x *AlertsResp) GetAlerts() []*Alert {
function file_ops_proto_rawDescGZIP (line 1014) | func file_ops_proto_rawDescGZIP() []byte {
function init (line 1067) | func init() { file_ops_proto_init() }
function file_ops_proto_init (line 1068) | func file_ops_proto_init() {
FILE: chapter/11/ops/proto/ops_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type OpsClient (line 20) | type OpsClient interface
type opsClient (line 35) | type opsClient struct
method ListTraces (line 43) | func (c *opsClient) ListTraces(ctx context.Context, in *ListTracesReq,...
method ShowTrace (line 52) | func (c *opsClient) ShowTrace(ctx context.Context, in *ShowTraceReq, o...
method ShowLogs (line 61) | func (c *opsClient) ShowLogs(ctx context.Context, in *ShowLogsReq, opt...
method ChangeSampling (line 70) | func (c *opsClient) ChangeSampling(ctx context.Context, in *ChangeSamp...
method DeployedVersion (line 79) | func (c *opsClient) DeployedVersion(ctx context.Context, in *DeployedV...
method Alerts (line 88) | func (c *opsClient) Alerts(ctx context.Context, in *AlertsReq, opts .....
function NewOpsClient (line 39) | func NewOpsClient(cc grpc.ClientConnInterface) OpsClient {
type OpsServer (line 100) | type OpsServer interface
type UnimplementedOpsServer (line 117) | type UnimplementedOpsServer struct
method ListTraces (line 120) | func (UnimplementedOpsServer) ListTraces(context.Context, *ListTracesR...
method ShowTrace (line 123) | func (UnimplementedOpsServer) ShowTrace(context.Context, *ShowTraceReq...
method ShowLogs (line 126) | func (UnimplementedOpsServer) ShowLogs(context.Context, *ShowLogsReq) ...
method ChangeSampling (line 129) | func (UnimplementedOpsServer) ChangeSampling(context.Context, *ChangeS...
method DeployedVersion (line 132) | func (UnimplementedOpsServer) DeployedVersion(context.Context, *Deploy...
method Alerts (line 135) | func (UnimplementedOpsServer) Alerts(context.Context, *AlertsReq) (*Al...
method mustEmbedUnimplementedOpsServer (line 138) | func (UnimplementedOpsServer) mustEmbedUnimplementedOpsServer() {}
type UnsafeOpsServer (line 143) | type UnsafeOpsServer interface
function RegisterOpsServer (line 147) | func RegisterOpsServer(s grpc.ServiceRegistrar, srv OpsServer) {
function _Ops_ListTraces_Handler (line 151) | func _Ops_ListTraces_Handler(srv interface{}, ctx context.Context, dec f...
function _Ops_ShowTrace_Handler (line 169) | func _Ops_ShowTrace_Handler(srv interface{}, ctx context.Context, dec fu...
function _Ops_ShowLogs_Handler (line 187) | func _Ops_ShowLogs_Handler(srv interface{}, ctx context.Context, dec fun...
function _Ops_ChangeSampling_Handler (line 205) | func _Ops_ChangeSampling_Handler(srv interface{}, ctx context.Context, d...
function _Ops_DeployedVersion_Handler (line 223) | func _Ops_DeployedVersion_Handler(srv interface{}, ctx context.Context, ...
function _Ops_Alerts_Handler (line 241) | func _Ops_Alerts_Handler(srv interface{}, ctx context.Context, dec func(...
FILE: chapter/11/petstore/client/cli/petstore/petstore.go
constant helpText (line 20) | helpText = `
function main (line 59) | func main() {
function getSearchReq (line 135) | func getSearchReq() *pb.SearchPetsReq {
FILE: chapter/11/petstore/client/client.go
type Client (line 19) | type Client struct
method AddPets (line 83) | func (c *Client) AddPets(ctx context.Context, pets []*pb.Pet, options ...
method UpdatePets (line 106) | func (c *Client) UpdatePets(ctx context.Context, pets []*pb.Pet, optio...
method DeletePets (line 130) | func (c *Client) DeletePets(ctx context.Context, ids []string, options...
method SearchPets (line 148) | func (c *Client) SearchPets(ctx context.Context, filter *pb.SearchPets...
method ChangeSampler (line 229) | func (c *Client) ChangeSampler(ctx context.Context, sc Sampler, option...
function New (line 25) | func New(addr string) (*Client, error) {
type Pet (line 39) | type Pet struct
method Proto (line 45) | func (p Pet) Proto() *pb.Pet {
method Birthday (line 50) | func (p Pet) Birthday() time.Time {
method Error (line 58) | func (p Pet) Error() error {
type CallOption (line 63) | type CallOption
type callOptions (line 65) | type callOptions struct
function TraceID (line 72) | func TraceID(s *string) CallOption {
type SamplerType (line 181) | type SamplerType
constant STUnknown (line 184) | STUnknown SamplerType = 0
constant Never (line 185) | Never SamplerType = 1
constant Always (line 186) | Always SamplerType = 2
constant Float (line 187) | Float SamplerType = 3
type Sampler (line 196) | type Sampler struct
method validate (line 203) | func (s *Sampler) validate() error {
method proto (line 215) | func (s *Sampler) proto() *pb.Sampler {
method fromProto (line 222) | func (s *Sampler) fromProto(p *pb.Sampler) {
function handleCallOptions (line 245) | func handleCallOptions(ctx context.Context, header *metadata.MD, options...
FILE: chapter/11/petstore/client/demo/demo.go
function main (line 28) | func main() {
function addNames (line 58) | func addNames(ctx context.Context, c *client.Client, names []string) {
function searchNames (line 94) | func searchNames(ctx context.Context, c *client.Client, names []string) {
FILE: chapter/11/petstore/internal/server/errors/errors.go
function New (line 16) | func New(ctx context.Context, text string) error {
function Errorf (line 28) | func Errorf(ctx context.Context, s string, i ...interface{}) error {
function As (line 39) | func As(err error, target interface{}) bool {
function Is (line 44) | func Is(err, target error) bool {
function Unwrap (line 49) | func Unwrap(err error) error {
FILE: chapter/11/petstore/internal/server/log/log.go
constant Ldate (line 55) | Ldate = 1 << iota
constant Ltime (line 56) | Ltime
constant Lmicroseconds (line 57) | Lmicroseconds
constant Llongfile (line 58) | Llongfile
constant Lshortfile (line 59) | Lshortfile
constant LUTC (line 60) | LUTC
constant LstdFlags (line 61) | LstdFlags = Ldate | Ltime
type eventPool (line 84) | type eventPool struct
method get (line 89) | func (e *eventPool) get() *Event {
method put (line 98) | func (e *eventPool) put(ev *Event) {
type Event (line 112) | type Event struct
method reset (line 124) | func (e *Event) reset() {
method Add (line 131) | func (e *Event) Add(k string, i interface{}) {
method Done (line 165) | func (e *Event) Done(ctx context.Context) {
function NewEvent (line 118) | func NewEvent(name string) *Event {
function Println (line 179) | func Println(ctx context.Context, v ...interface{}) {
function Printf (line 188) | func Printf(ctx context.Context, format string, v ...interface{}) {
function SetFlags (line 197) | func SetFlags(flag int) {
type logger (line 202) | type logger struct
method output (line 225) | func (l *logger) output(span trace.Span, calldepth int, s string) error {
method formatHeader (line 256) | func (l *logger) formatHeader(buf *[]byte, t time.Time, file string, l...
function itoa (line 209) | func itoa(buf *[]byte, i int, wid int) {
FILE: chapter/11/petstore/internal/server/server.go
function init (line 47) | func init() {
type API (line 71) | type API struct
method Start (line 108) | func (a *API) Start() error {
method Stop (line 121) | func (a *API) Stop() {
method AddPets (line 129) | func (a *API) AddPets(ctx context.Context, req *pb.AddPetsReq) (resp *...
method UpdatePets (line 173) | func (a *API) UpdatePets(ctx context.Context, req *pb.UpdatePetsReq) (...
method DeletePets (line 212) | func (a *API) DeletePets(ctx context.Context, req *pb.DeletePetsReq) (...
method SearchPets (line 245) | func (a *API) SearchPets(req *pb.SearchPetsReq, stream pb.PetStore_Sea...
method ChangeSampler (line 297) | func (a *API) ChangeSampler(ctx context.Context, req *pb.ChangeSampler...
type Option (line 83) | type Option
function WithGRPCOpts (line 86) | func WithGRPCOpts(opts ...grpc.ServerOption) Option {
function New (line 93) | func New(addr string, store storage.Data, options ...Option) (*API, erro...
function validateSearch (line 317) | func validateSearch(ctx context.Context, r *pb.SearchPetsReq) error {
function doTrace (line 341) | func doTrace(ctx context.Context, name string, req proto.Message) (newCt...
function convertTraceID (line 386) | func convertTraceID(id string) string {
FILE: chapter/11/petstore/internal/server/storage/mem/mem.go
type birthdays (line 24) | type birthdays
method Compare (line 27) | func (bi birthdays) Compare(b llrb.Comparable) int {
type birthdayGet (line 52) | type birthdayGet struct
method Compare (line 57) | func (bi birthdayGet) Compare(b llrb.Comparable) int {
type Data (line 83) | type Data struct
method AddPets (line 112) | func (d *Data) AddPets(ctx context.Context, pets []*pb.Pet) error {
method UpdatePets (line 137) | func (d *Data) UpdatePets(ctx context.Context, pets []*pb.Pet) error {
method populate (line 154) | func (d *Data) populate(ctx context.Context, pets []*pb.Pet) {
method DeletePets (line 184) | func (d *Data) DeletePets(ctx context.Context, ids []string) error {
method SearchPets (line 228) | func (d *Data) SearchPets(ctx context.Context, filter *pb.SearchPetsRe...
method searchPets (line 239) | func (d *Data) searchPets(ctx context.Context, filter *pb.SearchPetsRe...
method returnAll (line 334) | func (d *Data) returnAll(ctx context.Context, out chan storage.SearchI...
method byNames (line 356) | func (d *Data) byNames(ctx context.Context, filter *pb.SearchPetsReq) ...
method byTypes (line 388) | func (d *Data) byTypes(ctx context.Context, filter *pb.SearchPetsReq) ...
method byBirthdays (line 419) | func (d *Data) byBirthdays(ctx context.Context, filter *pb.SearchPetsR...
function New (line 96) | func New() *Data {
FILE: chapter/11/petstore/internal/server/storage/mem/mem_test.go
function makePets (line 62) | func makePets() *Data {
function TestByNames (line 74) | func TestByNames(t *testing.T) {
function TestByTypes (line 86) | func TestByTypes(t *testing.T) {
function TestByBirthdays (line 98) | func TestByBirthdays(t *testing.T) {
function TestDeletePets (line 118) | func TestDeletePets(t *testing.T) {
function TestSearchPets (line 155) | func TestSearchPets(t *testing.T) {
FILE: chapter/11/petstore/internal/server/storage/storage.go
type Data (line 16) | type Data interface
type SearchItem (line 30) | type SearchItem struct
function ValidatePet (line 39) | func ValidatePet(ctx context.Context, p *pb.Pet, forUpdate bool) error {
function BirthdayToTime (line 65) | func BirthdayToTime(ctx context.Context, d *dpb.Date) (time.Time, error) {
FILE: chapter/11/petstore/internal/server/telemetry/metrics/metrics.go
type metricType (line 51) | type metricType
constant unknown (line 54) | unknown = 0
constant mtInt64 (line 55) | mtInt64 = 1
constant mtInt64Hist (line 56) | mtInt64Hist = 2
constant mtInt64UD (line 57) | mtInt64UD = 3
type metricDef (line 60) | type metricDef struct
type Lookups (line 110) | type Lookups struct
method Int64 (line 167) | func (l *Lookups) Int64(s string) metric.Int64Counter {
method Int64s (line 180) | func (l *Lookups) Int64s(s ...string) []metric.Int64Counter {
method Int64UD (line 189) | func (l *Lookups) Int64UD(s string) metric.Int64UpDownCounter {
method Int64UDs (line 202) | func (l *Lookups) Int64UDs(s ...string) []metric.Int64UpDownCounter {
method Int64Hist (line 211) | func (l *Lookups) Int64Hist(s string) metric.Int64Histogram {
method Int64Hists (line 223) | func (l *Lookups) Int64Hists(s ...string) []metric.Int64Histogram {
method unused (line 231) | func (l *Lookups) unused() []string {
function newLookups (line 119) | func newLookups() *Lookups {
FILE: chapter/11/petstore/internal/server/telemetry/metrics/start.go
type Controller (line 18) | type Controller interface
type OTELGRPC (line 23) | type OTELGRPC struct
method isController (line 28) | func (o OTELGRPC) isController() {}
type Stop (line 31) | type Stop
function Start (line 34) | func Start(ctx context.Context, c Controller) (Stop, error) {
function newController (line 53) | func newController(ctx context.Context, c Controller) (*basic.Controller...
function otelGRPC (line 61) | func otelGRPC(ctx context.Context, args OTELGRPC) (*basic.Controller, er...
FILE: chapter/11/petstore/internal/server/telemetry/tracing/sampler/sampler.go
constant desc (line 33) | desc = `This sampler samples if TracdID.Valid(), gRPC metadata contains ...
type Sampler (line 37) | type Sampler struct
method ShouldSample (line 57) | func (s *Sampler) ShouldSample(p trace.SamplingParameters) trace.Sampl...
method Description (line 92) | func (s *Sampler) Description() string {
method Switch (line 97) | func (s *Sampler) Switch(sampler trace.Sampler) {
function New (line 46) | func New(child trace.Sampler) (*Sampler, error) {
FILE: chapter/11/petstore/internal/server/telemetry/tracing/tracing.go
function init (line 52) | func init() {
type Exporter (line 61) | type Exporter interface
type OTELGRPC (line 66) | type OTELGRPC struct
method isExporter (line 71) | func (o OTELGRPC) isExporter() {}
type Stderr (line 74) | type Stderr struct
method isExporter (line 76) | func (s Stderr) isExporter() {}
type File (line 79) | type File struct
method isExporter (line 84) | func (f File) isExporter() {}
type Stop (line 87) | type Stop
function Start (line 91) | func Start(ctx context.Context, e Exporter) (Stop, error) {
function newTraceExporter (line 111) | func newTraceExporter(ctx context.Context, e Exporter) (*sdktrace.Tracer...
function newFileExporter (line 157) | func newFileExporter(w io.Writer) (sdktrace.SpanExporter, error) {
function otelGRPC (line 164) | func otelGRPC(ctx context.Context, e OTELGRPC) (sdktrace.SpanExporter, e...
FILE: chapter/11/petstore/petstore.go
function init (line 41) | func init() {
function otelExporter (line 53) | func otelExporter() tracing.Exporter {
function otelController (line 71) | func otelController() metrics.Controller {
function setSampling (line 79) | func setSampling() {
function tooManyTrue (line 99) | func tooManyTrue(truths ...interface{}) bool {
function main (line 124) | func main() {
FILE: chapter/11/petstore/proto/petstore.pb.go
constant _ (line 19) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 21) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type PetType (line 25) | type PetType
method Enum (line 58) | func (x PetType) Enum() *PetType {
method String (line 64) | func (x PetType) String() string {
method Descriptor (line 68) | func (PetType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 72) | func (PetType) Type() protoreflect.EnumType {
method Number (line 76) | func (x PetType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 81) | func (PetType) EnumDescriptor() ([]byte, []int) {
constant PetType_PTUnknown (line 29) | PetType_PTUnknown PetType = 0
constant PetType_PTCanine (line 31) | PetType_PTCanine PetType = 1
constant PetType_PTFeline (line 33) | PetType_PTFeline PetType = 2
constant PetType_PTBird (line 35) | PetType_PTBird PetType = 3
constant PetType_PTReptile (line 37) | PetType_PTReptile PetType = 4
type SamplerType (line 86) | type SamplerType
method Enum (line 111) | func (x SamplerType) Enum() *SamplerType {
method String (line 117) | func (x SamplerType) String() string {
method Descriptor (line 121) | func (SamplerType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 125) | func (SamplerType) Type() protoreflect.EnumType {
method Number (line 129) | func (x SamplerType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 134) | func (SamplerType) EnumDescriptor() ([]byte, []int) {
constant SamplerType_STUnknown (line 89) | SamplerType_STUnknown SamplerType = 0
constant SamplerType_STNever (line 90) | SamplerType_STNever SamplerType = 1
constant SamplerType_STAlways (line 91) | SamplerType_STAlways SamplerType = 2
constant SamplerType_STFloat (line 92) | SamplerType_STFloat SamplerType = 3
type DateRange (line 139) | type DateRange struct
method Reset (line 150) | func (x *DateRange) Reset() {
method String (line 159) | func (x *DateRange) String() string {
method ProtoMessage (line 163) | func (*DateRange) ProtoMessage() {}
method ProtoReflect (line 165) | func (x *DateRange) ProtoReflect() protoreflect.Message {
method Descriptor (line 178) | func (*DateRange) Descriptor() ([]byte, []int) {
method GetStart (line 182) | func (x *DateRange) GetStart() *date.Date {
method GetEnd (line 189) | func (x *DateRange) GetEnd() *date.Date {
type Pet (line 197) | type Pet struct
method Reset (line 212) | func (x *Pet) Reset() {
method String (line 221) | func (x *Pet) String() string {
method ProtoMessage (line 225) | func (*Pet) ProtoMessage() {}
method ProtoReflect (line 227) | func (x *Pet) ProtoReflect() protoreflect.Message {
method Descriptor (line 240) | func (*Pet) Descriptor() ([]byte, []int) {
method GetId (line 244) | func (x *Pet) GetId() string {
method GetName (line 251) | func (x *Pet) GetName() string {
method GetType (line 258) | func (x *Pet) GetType() PetType {
method GetBirthday (line 265) | func (x *Pet) GetBirthday() *date.Date {
type AddPetsReq (line 273) | type AddPetsReq struct
method Reset (line 282) | func (x *AddPetsReq) Reset() {
method String (line 291) | func (x *AddPetsReq) String() string {
method ProtoMessage (line 295) | func (*AddPetsReq) ProtoMessage() {}
method ProtoReflect (line 297) | func (x *AddPetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 310) | func (*AddPetsReq) Descriptor() ([]byte, []int) {
method GetPets (line 314) | func (x *AddPetsReq) GetPets() []*Pet {
type AddPetsResp (line 322) | type AddPetsResp struct
method Reset (line 331) | func (x *AddPetsResp) Reset() {
method String (line 340) | func (x *AddPetsResp) String() string {
method ProtoMessage (line 344) | func (*AddPetsResp) ProtoMessage() {}
method ProtoReflect (line 346) | func (x *AddPetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 359) | func (*AddPetsResp) Descriptor() ([]byte, []int) {
method GetIds (line 363) | func (x *AddPetsResp) GetIds() []string {
type UpdatePetsReq (line 371) | type UpdatePetsReq struct
method Reset (line 380) | func (x *UpdatePetsReq) Reset() {
method String (line 389) | func (x *UpdatePetsReq) String() string {
method ProtoMessage (line 393) | func (*UpdatePetsReq) ProtoMessage() {}
method ProtoReflect (line 395) | func (x *UpdatePetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 408) | func (*UpdatePetsReq) Descriptor() ([]byte, []int) {
method GetPets (line 412) | func (x *UpdatePetsReq) GetPets() []*Pet {
type UpdatePetsResp (line 420) | type UpdatePetsResp struct
method Reset (line 426) | func (x *UpdatePetsResp) Reset() {
method String (line 435) | func (x *UpdatePetsResp) String() string {
method ProtoMessage (line 439) | func (*UpdatePetsResp) ProtoMessage() {}
method ProtoReflect (line 441) | func (x *UpdatePetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 454) | func (*UpdatePetsResp) Descriptor() ([]byte, []int) {
type DeletePetsReq (line 459) | type DeletePetsReq struct
method Reset (line 468) | func (x *DeletePetsReq) Reset() {
method String (line 477) | func (x *DeletePetsReq) String() string {
method ProtoMessage (line 481) | func (*DeletePetsReq) ProtoMessage() {}
method ProtoReflect (line 483) | func (x *DeletePetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 496) | func (*DeletePetsReq) Descriptor() ([]byte, []int) {
method GetIds (line 500) | func (x *DeletePetsReq) GetIds() []string {
type DeletePetsResp (line 508) | type DeletePetsResp struct
method Reset (line 514) | func (x *DeletePetsResp) Reset() {
method String (line 523) | func (x *DeletePetsResp) String() string {
method ProtoMessage (line 527) | func (*DeletePetsResp) ProtoMessage() {}
method ProtoReflect (line 529) | func (x *DeletePetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 542) | func (*DeletePetsResp) Descriptor() ([]byte, []int) {
type SearchPetsReq (line 547) | type SearchPetsReq struct
method Reset (line 560) | func (x *SearchPetsReq) Reset() {
method String (line 569) | func (x *SearchPetsReq) String() string {
method ProtoMessage (line 573) | func (*SearchPetsReq) ProtoMessage() {}
method ProtoReflect (line 575) | func (x *SearchPetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 588) | func (*SearchPetsReq) Descriptor() ([]byte, []int) {
method GetNames (line 592) | func (x *SearchPetsReq) GetNames() []string {
method GetTypes (line 599) | func (x *SearchPetsReq) GetTypes() []PetType {
method GetBirthdateRange (line 606) | func (x *SearchPetsReq) GetBirthdateRange() *DateRange {
type Sampler (line 613) | type Sampler struct
method Reset (line 625) | func (x *Sampler) Reset() {
method String (line 634) | func (x *Sampler) String() string {
method ProtoMessage (line 638) | func (*Sampler) ProtoMessage() {}
method ProtoReflect (line 640) | func (x *Sampler) ProtoReflect() protoreflect.Message {
method Descriptor (line 653) | func (*Sampler) Descriptor() ([]byte, []int) {
method GetType (line 657) | func (x *Sampler) GetType() SamplerType {
method GetFloatValue (line 664) | func (x *Sampler) GetFloatValue() float64 {
type ChangeSamplerReq (line 672) | type ChangeSamplerReq struct
method Reset (line 680) | func (x *ChangeSamplerReq) Reset() {
method String (line 689) | func (x *ChangeSamplerReq) String() string {
method ProtoMessage (line 693) | func (*ChangeSamplerReq) ProtoMessage() {}
method ProtoReflect (line 695) | func (x *ChangeSamplerReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 708) | func (*ChangeSamplerReq) Descriptor() ([]byte, []int) {
method GetSampler (line 712) | func (x *ChangeSamplerReq) GetSampler() *Sampler {
type ChangeSamplerResp (line 720) | type ChangeSamplerResp struct
method Reset (line 726) | func (x *ChangeSamplerResp) Reset() {
method String (line 735) | func (x *ChangeSamplerResp) String() string {
method ProtoMessage (line 739) | func (*ChangeSamplerResp) ProtoMessage() {}
method ProtoReflect (line 741) | func (x *ChangeSamplerResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 754) | func (*ChangeSamplerResp) Descriptor() ([]byte, []int) {
function file_petstore_proto_rawDescGZIP (line 852) | func file_petstore_proto_rawDescGZIP() []byte {
function init (line 906) | func init() { file_petstore_proto_init() }
function file_petstore_proto_init (line 907) | func file_petstore_proto_init() {
FILE: chapter/11/petstore/proto/petstore_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type PetStoreClient (line 20) | type PetStoreClient interface
type petStoreClient (line 33) | type petStoreClient struct
method AddPets (line 41) | func (c *petStoreClient) AddPets(ctx context.Context, in *AddPetsReq, ...
method UpdatePets (line 50) | func (c *petStoreClient) UpdatePets(ctx context.Context, in *UpdatePet...
method DeletePets (line 59) | func (c *petStoreClient) DeletePets(ctx context.Context, in *DeletePet...
method SearchPets (line 68) | func (c *petStoreClient) SearchPets(ctx context.Context, in *SearchPet...
method ChangeSampler (line 100) | func (c *petStoreClient) ChangeSampler(ctx context.Context, in *Change...
function NewPetStoreClient (line 37) | func NewPetStoreClient(cc grpc.ClientConnInterface) PetStoreClient {
type PetStore_SearchPetsClient (line 83) | type PetStore_SearchPetsClient interface
type petStoreSearchPetsClient (line 88) | type petStoreSearchPetsClient struct
method Recv (line 92) | func (x *petStoreSearchPetsClient) Recv() (*Pet, error) {
type PetStoreServer (line 112) | type PetStoreServer interface
type UnimplementedPetStoreServer (line 127) | type UnimplementedPetStoreServer struct
method AddPets (line 130) | func (UnimplementedPetStoreServer) AddPets(context.Context, *AddPetsRe...
method UpdatePets (line 133) | func (UnimplementedPetStoreServer) UpdatePets(context.Context, *Update...
method DeletePets (line 136) | func (UnimplementedPetStoreServer) DeletePets(context.Context, *Delete...
method SearchPets (line 139) | func (UnimplementedPetStoreServer) SearchPets(*SearchPetsReq, PetStore...
method ChangeSampler (line 142) | func (UnimplementedPetStoreServer) ChangeSampler(context.Context, *Cha...
method mustEmbedUnimplementedPetStoreServer (line 145) | func (UnimplementedPetStoreServer) mustEmbedUnimplementedPetStoreServe...
type UnsafePetStoreServer (line 150) | type UnsafePetStoreServer interface
function RegisterPetStoreServer (line 154) | func RegisterPetStoreServer(s grpc.ServiceRegistrar, srv PetStoreServer) {
function _PetStore_AddPets_Handler (line 158) | func _PetStore_AddPets_Handler(srv interface{}, ctx context.Context, dec...
function _PetStore_UpdatePets_Handler (line 176) | func _PetStore_UpdatePets_Handler(srv interface{}, ctx context.Context, ...
function _PetStore_DeletePets_Handler (line 194) | func _PetStore_DeletePets_Handler(srv interface{}, ctx context.Context, ...
function _PetStore_SearchPets_Handler (line 212) | func _PetStore_SearchPets_Handler(srv interface{}, stream grpc.ServerStr...
type PetStore_SearchPetsServer (line 220) | type PetStore_SearchPetsServer interface
type petStoreSearchPetsServer (line 225) | type petStoreSearchPetsServer struct
method Send (line 229) | func (x *petStoreSearchPetsServer) Send(m *Pet) error {
function _PetStore_ChangeSampler_Handler (line 233) | func _PetStore_ChangeSampler_Handler(srv interface{}, ctx context.Contex...
FILE: chapter/12/goss/allfiles/allfiles.go
function main (line 35) | func main() {
type fileEntry (line 106) | type fileEntry struct
function addFileEntries (line 111) | func addFileEntries(fe fileEntry) (*resource.File, error) {
function mustUserGroup (line 130) | func mustUserGroup(fe fileEntry) (string, string) {
function doSHA256 (line 147) | func doSHA256(p string) (string, error) {
FILE: chapter/12/packer/plugins/goenv/goenv.go
constant ver (line 25) | ver = "0.0.15"
constant release (line 26) | release = "dev"
function init (line 31) | func init() {
function main (line 35) | func main() {
type Provisioner (line 48) | type Provisioner struct
method ConfigSpec (line 56) | func (p *Provisioner) ConfigSpec() hcldec.ObjectSpec {
method Prepare (line 60) | func (p *Provisioner) Prepare(raws ...interface{}) error {
method Provision (line 70) | func (p *Provisioner) Provision(ctx context.Context, u packer.Ui, c pa...
method fetch (line 92) | func (p *Provisioner) fetch(ctx context.Context, u packer.Ui, c packer...
method push (line 138) | func (p *Provisioner) push(ctx context.Context, u packer.Ui, c packer....
method unpack (line 157) | func (p *Provisioner) unpack(ctx context.Context, u packer.Ui, c packe...
method test (line 175) | func (p *Provisioner) test(ctx context.Context, u packer.Ui, c packer....
FILE: chapter/12/packer/plugins/goenv/internal/config/config.go
type Provisioner (line 6) | type Provisioner struct
method Defaults (line 11) | func (p *Provisioner) Defaults() {
FILE: chapter/12/packer/plugins/goenv/internal/config/config.hcl2spec.go
type FlatProvisioner (line 12) | type FlatProvisioner struct
method HCL2Spec (line 26) | func (*FlatProvisioner) HCL2Spec() map[string]hcldec.Spec {
method FlatMapstructure (line 19) | func (*Provisioner) FlatMapstructure() interface{ HCL2Spec() map[string]...
FILE: chapter/13/petstore-provider/internal/client/client.go
type Client (line 18) | type Client struct
method AddPets (line 82) | func (c *Client) AddPets(ctx context.Context, pets []*pb.Pet, options ...
method UpdatePets (line 105) | func (c *Client) UpdatePets(ctx context.Context, pets []*pb.Pet, optio...
method DeletePets (line 129) | func (c *Client) DeletePets(ctx context.Context, ids []string, options...
method SearchPets (line 147) | func (c *Client) SearchPets(ctx context.Context, filter *pb.SearchPets...
method ChangeSampler (line 228) | func (c *Client) ChangeSampler(ctx context.Context, sc Sampler, option...
function New (line 24) | func New(addr string) (*Client, error) {
type Pet (line 38) | type Pet struct
method Proto (line 44) | func (p Pet) Proto() *pb.Pet {
method Birthday (line 49) | func (p Pet) Birthday() time.Time {
method Error (line 57) | func (p Pet) Error() error {
type CallOption (line 62) | type CallOption
type callOptions (line 64) | type callOptions struct
function TraceID (line 71) | func TraceID(s *string) CallOption {
type SamplerType (line 180) | type SamplerType
constant STUnknown (line 183) | STUnknown SamplerType = 0
constant Never (line 184) | Never SamplerType = 1
constant Always (line 185) | Always SamplerType = 2
constant Float (line 186) | Float SamplerType = 3
type Sampler (line 195) | type Sampler struct
method validate (line 202) | func (s *Sampler) validate() error {
method proto (line 214) | func (s *Sampler) proto() *pb.Sampler {
method fromProto (line 221) | func (s *Sampler) fromProto(p *pb.Sampler) {
function handleCallOptions (line 244) | func handleCallOptions(ctx context.Context, header *metadata.MD, options...
FILE: chapter/13/petstore-provider/internal/client/internal/server/errors/errors.go
function New (line 16) | func New(ctx context.Context, text string) error {
function Errorf (line 28) | func Errorf(ctx context.Context, s string, i ...interface{}) error {
function As (line 39) | func As(err error, target interface{}) bool {
function Is (line 44) | func Is(err, target error) bool {
function Unwrap (line 49) | func Unwrap(err error) error {
FILE: chapter/13/petstore-provider/internal/client/internal/server/log/log.go
constant Ldate (line 55) | Ldate = 1 << iota
constant Ltime (line 56) | Ltime
constant Lmicroseconds (line 57) | Lmicroseconds
constant Llongfile (line 58) | Llongfile
constant Lshortfile (line 59) | Lshortfile
constant LUTC (line 60) | LUTC
constant LstdFlags (line 61) | LstdFlags = Ldate | Ltime
type eventPool (line 84) | type eventPool struct
method get (line 89) | func (e *eventPool) get() *Event {
method put (line 98) | func (e *eventPool) put(ev *Event) {
type Event (line 112) | type Event struct
method reset (line 124) | func (e *Event) reset() {
method Add (line 131) | func (e *Event) Add(k string, i interface{}) {
method Done (line 163) | func (e *Event) Done(ctx context.Context) {
function NewEvent (line 118) | func NewEvent(name string) *Event {
function Println (line 177) | func Println(ctx context.Context, v ...interface{}) {
function Printf (line 186) | func Printf(ctx context.Context, format string, v ...interface{}) {
function SetFlags (line 195) | func SetFlags(flag int) {
type logger (line 200) | type logger struct
method output (line 223) | func (l *logger) output(span trace.Span, calldepth int, s string) error {
method formatHeader (line 254) | func (l *logger) formatHeader(buf *[]byte, t time.Time, file string, l...
function itoa (line 207) | func itoa(buf *[]byte, i int, wid int) {
FILE: chapter/13/petstore-provider/internal/client/internal/server/storage/mem/mem.go
type birthdays (line 23) | type birthdays
method Compare (line 26) | func (bi birthdays) Compare(b llrb.Comparable) int {
type birthdayGet (line 51) | type birthdayGet struct
method Compare (line 56) | func (bi birthdayGet) Compare(b llrb.Comparable) int {
type Data (line 82) | type Data struct
method AddPets (line 111) | func (d *Data) AddPets(ctx context.Context, pets []*pb.Pet) error {
method UpdatePets (line 136) | func (d *Data) UpdatePets(ctx context.Context, pets []*pb.Pet) error {
method populate (line 153) | func (d *Data) populate(ctx context.Context, pets []*pb.Pet) {
method DeletePets (line 183) | func (d *Data) DeletePets(ctx context.Context, ids []string) error {
method SearchPets (line 227) | func (d *Data) SearchPets(ctx context.Context, filter *pb.SearchPetsRe...
method searchPets (line 238) | func (d *Data) searchPets(ctx context.Context, filter *pb.SearchPetsRe...
method returnAll (line 333) | func (d *Data) returnAll(ctx context.Context, out chan storage.SearchI...
method byNames (line 355) | func (d *Data) byNames(ctx context.Context, filter *pb.SearchPetsReq) ...
method byTypes (line 387) | func (d *Data) byTypes(ctx context.Context, filter *pb.SearchPetsReq) ...
method byBirthdays (line 418) | func (d *Data) byBirthdays(ctx context.Context, filter *pb.SearchPetsR...
function New (line 95) | func New() *Data {
FILE: chapter/13/petstore-provider/internal/client/internal/server/storage/mem/mem_test.go
function makePets (line 61) | func makePets() *Data {
function TestByNames (line 73) | func TestByNames(t *testing.T) {
function TestByTypes (line 85) | func TestByTypes(t *testing.T) {
function TestByBirthdays (line 97) | func TestByBirthdays(t *testing.T) {
function TestDeletePets (line 117) | func TestDeletePets(t *testing.T) {
function TestSearchPets (line 154) | func TestSearchPets(t *testing.T) {
FILE: chapter/13/petstore-provider/internal/client/internal/server/storage/storage.go
type Data (line 15) | type Data interface
type SearchItem (line 29) | type SearchItem struct
function ValidatePet (line 38) | func ValidatePet(ctx context.Context, p *pb.Pet, forUpdate bool) error {
function BirthdayToTime (line 64) | func BirthdayToTime(ctx context.Context, d *dpb.Date) (time.Time, error) {
FILE: chapter/13/petstore-provider/internal/client/internal/server/telemetry/metrics/metrics.go
type metricType (line 51) | type metricType
constant unknown (line 54) | unknown = 0
constant mtInt64 (line 55) | mtInt64 = 1
constant mtInt64Hist (line 56) | mtInt64Hist = 2
constant mtInt64UD (line 57) | mtInt64UD = 3
type metricDef (line 60) | type metricDef struct
type Lookups (line 110) | type Lookups struct
method Int64 (line 167) | func (l *Lookups) Int64(s string) metric.Int64Counter {
method Int64s (line 180) | func (l *Lookups) Int64s(s ...string) []metric.Int64Counter {
method Int64UD (line 189) | func (l *Lookups) Int64UD(s string) metric.Int64UpDownCounter {
method Int64UDs (line 202) | func (l *Lookups) Int64UDs(s ...string) []metric.Int64UpDownCounter {
method Int64Hist (line 211) | func (l *Lookups) Int64Hist(s string) metric.Int64Histogram {
method Int64Hists (line 223) | func (l *Lookups) Int64Hists(s ...string) []metric.Int64Histogram {
method unused (line 231) | func (l *Lookups) unused() []string {
function newLookups (line 119) | func newLookups() *Lookups {
FILE: chapter/13/petstore-provider/internal/client/internal/server/telemetry/metrics/start.go
type Controller (line 18) | type Controller interface
type OTELGRPC (line 23) | type OTELGRPC struct
method isController (line 28) | func (o OTELGRPC) isController() {}
type Stop (line 31) | type Stop
function Start (line 34) | func Start(ctx context.Context, c Controller) (Stop, error) {
function newController (line 53) | func newController(ctx context.Context, c Controller) (*basic.Controller...
function otelGRPC (line 61) | func otelGRPC(ctx context.Context, args OTELGRPC) (*basic.Controller, er...
FILE: chapter/13/petstore-provider/internal/client/internal/server/telemetry/tracing/sampler/sampler.go
constant desc (line 33) | desc = `This sampler samples if TracdID.Valid(), gRPC metadata contains ...
type Sampler (line 37) | type Sampler struct
method ShouldSample (line 57) | func (s *Sampler) ShouldSample(p trace.SamplingParameters) trace.Sampl...
method Description (line 92) | func (s *Sampler) Description() string {
method Switch (line 97) | func (s *Sampler) Switch(sampler trace.Sampler) {
function New (line 46) | func New(child trace.Sampler) (*Sampler, error) {
FILE: chapter/13/petstore-provider/internal/client/internal/server/telemetry/tracing/tracing.go
function init (line 52) | func init() {
type Exporter (line 61) | type Exporter interface
type OTELGRPC (line 66) | type OTELGRPC struct
method isExporter (line 71) | func (o OTELGRPC) isExporter() {}
type Stderr (line 74) | type Stderr struct
method isExporter (line 76) | func (s Stderr) isExporter() {}
type File (line 79) | type File struct
method isExporter (line 84) | func (f File) isExporter() {}
type Stop (line 87) | type Stop
function Start (line 91) | func Start(ctx context.Context, e Exporter) (Stop, error) {
function newTraceExporter (line 111) | func newTraceExporter(ctx context.Context, e Exporter) (*sdktrace.Tracer...
function newFileExporter (line 157) | func newFileExporter(w io.Writer) (sdktrace.SpanExporter, error) {
function otelGRPC (line 164) | func otelGRPC(ctx context.Context, e OTELGRPC) (sdktrace.SpanExporter, e...
FILE: chapter/13/petstore-provider/internal/client/proto/petstore.pb.go
constant _ (line 19) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 21) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type PetType (line 25) | type PetType
method Enum (line 58) | func (x PetType) Enum() *PetType {
method String (line 64) | func (x PetType) String() string {
method Descriptor (line 68) | func (PetType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 72) | func (PetType) Type() protoreflect.EnumType {
method Number (line 76) | func (x PetType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 81) | func (PetType) EnumDescriptor() ([]byte, []int) {
constant PetType_PTUnknown (line 29) | PetType_PTUnknown PetType = 0
constant PetType_PTCanine (line 31) | PetType_PTCanine PetType = 1
constant PetType_PTFeline (line 33) | PetType_PTFeline PetType = 2
constant PetType_PTBird (line 35) | PetType_PTBird PetType = 3
constant PetType_PTReptile (line 37) | PetType_PTReptile PetType = 4
type SamplerType (line 86) | type SamplerType
method Enum (line 111) | func (x SamplerType) Enum() *SamplerType {
method String (line 117) | func (x SamplerType) String() string {
method Descriptor (line 121) | func (SamplerType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 125) | func (SamplerType) Type() protoreflect.EnumType {
method Number (line 129) | func (x SamplerType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 134) | func (SamplerType) EnumDescriptor() ([]byte, []int) {
constant SamplerType_STUnknown (line 89) | SamplerType_STUnknown SamplerType = 0
constant SamplerType_STNever (line 90) | SamplerType_STNever SamplerType = 1
constant SamplerType_STAlways (line 91) | SamplerType_STAlways SamplerType = 2
constant SamplerType_STFloat (line 92) | SamplerType_STFloat SamplerType = 3
type DateRange (line 139) | type DateRange struct
method Reset (line 150) | func (x *DateRange) Reset() {
method String (line 159) | func (x *DateRange) String() string {
method ProtoMessage (line 163) | func (*DateRange) ProtoMessage() {}
method ProtoReflect (line 165) | func (x *DateRange) ProtoReflect() protoreflect.Message {
method Descriptor (line 178) | func (*DateRange) Descriptor() ([]byte, []int) {
method GetStart (line 182) | func (x *DateRange) GetStart() *date.Date {
method GetEnd (line 189) | func (x *DateRange) GetEnd() *date.Date {
type Pet (line 197) | type Pet struct
method Reset (line 212) | func (x *Pet) Reset() {
method String (line 221) | func (x *Pet) String() string {
method ProtoMessage (line 225) | func (*Pet) ProtoMessage() {}
method ProtoReflect (line 227) | func (x *Pet) ProtoReflect() protoreflect.Message {
method Descriptor (line 240) | func (*Pet) Descriptor() ([]byte, []int) {
method GetId (line 244) | func (x *Pet) GetId() string {
method GetName (line 251) | func (x *Pet) GetName() string {
method GetType (line 258) | func (x *Pet) GetType() PetType {
method GetBirthday (line 265) | func (x *Pet) GetBirthday() *date.Date {
type AddPetsReq (line 273) | type AddPetsReq struct
method Reset (line 282) | func (x *AddPetsReq) Reset() {
method String (line 291) | func (x *AddPetsReq) String() string {
method ProtoMessage (line 295) | func (*AddPetsReq) ProtoMessage() {}
method ProtoReflect (line 297) | func (x *AddPetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 310) | func (*AddPetsReq) Descriptor() ([]byte, []int) {
method GetPets (line 314) | func (x *AddPetsReq) GetPets() []*Pet {
type AddPetsResp (line 322) | type AddPetsResp struct
method Reset (line 331) | func (x *AddPetsResp) Reset() {
method String (line 340) | func (x *AddPetsResp) String() string {
method ProtoMessage (line 344) | func (*AddPetsResp) ProtoMessage() {}
method ProtoReflect (line 346) | func (x *AddPetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 359) | func (*AddPetsResp) Descriptor() ([]byte, []int) {
method GetIds (line 363) | func (x *AddPetsResp) GetIds() []string {
type UpdatePetsReq (line 371) | type UpdatePetsReq struct
method Reset (line 380) | func (x *UpdatePetsReq) Reset() {
method String (line 389) | func (x *UpdatePetsReq) String() string {
method ProtoMessage (line 393) | func (*UpdatePetsReq) ProtoMessage() {}
method ProtoReflect (line 395) | func (x *UpdatePetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 408) | func (*UpdatePetsReq) Descriptor() ([]byte, []int) {
method GetPets (line 412) | func (x *UpdatePetsReq) GetPets() []*Pet {
type UpdatePetsResp (line 420) | type UpdatePetsResp struct
method Reset (line 426) | func (x *UpdatePetsResp) Reset() {
method String (line 435) | func (x *UpdatePetsResp) String() string {
method ProtoMessage (line 439) | func (*UpdatePetsResp) ProtoMessage() {}
method ProtoReflect (line 441) | func (x *UpdatePetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 454) | func (*UpdatePetsResp) Descriptor() ([]byte, []int) {
type DeletePetsReq (line 459) | type DeletePetsReq struct
method Reset (line 468) | func (x *DeletePetsReq) Reset() {
method String (line 477) | func (x *DeletePetsReq) String() string {
method ProtoMessage (line 481) | func (*DeletePetsReq) ProtoMessage() {}
method ProtoReflect (line 483) | func (x *DeletePetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 496) | func (*DeletePetsReq) Descriptor() ([]byte, []int) {
method GetIds (line 500) | func (x *DeletePetsReq) GetIds() []string {
type DeletePetsResp (line 508) | type DeletePetsResp struct
method Reset (line 514) | func (x *DeletePetsResp) Reset() {
method String (line 523) | func (x *DeletePetsResp) String() string {
method ProtoMessage (line 527) | func (*DeletePetsResp) ProtoMessage() {}
method ProtoReflect (line 529) | func (x *DeletePetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 542) | func (*DeletePetsResp) Descriptor() ([]byte, []int) {
type SearchPetsReq (line 547) | type SearchPetsReq struct
method Reset (line 560) | func (x *SearchPetsReq) Reset() {
method String (line 569) | func (x *SearchPetsReq) String() string {
method ProtoMessage (line 573) | func (*SearchPetsReq) ProtoMessage() {}
method ProtoReflect (line 575) | func (x *SearchPetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 588) | func (*SearchPetsReq) Descriptor() ([]byte, []int) {
method GetNames (line 592) | func (x *SearchPetsReq) GetNames() []string {
method GetTypes (line 599) | func (x *SearchPetsReq) GetTypes() []PetType {
method GetBirthdateRange (line 606) | func (x *SearchPetsReq) GetBirthdateRange() *DateRange {
type Sampler (line 613) | type Sampler struct
method Reset (line 625) | func (x *Sampler) Reset() {
method String (line 634) | func (x *Sampler) String() string {
method ProtoMessage (line 638) | func (*Sampler) ProtoMessage() {}
method ProtoReflect (line 640) | func (x *Sampler) ProtoReflect() protoreflect.Message {
method Descriptor (line 653) | func (*Sampler) Descriptor() ([]byte, []int) {
method GetType (line 657) | func (x *Sampler) GetType() SamplerType {
method GetFloatValue (line 664) | func (x *Sampler) GetFloatValue() float64 {
type ChangeSamplerReq (line 672) | type ChangeSamplerReq struct
method Reset (line 680) | func (x *ChangeSamplerReq) Reset() {
method String (line 689) | func (x *ChangeSamplerReq) String() string {
method ProtoMessage (line 693) | func (*ChangeSamplerReq) ProtoMessage() {}
method ProtoReflect (line 695) | func (x *ChangeSamplerReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 708) | func (*ChangeSamplerReq) Descriptor() ([]byte, []int) {
method GetSampler (line 712) | func (x *ChangeSamplerReq) GetSampler() *Sampler {
type ChangeSamplerResp (line 720) | type ChangeSamplerResp struct
method Reset (line 726) | func (x *ChangeSamplerResp) Reset() {
method String (line 735) | func (x *ChangeSamplerResp) String() string {
method ProtoMessage (line 739) | func (*ChangeSamplerResp) ProtoMessage() {}
method ProtoReflect (line 741) | func (x *ChangeSamplerResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 754) | func (*ChangeSamplerResp) Descriptor() ([]byte, []int) {
function file_petstore_proto_rawDescGZIP (line 852) | func file_petstore_proto_rawDescGZIP() []byte {
function init (line 906) | func init() { file_petstore_proto_init() }
function file_petstore_proto_init (line 907) | func file_petstore_proto_init() {
FILE: chapter/13/petstore-provider/internal/client/proto/petstore_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type PetStoreClient (line 20) | type PetStoreClient interface
type petStoreClient (line 33) | type petStoreClient struct
method AddPets (line 41) | func (c *petStoreClient) AddPets(ctx context.Context, in *AddPetsReq, ...
method UpdatePets (line 50) | func (c *petStoreClient) UpdatePets(ctx context.Context, in *UpdatePet...
method DeletePets (line 59) | func (c *petStoreClient) DeletePets(ctx context.Context, in *DeletePet...
method SearchPets (line 68) | func (c *petStoreClient) SearchPets(ctx context.Context, in *SearchPet...
method ChangeSampler (line 100) | func (c *petStoreClient) ChangeSampler(ctx context.Context, in *Change...
function NewPetStoreClient (line 37) | func NewPetStoreClient(cc grpc.ClientConnInterface) PetStoreClient {
type PetStore_SearchPetsClient (line 83) | type PetStore_SearchPetsClient interface
type petStoreSearchPetsClient (line 88) | type petStoreSearchPetsClient struct
method Recv (line 92) | func (x *petStoreSearchPetsClient) Recv() (*Pet, error) {
type PetStoreServer (line 112) | type PetStoreServer interface
type UnimplementedPetStoreServer (line 127) | type UnimplementedPetStoreServer struct
method AddPets (line 130) | func (UnimplementedPetStoreServer) AddPets(context.Context, *AddPetsRe...
method UpdatePets (line 133) | func (UnimplementedPetStoreServer) UpdatePets(context.Context, *Update...
method DeletePets (line 136) | func (UnimplementedPetStoreServer) DeletePets(context.Context, *Delete...
method SearchPets (line 139) | func (UnimplementedPetStoreServer) SearchPets(*SearchPetsReq, PetStore...
method ChangeSampler (line 142) | func (UnimplementedPetStoreServer) ChangeSampler(context.Context, *Cha...
method mustEmbedUnimplementedPetStoreServer (line 145) | func (UnimplementedPetStoreServer) mustEmbedUnimplementedPetStoreServe...
type UnsafePetStoreServer (line 150) | type UnsafePetStoreServer interface
function RegisterPetStoreServer (line 154) | func RegisterPetStoreServer(s grpc.ServiceRegistrar, srv PetStoreServer) {
function _PetStore_AddPets_Handler (line 158) | func _PetStore_AddPets_Handler(srv interface{}, ctx context.Context, dec...
function _PetStore_UpdatePets_Handler (line 176) | func _PetStore_UpdatePets_Handler(srv interface{}, ctx context.Context, ...
function _PetStore_DeletePets_Handler (line 194) | func _PetStore_DeletePets_Handler(srv interface{}, ctx context.Context, ...
function _PetStore_SearchPets_Handler (line 212) | func _PetStore_SearchPets_Handler(srv interface{}, stream grpc.ServerStr...
type PetStore_SearchPetsServer (line 220) | type PetStore_SearchPetsServer interface
type petStoreSearchPetsServer (line 225) | type petStoreSearchPetsServer struct
method Send (line 229) | func (x *petStoreSearchPetsServer) Send(m *Pet) error {
function _PetStore_ChangeSampler_Handler (line 233) | func _PetStore_ChangeSampler_Handler(srv interface{}, ctx context.Contex...
FILE: chapter/13/petstore-provider/internal/data_source_pet.go
function dataSourcePet (line 17) | func dataSourcePet() *schema.Resource {
function clientFromMeta (line 25) | func clientFromMeta(meta interface{}) (*client.Client, error) {
function dataSourcePetRead (line 35) | func dataSourcePetRead(ctx context.Context, data *schema.ResourceData, m...
function flattenPets (line 61) | func flattenPets(pets []*client.Pet) []interface{} {
function setDataFromPet (line 70) | func setDataFromPet(pet *client.Pet, data *schema.ResourceData) diag.Dia...
function petToMap (line 83) | func petToMap(pet *client.Pet) map[string]interface{} {
function fillPetFromData (line 93) | func fillPetFromData(pet *client.Pet, data *schema.ResourceData) diag.Di...
function timeToPbDate (line 111) | func timeToPbDate(t time.Time) *date.Date {
type findPetsRequest (line 119) | type findPetsRequest struct
function findPetsInStore (line 127) | func findPetsInStore(ctx context.Context, psClient *client.Client, req f...
function petTypeToProtoPetType (line 157) | func petTypeToProtoPetType(petType PetType) pb.PetType {
function protoPetTypeToPetType (line 170) | func protoPetTypeToPetType(pbPetType pb.PetType) PetType {
FILE: chapter/13/petstore-provider/internal/provider.go
function Provider (line 13) | func Provider() *schema.Provider {
function configure (line 33) | func configure(_ context.Context, data *schema.ResourceData) (interface{...
FILE: chapter/13/petstore-provider/internal/resource_pets.go
function resourcePet (line 13) | func resourcePet() *schema.Resource {
function resourcePetCreate (line 27) | func resourcePetCreate(ctx context.Context, data *schema.ResourceData, m...
function resourcePetRead (line 45) | func resourcePetRead(ctx context.Context, data *schema.ResourceData, met...
function resourcePetUpdate (line 64) | func resourcePetUpdate(ctx context.Context, data *schema.ResourceData, m...
function resourcePetDelete (line 99) | func resourcePetDelete(ctx context.Context, data *schema.ResourceData, m...
FILE: chapter/13/petstore-provider/internal/schema.go
type PetType (line 12) | type PetType
constant DogPetType (line 15) | DogPetType PetType = "dog"
constant CatPetType (line 16) | CatPetType PetType = "cat"
constant BirdPetType (line 17) | BirdPetType PetType = "bird"
constant ReptilePetType (line 18) | ReptilePetType PetType = "reptile"
function getPetDataSchema (line 21) | func getPetDataSchema() map[string]*schema.Schema {
function getPetResourceSchema (line 69) | func getPetResourceSchema() map[string]*schema.Schema {
function validateName (line 94) | func validateName() schema.SchemaValidateDiagFunc {
function validateType (line 98) | func validateType() schema.SchemaValidateDiagFunc {
function validateBirthday (line 107) | func validateBirthday() schema.SchemaValidateDiagFunc {
function validateDiagFunc (line 111) | func validateDiagFunc(validateFunc func(interface{}, string) ([]string, ...
FILE: chapter/13/petstore-provider/main.go
function main (line 10) | func main() {
FILE: chapter/14/petstore-operator/api/v1alpha1/pet_types.go
type PetType (line 25) | type PetType
constant DogPetType (line 28) | DogPetType PetType = "dog"
constant CatPetType (line 29) | CatPetType PetType = "cat"
constant BirdPetType (line 30) | BirdPetType PetType = "bird"
constant ReptilePetType (line 31) | ReptilePetType PetType = "reptile"
type PetSpec (line 35) | type PetSpec struct
type PetStatus (line 45) | type PetStatus struct
type Pet (line 54) | type Pet struct
type PetList (line 65) | type PetList struct
function init (line 71) | func init() {
FILE: chapter/14/petstore-operator/api/v1alpha1/zz_generated.deepcopy.go
method DeepCopyInto (line 29) | func (in *Pet) DeepCopyInto(out *Pet) {
method DeepCopy (line 38) | func (in *Pet) DeepCopy() *Pet {
method DeepCopyObject (line 48) | func (in *Pet) DeepCopyObject() runtime.Object {
method DeepCopyInto (line 56) | func (in *PetList) DeepCopyInto(out *PetList) {
method DeepCopy (line 70) | func (in *PetList) DeepCopy() *PetList {
method DeepCopyObject (line 80) | func (in *PetList) DeepCopyObject() runtime.Object {
method DeepCopyInto (line 88) | func (in *PetSpec) DeepCopyInto(out *PetSpec) {
method DeepCopy (line 94) | func (in *PetSpec) DeepCopy() *PetSpec {
method DeepCopyInto (line 104) | func (in *PetStatus) DeepCopyInto(out *PetStatus) {
method DeepCopy (line 109) | func (in *PetStatus) DeepCopy() *PetStatus {
FILE: chapter/14/petstore-operator/client/client.go
type Client (line 19) | type Client struct
method AddPets (line 83) | func (c *Client) AddPets(ctx context.Context, pets []*pb.Pet, options ...
method UpdatePets (line 106) | func (c *Client) UpdatePets(ctx context.Context, pets []*pb.Pet, optio...
method DeletePets (line 130) | func (c *Client) DeletePets(ctx context.Context, ids []string, options...
method SearchPets (line 148) | func (c *Client) SearchPets(ctx context.Context, filter *pb.SearchPets...
method ChangeSampler (line 229) | func (c *Client) ChangeSampler(ctx context.Context, sc Sampler, option...
function New (line 25) | func New(addr string) (*Client, error) {
type Pet (line 39) | type Pet struct
method Proto (line 45) | func (p Pet) Proto() *pb.Pet {
method Birthday (line 50) | func (p Pet) Birthday() time.Time {
method Error (line 58) | func (p Pet) Error() error {
type CallOption (line 63) | type CallOption
type callOptions (line 65) | type callOptions struct
function TraceID (line 72) | func TraceID(s *string) CallOption {
type SamplerType (line 181) | type SamplerType
constant STUnknown (line 184) | STUnknown SamplerType = 0
constant Never (line 185) | Never SamplerType = 1
constant Always (line 186) | Always SamplerType = 2
constant Float (line 187) | Float SamplerType = 3
type Sampler (line 196) | type Sampler struct
method validate (line 203) | func (s *Sampler) validate() error {
method proto (line 215) | func (s *Sampler) proto() *pb.Sampler {
method fromProto (line 222) | func (s *Sampler) fromProto(p *pb.Sampler) {
function handleCallOptions (line 245) | func handleCallOptions(ctx context.Context, header *metadata.MD, options...
FILE: chapter/14/petstore-operator/client/internal/server/errors/errors.go
function New (line 16) | func New(ctx context.Context, text string) error {
function Errorf (line 28) | func Errorf(ctx context.Context, s string, i ...interface{}) error {
function As (line 39) | func As(err error, target interface{}) bool {
function Is (line 44) | func Is(err, target error) bool {
function Unwrap (line 49) | func Unwrap(err error) error {
FILE: chapter/14/petstore-operator/client/internal/server/log/log.go
constant Ldate (line 55) | Ldate = 1 << iota
constant Ltime (line 56) | Ltime
constant Lmicroseconds (line 57) | Lmicroseconds
constant Llongfile (line 58) | Llongfile
constant Lshortfile (line 59) | Lshortfile
constant LUTC (line 60) | LUTC
constant LstdFlags (line 61) | LstdFlags = Ldate | Ltime
type eventPool (line 84) | type eventPool struct
method get (line 89) | func (e *eventPool) get() *Event {
method put (line 98) | func (e *eventPool) put(ev *Event) {
type Event (line 112) | type Event struct
method reset (line 124) | func (e *Event) reset() {
method Add (line 131) | func (e *Event) Add(k string, i interface{}) {
method Done (line 163) | func (e *Event) Done(ctx context.Context) {
function NewEvent (line 118) | func NewEvent(name string) *Event {
function Println (line 177) | func Println(ctx context.Context, v ...interface{}) {
function Printf (line 186) | func Printf(ctx context.Context, format string, v ...interface{}) {
function SetFlags (line 195) | func SetFlags(flag int) {
type logger (line 200) | type logger struct
method output (line 223) | func (l *logger) output(span trace.Span, calldepth int, s string) error {
method formatHeader (line 254) | func (l *logger) formatHeader(buf *[]byte, t time.Time, file string, l...
function itoa (line 207) | func itoa(buf *[]byte, i int, wid int) {
FILE: chapter/14/petstore-operator/client/internal/server/storage/mem/mem.go
type birthdays (line 23) | type birthdays
method Compare (line 26) | func (bi birthdays) Compare(b llrb.Comparable) int {
type birthdayGet (line 51) | type birthdayGet struct
method Compare (line 56) | func (bi birthdayGet) Compare(b llrb.Comparable) int {
type Data (line 82) | type Data struct
method AddPets (line 111) | func (d *Data) AddPets(ctx context.Context, pets []*pb.Pet) error {
method UpdatePets (line 136) | func (d *Data) UpdatePets(ctx context.Context, pets []*pb.Pet) error {
method populate (line 153) | func (d *Data) populate(ctx context.Context, pets []*pb.Pet) {
method DeletePets (line 183) | func (d *Data) DeletePets(ctx context.Context, ids []string) error {
method SearchPets (line 227) | func (d *Data) SearchPets(ctx context.Context, filter *pb.SearchPetsRe...
method searchPets (line 238) | func (d *Data) searchPets(ctx context.Context, filter *pb.SearchPetsRe...
method returnAll (line 333) | func (d *Data) returnAll(ctx context.Context, out chan storage.SearchI...
method byNames (line 355) | func (d *Data) byNames(ctx context.Context, filter *pb.SearchPetsReq) ...
method byTypes (line 387) | func (d *Data) byTypes(ctx context.Context, filter *pb.SearchPetsReq) ...
method byBirthdays (line 418) | func (d *Data) byBirthdays(ctx context.Context, filter *pb.SearchPetsR...
function New (line 95) | func New() *Data {
FILE: chapter/14/petstore-operator/client/internal/server/storage/mem/mem_test.go
function makePets (line 61) | func makePets() *Data {
function TestByNames (line 73) | func TestByNames(t *testing.T) {
function TestByTypes (line 85) | func TestByTypes(t *testing.T) {
function TestByBirthdays (line 97) | func TestByBirthdays(t *testing.T) {
function TestDeletePets (line 117) | func TestDeletePets(t *testing.T) {
function TestSearchPets (line 154) | func TestSearchPets(t *testing.T) {
FILE: chapter/14/petstore-operator/client/internal/server/storage/storage.go
type Data (line 15) | type Data interface
type SearchItem (line 29) | type SearchItem struct
function ValidatePet (line 38) | func ValidatePet(ctx context.Context, p *pb.Pet, forUpdate bool) error {
function BirthdayToTime (line 64) | func BirthdayToTime(ctx context.Context, d *dpb.Date) (time.Time, error) {
FILE: chapter/14/petstore-operator/client/internal/server/telemetry/metrics/metrics.go
type metricType (line 51) | type metricType
constant unknown (line 54) | unknown = 0
constant mtInt64 (line 55) | mtInt64 = 1
constant mtInt64Hist (line 56) | mtInt64Hist = 2
constant mtInt64UD (line 57) | mtInt64UD = 3
type metricDef (line 60) | type metricDef struct
type Lookups (line 110) | type Lookups struct
method Int64 (line 167) | func (l *Lookups) Int64(s string) metric.Int64Counter {
method Int64s (line 180) | func (l *Lookups) Int64s(s ...string) []metric.Int64Counter {
method Int64UD (line 189) | func (l *Lookups) Int64UD(s string) metric.Int64UpDownCounter {
method Int64UDs (line 202) | func (l *Lookups) Int64UDs(s ...string) []metric.Int64UpDownCounter {
method Int64Hist (line 211) | func (l *Lookups) Int64Hist(s string) metric.Int64Histogram {
method Int64Hists (line 223) | func (l *Lookups) Int64Hists(s ...string) []metric.Int64Histogram {
method unused (line 231) | func (l *Lookups) unused() []string {
function newLookups (line 119) | func newLookups() *Lookups {
FILE: chapter/14/petstore-operator/client/internal/server/telemetry/metrics/start.go
type Controller (line 18) | type Controller interface
type OTELGRPC (line 23) | type OTELGRPC struct
method isController (line 28) | func (o OTELGRPC) isController() {}
type Stop (line 31) | type Stop
function Start (line 34) | func Start(ctx context.Context, c Controller) (Stop, error) {
function newController (line 53) | func newController(ctx context.Context, c Controller) (*basic.Controller...
function otelGRPC (line 61) | func otelGRPC(ctx context.Context, args OTELGRPC) (*basic.Controller, er...
FILE: chapter/14/petstore-operator/client/internal/server/telemetry/tracing/sampler/sampler.go
constant desc (line 33) | desc = `This sampler samples if TracdID.Valid(), gRPC metadata contains ...
type Sampler (line 37) | type Sampler struct
method ShouldSample (line 57) | func (s *Sampler) ShouldSample(p trace.SamplingParameters) trace.Sampl...
method Description (line 92) | func (s *Sampler) Description() string {
method Switch (line 97) | func (s *Sampler) Switch(sampler trace.Sampler) {
function New (line 46) | func New(child trace.Sampler) (*Sampler, error) {
FILE: chapter/14/petstore-operator/client/internal/server/telemetry/tracing/tracing.go
function init (line 52) | func init() {
type Exporter (line 61) | type Exporter interface
type OTELGRPC (line 66) | type OTELGRPC struct
method isExporter (line 71) | func (o OTELGRPC) isExporter() {}
type Stderr (line 74) | type Stderr struct
method isExporter (line 76) | func (s Stderr) isExporter() {}
type File (line 79) | type File struct
method isExporter (line 84) | func (f File) isExporter() {}
type Stop (line 87) | type Stop
function Start (line 91) | func Start(ctx context.Context, e Exporter) (Stop, error) {
function newTraceExporter (line 111) | func newTraceExporter(ctx context.Context, e Exporter) (*sdktrace.Tracer...
function newFileExporter (line 157) | func newFileExporter(w io.Writer) (sdktrace.SpanExporter, error) {
function otelGRPC (line 164) | func otelGRPC(ctx context.Context, e OTELGRPC) (sdktrace.SpanExporter, e...
FILE: chapter/14/petstore-operator/client/proto/petstore.pb.go
constant _ (line 19) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 21) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type PetType (line 25) | type PetType
method Enum (line 58) | func (x PetType) Enum() *PetType {
method String (line 64) | func (x PetType) String() string {
method Descriptor (line 68) | func (PetType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 72) | func (PetType) Type() protoreflect.EnumType {
method Number (line 76) | func (x PetType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 81) | func (PetType) EnumDescriptor() ([]byte, []int) {
constant PetType_PTUnknown (line 29) | PetType_PTUnknown PetType = 0
constant PetType_PTCanine (line 31) | PetType_PTCanine PetType = 1
constant PetType_PTFeline (line 33) | PetType_PTFeline PetType = 2
constant PetType_PTBird (line 35) | PetType_PTBird PetType = 3
constant PetType_PTReptile (line 37) | PetType_PTReptile PetType = 4
type SamplerType (line 86) | type SamplerType
method Enum (line 111) | func (x SamplerType) Enum() *SamplerType {
method String (line 117) | func (x SamplerType) String() string {
method Descriptor (line 121) | func (SamplerType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 125) | func (SamplerType) Type() protoreflect.EnumType {
method Number (line 129) | func (x SamplerType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 134) | func (SamplerType) EnumDescriptor() ([]byte, []int) {
constant SamplerType_STUnknown (line 89) | SamplerType_STUnknown SamplerType = 0
constant SamplerType_STNever (line 90) | SamplerType_STNever SamplerType = 1
constant SamplerType_STAlways (line 91) | SamplerType_STAlways SamplerType = 2
constant SamplerType_STFloat (line 92) | SamplerType_STFloat SamplerType = 3
type DateRange (line 139) | type DateRange struct
method Reset (line 150) | func (x *DateRange) Reset() {
method String (line 159) | func (x *DateRange) String() string {
method ProtoMessage (line 163) | func (*DateRange) ProtoMessage() {}
method ProtoReflect (line 165) | func (x *DateRange) ProtoReflect() protoreflect.Message {
method Descriptor (line 178) | func (*DateRange) Descriptor() ([]byte, []int) {
method GetStart (line 182) | func (x *DateRange) GetStart() *date.Date {
method GetEnd (line 189) | func (x *DateRange) GetEnd() *date.Date {
type Pet (line 197) | type Pet struct
method Reset (line 212) | func (x *Pet) Reset() {
method String (line 221) | func (x *Pet) String() string {
method ProtoMessage (line 225) | func (*Pet) ProtoMessage() {}
method ProtoReflect (line 227) | func (x *Pet) ProtoReflect() protoreflect.Message {
method Descriptor (line 240) | func (*Pet) Descriptor() ([]byte, []int) {
method GetId (line 244) | func (x *Pet) GetId() string {
method GetName (line 251) | func (x *Pet) GetName() string {
method GetType (line 258) | func (x *Pet) GetType() PetType {
method GetBirthday (line 265) | func (x *Pet) GetBirthday() *date.Date {
type AddPetsReq (line 273) | type AddPetsReq struct
method Reset (line 282) | func (x *AddPetsReq) Reset() {
method String (line 291) | func (x *AddPetsReq) String() string {
method ProtoMessage (line 295) | func (*AddPetsReq) ProtoMessage() {}
method ProtoReflect (line 297) | func (x *AddPetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 310) | func (*AddPetsReq) Descriptor() ([]byte, []int) {
method GetPets (line 314) | func (x *AddPetsReq) GetPets() []*Pet {
type AddPetsResp (line 322) | type AddPetsResp struct
method Reset (line 331) | func (x *AddPetsResp) Reset() {
method String (line 340) | func (x *AddPetsResp) String() string {
method ProtoMessage (line 344) | func (*AddPetsResp) ProtoMessage() {}
method ProtoReflect (line 346) | func (x *AddPetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 359) | func (*AddPetsResp) Descriptor() ([]byte, []int) {
method GetIds (line 363) | func (x *AddPetsResp) GetIds() []string {
type UpdatePetsReq (line 371) | type UpdatePetsReq struct
method Reset (line 380) | func (x *UpdatePetsReq) Reset() {
method String (line 389) | func (x *UpdatePetsReq) String() string {
method ProtoMessage (line 393) | func (*UpdatePetsReq) ProtoMessage() {}
method ProtoReflect (line 395) | func (x *UpdatePetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 408) | func (*UpdatePetsReq) Descriptor() ([]byte, []int) {
method GetPets (line 412) | func (x *UpdatePetsReq) GetPets() []*Pet {
type UpdatePetsResp (line 420) | type UpdatePetsResp struct
method Reset (line 426) | func (x *UpdatePetsResp) Reset() {
method String (line 435) | func (x *UpdatePetsResp) String() string {
method ProtoMessage (line 439) | func (*UpdatePetsResp) ProtoMessage() {}
method ProtoReflect (line 441) | func (x *UpdatePetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 454) | func (*UpdatePetsResp) Descriptor() ([]byte, []int) {
type DeletePetsReq (line 459) | type DeletePetsReq struct
method Reset (line 468) | func (x *DeletePetsReq) Reset() {
method String (line 477) | func (x *DeletePetsReq) String() string {
method ProtoMessage (line 481) | func (*DeletePetsReq) ProtoMessage() {}
method ProtoReflect (line 483) | func (x *DeletePetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 496) | func (*DeletePetsReq) Descriptor() ([]byte, []int) {
method GetIds (line 500) | func (x *DeletePetsReq) GetIds() []string {
type DeletePetsResp (line 508) | type DeletePetsResp struct
method Reset (line 514) | func (x *DeletePetsResp) Reset() {
method String (line 523) | func (x *DeletePetsResp) String() string {
method ProtoMessage (line 527) | func (*DeletePetsResp) ProtoMessage() {}
method ProtoReflect (line 529) | func (x *DeletePetsResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 542) | func (*DeletePetsResp) Descriptor() ([]byte, []int) {
type SearchPetsReq (line 547) | type SearchPetsReq struct
method Reset (line 560) | func (x *SearchPetsReq) Reset() {
method String (line 569) | func (x *SearchPetsReq) String() string {
method ProtoMessage (line 573) | func (*SearchPetsReq) ProtoMessage() {}
method ProtoReflect (line 575) | func (x *SearchPetsReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 588) | func (*SearchPetsReq) Descriptor() ([]byte, []int) {
method GetNames (line 592) | func (x *SearchPetsReq) GetNames() []string {
method GetTypes (line 599) | func (x *SearchPetsReq) GetTypes() []PetType {
method GetBirthdateRange (line 606) | func (x *SearchPetsReq) GetBirthdateRange() *DateRange {
type Sampler (line 613) | type Sampler struct
method Reset (line 625) | func (x *Sampler) Reset() {
method String (line 634) | func (x *Sampler) String() string {
method ProtoMessage (line 638) | func (*Sampler) ProtoMessage() {}
method ProtoReflect (line 640) | func (x *Sampler) ProtoReflect() protoreflect.Message {
method Descriptor (line 653) | func (*Sampler) Descriptor() ([]byte, []int) {
method GetType (line 657) | func (x *Sampler) GetType() SamplerType {
method GetFloatValue (line 664) | func (x *Sampler) GetFloatValue() float64 {
type ChangeSamplerReq (line 672) | type ChangeSamplerReq struct
method Reset (line 680) | func (x *ChangeSamplerReq) Reset() {
method String (line 689) | func (x *ChangeSamplerReq) String() string {
method ProtoMessage (line 693) | func (*ChangeSamplerReq) ProtoMessage() {}
method ProtoReflect (line 695) | func (x *ChangeSamplerReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 708) | func (*ChangeSamplerReq) Descriptor() ([]byte, []int) {
method GetSampler (line 712) | func (x *ChangeSamplerReq) GetSampler() *Sampler {
type ChangeSamplerResp (line 720) | type ChangeSamplerResp struct
method Reset (line 726) | func (x *ChangeSamplerResp) Reset() {
method String (line 735) | func (x *ChangeSamplerResp) String() string {
method ProtoMessage (line 739) | func (*ChangeSamplerResp) ProtoMessage() {}
method ProtoReflect (line 741) | func (x *ChangeSamplerResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 754) | func (*ChangeSamplerResp) Descriptor() ([]byte, []int) {
function file_petstore_proto_rawDescGZIP (line 852) | func file_petstore_proto_rawDescGZIP() []byte {
function init (line 906) | func init() { file_petstore_proto_init() }
function file_petstore_proto_init (line 907) | func file_petstore_proto_init() {
FILE: chapter/14/petstore-operator/client/proto/petstore_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type PetStoreClient (line 20) | type PetStoreClient interface
type petStoreClient (line 33) | type petStoreClient struct
method AddPets (line 41) | func (c *petStoreClient) AddPets(ctx context.Context, in *AddPetsReq, ...
method UpdatePets (line 50) | func (c *petStoreClient) UpdatePets(ctx context.Context, in *UpdatePet...
method DeletePets (line 59) | func (c *petStoreClient) DeletePets(ctx context.Context, in *DeletePet...
method SearchPets (line 68) | func (c *petStoreClient) SearchPets(ctx context.Context, in *SearchPet...
method ChangeSampler (line 100) | func (c *petStoreClient) ChangeSampler(ctx context.Context, in *Change...
function NewPetStoreClient (line 37) | func NewPetStoreClient(cc grpc.ClientConnInterface) PetStoreClient {
type PetStore_SearchPetsClient (line 83) | type PetStore_SearchPetsClient interface
type petStoreSearchPetsClient (line 88) | type petStoreSearchPetsClient struct
method Recv (line 92) | func (x *petStoreSearchPetsClient) Recv() (*Pet, error) {
type PetStoreServer (line 112) | type PetStoreServer interface
type UnimplementedPetStoreServer (line 127) | type UnimplementedPetStoreServer struct
method AddPets (line 130) | func (UnimplementedPetStoreServer) AddPets(context.Context, *AddPetsRe...
method UpdatePets (line 133) | func (UnimplementedPetStoreServer) UpdatePets(context.Context, *Update...
method DeletePets (line 136) | func (UnimplementedPetStoreServer) DeletePets(context.Context, *Delete...
method SearchPets (line 139) | func (UnimplementedPetStoreServer) SearchPets(*SearchPetsReq, PetStore...
method ChangeSampler (line 142) | func (UnimplementedPetStoreServer) ChangeSampler(context.Context, *Cha...
method mustEmbedUnimplementedPetStoreServer (line 145) | func (UnimplementedPetStoreServer) mustEmbedUnimplementedPetStoreServe...
type UnsafePetStoreServer (line 150) | type UnsafePetStoreServer interface
function RegisterPetStoreServer (line 154) | func RegisterPetStoreServer(s grpc.ServiceRegistrar, srv PetStoreServer) {
function _PetStore_AddPets_Handler (line 158) | func _PetStore_AddPets_Handler(srv interface{}, ctx context.Context, dec...
function _PetStore_UpdatePets_Handler (line 176) | func _PetStore_UpdatePets_Handler(srv interface{}, ctx context.Context, ...
function _PetStore_DeletePets_Handler (line 194) | func _PetStore_DeletePets_Handler(srv interface{}, ctx context.Context, ...
function _PetStore_SearchPets_Handler (line 212) | func _PetStore_SearchPets_Handler(srv interface{}, stream grpc.ServerStr...
type PetStore_SearchPetsServer (line 220) | type PetStore_SearchPetsServer interface
type petStoreSearchPetsServer (line 225) | type petStoreSearchPetsServer struct
method Send (line 229) | func (x *petStoreSearchPetsServer) Send(m *Pet) error {
function _PetStore_ChangeSampler_Handler (line 233) | func _PetStore_ChangeSampler_Handler(srv interface{}, ctx context.Contex...
FILE: chapter/14/petstore-operator/controllers/pet_controller.go
constant PetFinalizer (line 40) | PetFinalizer = "pet.petstore.example.com"
type PetReconciler (line 44) | type PetReconciler struct
method Reconcile (line 54) | func (r *PetReconciler) Reconcile(ctx context.Context, req ctrl.Reques...
method ReconcileNormal (line 90) | func (r *PetReconciler) ReconcileNormal(ctx context.Context, pet *pets...
method ReconcileDelete (line 125) | func (r *PetReconciler) ReconcileDelete(ctx context.Context, pet *pets...
method SetupWithManager (line 168) | func (r *PetReconciler) SetupWithManager(mgr ctrl.Manager) error {
function createPetInStore (line 142) | func createPetInStore(ctx context.Context, pet *petstorev1.Pet, psc *psc...
function updatePetInStore (line 157) | func updatePetInStore(ctx context.Context, psc *psclient.Client, pet *pe...
function findPetInStore (line 175) | func findPetInStore(ctx context.Context, psc *psclient.Client, pet *pets...
function petTypeToProtoPetType (line 200) | func petTypeToProtoPetType(petType petstorev1.PetType) pb.PetType {
function timeToPbDate (line 213) | func timeToPbDate(t metav1.Time) *date.Date {
function getPetstoreClient (line 221) | func getPetstoreClient() (*psclient.Client, error) {
FILE: chapter/14/petstore-operator/controllers/suite_test.go
function TestAPIs (line 44) | func TestAPIs(t *testing.T) {
FILE: chapter/14/petstore-operator/main.go
function init (line 44) | func init() {
function main (line 51) | func main() {
FILE: chapter/14/workloads/main.go
function main (line 24) | func main() {
function createNamespace (line 47) | func createNamespace(ctx context.Context, clientSet *kubernetes.Clientse...
function deleteNamespace (line 59) | func deleteNamespace(ctx context.Context, clientSet *kubernetes.Clientse...
function deployNginx (line 64) | func deployNginx(ctx context.Context, clientSet *kubernetes.Clientset, n...
function createNginxDeployment (line 71) | func createNginxDeployment(ctx context.Context, clientSet *kubernetes.Cl...
function waitForReadyReplicas (line 111) | func waitForReadyReplicas(ctx context.Context, clientSet *kubernetes.Cli...
function getReadyReplicasForDeployment (line 126) | func getReadyReplicasForDeployment(ctx context.Context, clientSet *kuber...
function createNginxService (line 133) | func createNginxService(ctx context.Context, clientSet *kubernetes.Clien...
function createNginxIngress (line 160) | func createNginxIngress(ctx context.Context, clientSet *kubernetes.Clien...
function listenToPodLogs (line 199) | func listenToPodLogs(ctx context.Context, clientSet *kubernetes.Clientse...
function listPods (line 218) | func listPods(ctx context.Context, clientSet *kubernetes.Clientset, ns *...
function waitForExitSignal (line 230) | func waitForExitSignal() {
function getClientSet (line 237) | func getClientSet() *kubernetes.Clientset {
function panicIfError (line 256) | func panicIfError(err error) {
FILE: chapter/15/cmd/compute/main.go
function init (line 16) | func init() {
function main (line 20) | func main() {
FILE: chapter/15/cmd/storage/main.go
function init (line 19) | func init() {
function main (line 23) | func main() {
function uploadBlobs (line 38) | func uploadBlobs(stack *mgmt.StorageStack) {
function printSASUris (line 58) | func printSASUris(stack *mgmt.StorageStack) {
FILE: chapter/15/pkg/helpers/helpers.go
constant DefaultPollingFreq (line 16) | DefaultPollingFreq = 10 * time.Second
type ClientBuilderFunc (line 19) | type ClientBuilderFunc
function MustGetenv (line 21) | func MustGetenv(key string) string {
function BuildClient (line 29) | func BuildClient[T any](subID string, cred *azidentity.DefaultAzureCrede...
function HandleErrPoller (line 33) | func HandleErrPoller[T any](ctx context.Context, poller *armruntime.Poll...
function HandleErrWithResult (line 39) | func HandleErrWithResult[T any](result T, err error) T {
function HandleErr (line 44) | func HandleErr(err error) {
FILE: chapter/15/pkg/mgmt/compute.go
type VirtualMachineFactory (line 27) | type VirtualMachineFactory struct
method CreateVirtualMachineStack (line 70) | func (vmf *VirtualMachineFactory) CreateVirtualMachineStack(ctx contex...
method DestroyVirtualMachineStack (line 88) | func (vmf *VirtualMachineFactory) DestroyVirtualMachineStack(ctx conte...
method createResourceGroup (line 94) | func (vmf *VirtualMachineFactory) createResourceGroup(ctx context.Cont...
method createVirtualNetwork (line 106) | func (vmf *VirtualMachineFactory) createVirtualNetwork(ctx context.Con...
method createSecurityGroup (line 134) | func (vmf *VirtualMachineFactory) createSecurityGroup(ctx context.Cont...
method createVirtualMachine (line 166) | func (vmf *VirtualMachineFactory) createVirtualMachine(ctx context.Con...
method getFirstNetworkInterface (line 177) | func (vmf *VirtualMachineFactory) getFirstNetworkInterface(ctx context...
method getPublicIPAddress (line 186) | func (vmf *VirtualMachineFactory) getPublicIPAddress(ctx context.Conte...
function NewVirtualMachineFactory (line 41) | func NewVirtualMachineFactory(subscriptionID, sshPubKeyPath string) *Vir...
type VirtualMachineStack (line 57) | type VirtualMachineStack struct
function linuxVM (line 194) | func linuxVM(vmStack *VirtualMachineStack) armcompute.VirtualMachine {
function networkProfile (line 217) | func networkProfile(vmStack *VirtualMachineStack) *armcompute.NetworkPro...
function linuxOSProfile (line 251) | func linuxOSProfile(vmStack *VirtualMachineStack) *armcompute.OSProfile {
FILE: chapter/15/pkg/mgmt/storage.go
type StorageStack (line 18) | type StorageStack struct
method ServiceClient (line 98) | func (ss *StorageStack) ServiceClient() *azblob.ServiceClient {
type StorageFactory (line 27) | type StorageFactory struct
method CreateStorageStack (line 45) | func (sf *StorageFactory) CreateStorageStack(ctx context.Context, loca...
method DestroyStorageStack (line 55) | func (sf *StorageFactory) DestroyStorageStack(ctx context.Context, sta...
method createResourceGroup (line 61) | func (sf *StorageFactory) createResourceGroup(ctx context.Context, nam...
method createStorageAccount (line 73) | func (sf *StorageFactory) createStorageAccount(ctx context.Context, na...
method getPrimaryAccountKey (line 91) | func (sf *StorageFactory) getPrimaryAccountKey(ctx context.Context, st...
function NewStorageFactory (line 35) | func NewStorageFactory(subscriptionID string) *StorageFactory {
FILE: chapter/16/workflow/client/client.go
type Workflow (line 35) | type Workflow struct
method Submit (line 80) | func (w *Workflow) Submit(ctx context.Context, req *pb.WorkReq) (strin...
method Exec (line 94) | func (w *Workflow) Exec(ctx context.Context, id string) error {
method Status (line 108) | func (w *Workflow) Status(ctx context.Context, id string) (*pb.StatusR...
method call (line 127) | func (w *Workflow) call(ctx context.Context, req proto.Message, call g...
function New (line 44) | func New(addr string) (*Workflow, error) {
function isFatal (line 191) | func isFatal(err error) bool {
FILE: chapter/16/workflow/data/generators/mk/mk.go
type site (line 8) | type site struct
type machine (line 14) | type machine struct
function main (line 19) | func main() {
FILE: chapter/16/workflow/data/packages/sites/sites.go
function Init (line 28) | func Init(loc string) {
type Site (line 37) | type Site struct
method Validate (line 49) | func (s Site) Validate() error {
type Machine (line 67) | type Machine struct
method FullName (line 75) | func (m Machine) FullName() string {
method Validate (line 80) | func (m Machine) Validate() error {
type SiteData (line 91) | type SiteData struct
function newSiteData (line 99) | func newSiteData(dir string) (SiteData, error) {
FILE: chapter/16/workflow/internal/es/es.go
function init (line 34) | func init() {
type Status (line 43) | type Status
constant Unknown (line 47) | Unknown Status = ""
constant Go (line 49) | Go Status = "go"
constant Stop (line 52) | Stop Status = "stop"
type Info (line 56) | type Info struct
method validate (line 63) | func (i Info) validate() error {
type Reader (line 78) | type Reader struct
method Subscribe (line 106) | func (r *Reader) Subscribe(name string) (chan Status, Cancel) {
method Status (line 144) | func (r *Reader) Status(name string) Status {
method loop (line 156) | func (r *Reader) loop() {
method sendStop (line 185) | func (r *Reader) sendStop(name string) {
method load (line 212) | func (r *Reader) load() (map[string]Info, error) {
function newReader (line 85) | func newReader() (*Reader, error) {
type Cancel (line 99) | type Cancel
FILE: chapter/16/workflow/internal/policy/config/config.go
function Init (line 44) | func Init() {
type Config (line 53) | type Config struct
method validate (line 68) | func (c Config) validate() error {
function newConfig (line 62) | func newConfig() Config {
type Workflow (line 79) | type Workflow struct
method validate (line 86) | func (w Workflow) validate() error {
type Policy (line 102) | type Policy struct
method validate (line 112) | func (p *Policy) validate() error {
type Reader (line 155) | type Reader struct
method Read (line 163) | func (r *Reader) Read() (Config, error) {
method update (line 168) | func (r *Reader) update() {
method load (line 178) | func (r *Reader) load() error {
function newReader (line 212) | func newReader(loc string) (*Reader, error) {
FILE: chapter/16/workflow/internal/policy/policy.go
type registration (line 22) | type registration struct
type Settings (line 29) | type Settings interface
function Register (line 36) | func Register(name string, p Policy, s Settings) {
function GetSettings (line 59) | func GetSettings(name string) (Settings, error) {
type Policy (line 68) | type Policy interface
type PolicyArgs (line 75) | type PolicyArgs struct
function Run (line 83) | func Run(ctx context.Context, req *pb.WorkReq, args ...PolicyArgs) error {
FILE: chapter/16/workflow/internal/policy/register/restrictjobtypes/restrictjobtypes.go
function init (line 17) | func init() {
type Settings (line 26) | type Settings struct
method Validate (line 31) | func (s Settings) Validate() error {
method allowed (line 41) | func (s Settings) allowed(name string) bool {
type Policy (line 51) | type Policy struct
method Run (line 59) | func (p Policy) Run(ctx context.Context, req *pb.WorkReq, settings pol...
function New (line 54) | func New() (Policy, error) {
FILE: chapter/16/workflow/internal/policy/register/sameargs/sameargs.go
function init (line 19) | func init() {
type ArgKeys (line 28) | type ArgKeys
type Settings (line 31) | type Settings struct
method Validate (line 38) | func (s Settings) Validate() error {
method checkJob (line 48) | func (s Settings) checkJob(name string) bool {
method needKey (line 55) | func (s Settings) needKey(name string, k string) bool {
type sameCheck (line 70) | type sameCheck
method isSame (line 74) | func (s sameCheck) isSame(name, k, v string) bool {
type Policy (line 93) | type Policy struct
method Run (line 101) | func (p Policy) Run(ctx context.Context, req *pb.WorkReq, settings pol...
method argSame (line 125) | func (p Policy) argSame(settings Settings, job *pb.Job, same sameCheck...
function New (line 96) | func New() (Policy, error) {
FILE: chapter/16/workflow/internal/policy/register/startorend/startOrEnd.go
function init (line 19) | func init() {
type Settings (line 28) | type Settings struct
method Validate (line 44) | func (s Settings) Validate() error {
method compile (line 64) | func (s Settings) compile() Settings {
type Policy (line 73) | type Policy struct
method Run (line 82) | func (p Policy) Run(ctx context.Context, req *pb.WorkReq, settings pol...
method eachWorkReq (line 91) | func (p Policy) eachWorkReq(ctx context.Context, req *pb.WorkReq, s Se...
method startOfBlock (line 108) | func (p Policy) startOfBlock(ctx context.Context, block []*pb.Job, s S...
method endOfBlock (line 121) | func (p Policy) endOfBlock(ctx context.Context, block []*pb.Job, s Set...
method mustHave (line 135) | func (p Policy) mustHave(ctx context.Context, job *pb.Job, s Settings)...
function New (line 77) | func New() (Policy, error) {
FILE: chapter/16/workflow/internal/service/executor/executor.go
type Work (line 37) | type Work struct
method Run (line 55) | func (w *Work) Run(ctx context.Context) chan *pb.StatusResp {
method setWorkStatus (line 115) | func (w *Work) setWorkStatus(status pb.Status, esStopped bool) {
method setBlockStatus (line 123) | func (w *Work) setBlockStatus(block *pb.BlockStatus, status pb.Status) {
method setJobStatus (line 130) | func (w *Work) setJobStatus(job *pb.JobStatus, status pb.Status, err s...
method sendStatus (line 140) | func (w *Work) sendStatus(status *pb.StatusResp) {
method runJobs (line 157) | func (w *Work) runJobs(ctx context.Context, block *pb.Block, blockStat...
function New (line 46) | func New(req *pb.WorkReq, status *pb.StatusResp) *Work {
function Validate (line 225) | func Validate(ctx context.Context, req *pb.WorkReq) error {
FILE: chapter/16/workflow/internal/service/jobs/jobs.go
function Register (line 29) | func Register(name string, job Job) {
function GetJob (line 42) | func GetJob(name string) (Job, error) {
type FatalErr (line 51) | type FatalErr struct
method Is (line 66) | func (f FatalErr) Is(target error) bool {
method Error (line 75) | func (f FatalErr) Error() string {
method Unwrap (line 83) | func (f FatalErr) Unwrap() error {
function Fatalf (line 56) | func Fatalf(msg string, a ...interface{}) FatalErr {
function IsFatal (line 61) | func IsFatal(err error) bool {
type Job (line 88) | type Job interface
FILE: chapter/16/workflow/internal/service/jobs/register/diskerase/diskerase.go
function init (line 25) | func init() {
type args (line 29) | type args struct
method validate (line 34) | func (a *args) validate(args map[string]string) error {
type Job (line 73) | type Job struct
method Validate (line 82) | func (j *Job) Validate(job *pb.Job) error {
method Run (line 92) | func (j *Job) Run(ctx context.Context, job *pb.Job) error {
function newJob (line 77) | func newJob() *Job {
FILE: chapter/16/workflow/internal/service/jobs/register/sleep/sleep.go
function init (line 26) | func init() {
type args (line 30) | type args struct
method validate (line 34) | func (a *args) validate(args map[string]string) error {
type Job (line 65) | type Job struct
method Validate (line 75) | func (j *Job) Validate(job *pb.Job) error {
method Run (line 85) | func (j *Job) Run(ctx context.Context, job *pb.Job) error {
function newJob (line 70) | func newJob() *Job {
FILE: chapter/16/workflow/internal/service/jobs/register/tokenbucket/tokenbucket.go
function init (line 28) | func init() {
type args (line 38) | type args struct
method validate (line 43) | func (a *args) validate(args map[string]string) error {
type Job (line 82) | type Job struct
method Validate (line 92) | func (j *Job) Validate(job *pb.Job) error {
method Run (line 102) | func (j *Job) Run(ctx context.Context, job *pb.Job) error {
function newJob (line 87) | func newJob() *Job {
FILE: chapter/16/workflow/internal/service/jobs/register/validatedecom/validatedecom.go
function init (line 24) | func init() {
type args (line 28) | type args struct
method validate (line 33) | func (a *args) validate(args map[string]string) error {
type Job (line 76) | type Job struct
method Validate (line 86) | func (j *Job) Validate(job *pb.Job) error {
method Run (line 96) | func (j *Job) Run(ctx context.Context, job *pb.Job) error {
function newJob (line 81) | func newJob(sites map[string]sites.Site) *Job {
FILE: chapter/16/workflow/internal/service/service.go
type active (line 26) | type active struct
type Workflow (line 32) | type Workflow struct
method Submit (line 70) | func (w *Workflow) Submit(ctx context.Context, req *pb.WorkReq) (*pb.W...
method Exec (line 135) | func (w *Workflow) Exec(ctx context.Context, req *pb.ExecReq) (*pb.Exe...
method Status (line 235) | func (w *Workflow) Status(ctx context.Context, req *pb.StatusReq) (*pb...
function New (line 46) | func New(storageDir string) (*Workflow, error) {
function statusFromWork (line 263) | func statusFromWork(req *pb.WorkReq) *pb.StatusResp {
function statusWriter (line 285) | func statusWriter(p string) (in chan *pb.StatusResp) {
FILE: chapter/16/workflow/internal/token/token.go
type Bucket (line 12) | type Bucket struct
method Close (line 55) | func (b *Bucket) Close() {
method Token (line 62) | func (b *Bucket) Token(ctx context.Context) error {
function New (line 22) | func New(size, incr int, interval time.Duration) (*Bucket, error) {
FILE: chapter/16/workflow/proto/custom.go
method CLISummary (line 15) | func (x *StatusResp) CLISummary(id string) string {
method writeOthers (line 41) | func (x *StatusResp) writeOthers(buff *strings.Builder, blocks []*BlockS...
method findRunning (line 57) | func (x *StatusResp) findRunning(blocks []*BlockStatus) (int, *BlockStat...
method writeRunning (line 66) | func (x *StatusResp) writeRunning(buff *strings.Builder, block *BlockSta...
FILE: chapter/16/workflow/proto/diskerase.pb.go
constant _ (line 19) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 21) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type Status (line 25) | type Status
method Enum (line 59) | func (x Status) Enum() *Status {
method String (line 65) | func (x Status) String() string {
method Descriptor (line 69) | func (Status) Descriptor() protoreflect.EnumDescriptor {
method Type (line 73) | func (Status) Type() protoreflect.EnumType {
method Number (line 77) | func (x Status) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 82) | func (Status) EnumDescriptor() ([]byte, []int) {
constant Status_StatusUnknown (line 30) | Status_StatusUnknown Status = 0
constant Status_StatusNotStarted (line 32) | Status_StatusNotStarted Status = 1
constant Status_StatusRunning (line 34) | Status_StatusRunning Status = 2
constant Status_StatusFailed (line 36) | Status_StatusFailed Status = 3
constant Status_StatusCompleted (line 38) | Status_StatusCompleted Status = 4
type WorkReq (line 87) | type WorkReq struct
method Reset (line 103) | func (x *WorkReq) Reset() {
method String (line 112) | func (x *WorkReq) String() string {
method ProtoMessage (line 116) | func (*WorkReq) ProtoMessage() {}
method ProtoReflect (line 118) | func (x *WorkReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 131) | func (*WorkReq) Descriptor() ([]byte, []int) {
method GetName (line 135) | func (x *WorkReq) GetName() string {
method GetDesc (line 142) | func (x *WorkReq) GetDesc() string {
method GetBlocks (line 149) | func (x *WorkReq) GetBlocks() []*Block {
type WorkResp (line 157) | type WorkResp struct
method Reset (line 166) | func (x *WorkResp) Reset() {
method String (line 175) | func (x *WorkResp) String() string {
method ProtoMessage (line 179) | func (*WorkResp) ProtoMessage() {}
method ProtoReflect (line 181) | func (x *WorkResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 194) | func (*WorkResp) Descriptor() ([]byte, []int) {
method GetId (line 198) | func (x *WorkResp) GetId() string {
type Block (line 207) | type Block struct
method Reset (line 220) | func (x *Block) Reset() {
method String (line 229) | func (x *Block) String() string {
method ProtoMessage (line 233) | func (*Block) ProtoMessage() {}
method ProtoReflect (line 235) | func (x *Block) ProtoReflect() protoreflect.Message {
method Descriptor (line 248) | func (*Block) Descriptor() ([]byte, []int) {
method GetDesc (line 252) | func (x *Block) GetDesc() string {
method GetRateLimit (line 259) | func (x *Block) GetRateLimit() int32 {
method GetJobs (line 266) | func (x *Block) GetJobs() []*Job {
type Job (line 274) | type Job struct
method Reset (line 291) | func (x *Job) Reset() {
method String (line 300) | func (x *Job) String() string {
method ProtoMessage (line 304) | func (*Job) ProtoMessage() {}
method ProtoReflect (line 306) | func (x *Job) ProtoReflect() protoreflect.Message {
method Descriptor (line 319) | func (*Job) Descriptor() ([]byte, []int) {
method GetName (line 323) | func (x *Job) GetName() string {
method GetDesc (line 330) | func (x *Job) GetDesc() string {
method GetArgs (line 337) | func (x *Job) GetArgs() map[string]string {
type ExecReq (line 346) | type ExecReq struct
method Reset (line 356) | func (x *ExecReq) Reset() {
method String (line 365) | func (x *ExecReq) String() string {
method ProtoMessage (line 369) | func (*ExecReq) ProtoMessage() {}
method ProtoReflect (line 371) | func (x *ExecReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 384) | func (*ExecReq) Descriptor() ([]byte, []int) {
method GetId (line 388) | func (x *ExecReq) GetId() string {
type ExecResp (line 396) | type ExecResp struct
method Reset (line 402) | func (x *ExecResp) Reset() {
method String (line 411) | func (x *ExecResp) String() string {
method ProtoMessage (line 415) | func (*ExecResp) ProtoMessage() {}
method ProtoReflect (line 417) | func (x *ExecResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 430) | func (*ExecResp) Descriptor() ([]byte, []int) {
type StatusReq (line 435) | type StatusReq struct
method Reset (line 444) | func (x *StatusReq) Reset() {
method String (line 453) | func (x *StatusReq) String() string {
method ProtoMessage (line 457) | func (*StatusReq) ProtoMessage() {}
method ProtoReflect (line 459) | func (x *StatusReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 472) | func (*StatusReq) Descriptor() ([]byte, []int) {
method GetId (line 476) | func (x *StatusReq) GetId() string {
type StatusResp (line 484) | type StatusResp struct
method Reset (line 504) | func (x *StatusResp) Reset() {
method String (line 513) | func (x *StatusResp) String() string {
method ProtoMessage (line 517) | func (*StatusResp) ProtoMessage() {}
method ProtoReflect (line 519) | func (x *StatusResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 532) | func (*StatusResp) Descriptor() ([]byte, []int) {
method GetName (line 536) | func (x *StatusResp) GetName() string {
method GetDesc (line 543) | func (x *StatusResp) GetDesc() string {
method GetStatus (line 550) | func (x *StatusResp) GetStatus() Status {
method GetBlocks (line 557) | func (x *StatusResp) GetBlocks() []*BlockStatus {
method GetHadErrors (line 564) | func (x *StatusResp) GetHadErrors() bool {
method GetWasEsStopped (line 571) | func (x *StatusResp) GetWasEsStopped() bool {
type BlockStatus (line 579) | type BlockStatus struct
method Reset (line 594) | func (x *BlockStatus) Reset() {
method String (line 603) | func (x *BlockStatus) String() string {
method ProtoMessage (line 607) | func (*BlockStatus) ProtoMessage() {}
method ProtoReflect (line 609) | func (x *BlockStatus) ProtoReflect() protoreflect.Message {
method Descriptor (line 622) | func (*BlockStatus) Descriptor() ([]byte, []int) {
method GetDesc (line 626) | func (x *BlockStatus) GetDesc() string {
method GetStatus (line 633) | func (x *BlockStatus) GetStatus() Status {
method GetHasError (line 640) | func (x *BlockStatus) GetHasError() bool {
method GetJobs (line 647) | func (x *BlockStatus) GetJobs() []*JobStatus {
type JobStatus (line 655) | type JobStatus struct
method Reset (line 672) | func (x *JobStatus) Reset() {
method String (line 681) | func (x *JobStatus) String() string {
method ProtoMessage (line 685) | func (*JobStatus) ProtoMessage() {}
method ProtoReflect (line 687) | func (x *JobStatus) ProtoReflect() protoreflect.Message {
method Descriptor (line 700) | func (*JobStatus) Descriptor() ([]byte, []int) {
method GetName (line 704) | func (x *JobStatus) GetName() string {
method GetDesc (line 711) | func (x *JobStatus) GetDesc() string {
method GetArgs (line 718) | func (x *JobStatus) GetArgs() map[string]string {
method GetStatus (line 725) | func (x *JobStatus) GetStatus() Status {
method GetError (line 732) | func (x *JobStatus) GetError() string {
function file_diskerase_proto_rawDescGZIP (line 839) | func file_diskerase_proto_rawDescGZIP() []byte {
function init (line 886) | func init() { file_diskerase_proto_init() }
function file_diskerase_proto_init (line 887) | func file_diskerase_proto_init() {
FILE: chapter/16/workflow/proto/diskerase_grpc.pb.go
constant _ (line 16) | _ = grpc.SupportPackageIsVersion7
type WorkflowClient (line 21) | type WorkflowClient interface
type workflowClient (line 31) | type workflowClient struct
method Submit (line 39) | func (c *workflowClient) Submit(ctx context.Context, in *WorkReq, opts...
method Exec (line 48) | func (c *workflowClient) Exec(ctx context.Context, in *ExecReq, opts ....
method Status (line 57) | func (c *workflowClient) Status(ctx context.Context, in *StatusReq, op...
function NewWorkflowClient (line 35) | func NewWorkflowClient(cc grpc.ClientConnInterface) WorkflowClient {
type WorkflowServer (line 69) | type WorkflowServer interface
type UnimplementedWorkflowServer (line 81) | type UnimplementedWorkflowServer struct
method Submit (line 84) | func (UnimplementedWorkflowServer) Submit(context.Context, *WorkReq) (...
method Exec (line 87) | func (UnimplementedWorkflowServer) Exec(context.Context, *ExecReq) (*E...
method Status (line 90) | func (UnimplementedWorkflowServer) Status(context.Context, *StatusReq)...
method mustEmbedUnimplementedWorkflowServer (line 93) | func (UnimplementedWorkflowServer) mustEmbedUnimplementedWorkflowServe...
type UnsafeWorkflowServer (line 98) | type UnsafeWorkflowServer interface
function RegisterWorkflowServer (line 102) | func RegisterWorkflowServer(s grpc.ServiceRegistrar, srv WorkflowServer) {
function _Workflow_Submit_Handler (line 106) | func _Workflow_Submit_Handler(srv interface{}, ctx context.Context, dec ...
function _Workflow_Exec_Handler (line 124) | func _Workflow_Exec_Handler(srv interface{}, ctx context.Context, dec fu...
function _Workflow_Status_Handler (line 142) | func _Workflow_Status_Handler(srv interface{}, ctx context.Context, dec ...
FILE: chapter/16/workflow/samples/diskerase/cmd/eraseSatellite.go
constant submitLog (line 40) | submitLog = "submit.log"
function init (line 114) | func init() {
function generateWork (line 121) | func generateWork(sat string) (*pb.WorkReq, error) {
function getBlockDesc (line 222) | func getBlockDesc(block *pb.Block) string {
FILE: chapter/16/workflow/samples/diskerase/cmd/protoStatus.go
function init (line 66) | func init() {
function monitorProto (line 72) | func monitorProto(ctx context.Context, c *client.Workflow, id string) er...
FILE: chapter/16/workflow/samples/diskerase/cmd/root.go
function Execute (line 46) | func Execute() {
function init (line 50) | func init() {
function initConfig (line 66) | func initConfig() {
FILE: chapter/16/workflow/samples/diskerase/cmd/status.go
function init (line 65) | func init() {
function monitor (line 71) | func monitor(ctx context.Context, c *client.Workflow, id string) error {
FILE: chapter/16/workflow/samples/diskerase/diskerase.go
function main (line 29) | func main() {
FILE: chapter/16/workflow/workflow.go
constant dirMode (line 37) | dirMode = os.ModeDir | 0700
function main (line 39) | func main() {
FILE: chapter/5/excel/simple/excel.go
function main (line 9) | func main() {
function mustParse (line 33) | func mustParse(s string) time.Time {
FILE: chapter/5/excel/visualization/excel.go
type CPUVendor (line 16) | type CPUVendor
constant UnknownCPUVendor (line 19) | UnknownCPUVendor CPUVendor = "Unknown"
constant Intel (line 20) | Intel CPUVendor = "Intel"
constant AMD (line 21) | AMD CPUVendor = "AMD"
function main (line 29) | func main() {
type summaries (line 43) | type summaries struct
type cpuVendorSum (line 47) | type cpuVendorSum struct
type serverSheet (line 51) | type serverSheet struct
method add (line 75) | func (s *serverSheet) add(name string, gen int, acquisition time.Time,...
method render (line 110) | func (s *serverSheet) render() error {
method writeSummaries (line 120) | func (s *serverSheet) writeSummaries() {
method createCPUChart (line 131) | func (s *serverSheet) createCPUChart() error {
function newServerSheet (line 59) | func newServerSheet() (*serverSheet, error) {
function mustParse (line 177) | func mustParse(s string) time.Time {
FILE: chapter/5/excel/visualization/internal/chart/chart.go
function New (line 4) | func New() *FormatChart {
type FormatChartAxis (line 31) | type FormatChartAxis struct
type FormatChartDimension (line 54) | type FormatChartDimension struct
type FormatChart (line 59) | type FormatChart struct
type FormatChartLegend (line 108) | type FormatChartLegend struct
type FormatChartSeries (line 119) | type FormatChartSeries struct
type FormatChartTitle (line 143) | type FormatChartTitle struct
type FormatLayout (line 151) | type FormatLayout struct
type FormatPicture (line 159) | type FormatPicture struct
type FormatShape (line 173) | type FormatShape struct
type FormatShapeParagraph (line 184) | type FormatShapeParagraph struct
type FormatShapeColor (line 190) | type FormatShapeColor struct
type FormatFont (line 197) | type FormatFont struct
type FormatStyle (line 207) | type FormatStyle struct
FILE: chapter/6/grpc/client/bin/qotd.go
function main (line 16) | func main() {
FILE: chapter/6/grpc/client/client.go
type Client (line 13) | type Client struct
method QOTD (line 33) | func (c *Client) QOTD(ctx context.Context, wantAuthor string) (author,...
function New (line 19) | func New(addr string) (*Client, error) {
FILE: chapter/6/grpc/proto/qotd.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type GetReq (line 23) | type GetReq struct
method Reset (line 31) | func (x *GetReq) Reset() {
method String (line 40) | func (x *GetReq) String() string {
method ProtoMessage (line 44) | func (*GetReq) ProtoMessage() {}
method ProtoReflect (line 46) | func (x *GetReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 59) | func (*GetReq) Descriptor() ([]byte, []int) {
method GetAuthor (line 63) | func (x *GetReq) GetAuthor() string {
type GetResp (line 70) | type GetResp struct
method Reset (line 79) | func (x *GetResp) Reset() {
method String (line 88) | func (x *GetResp) String() string {
method ProtoMessage (line 92) | func (*GetResp) ProtoMessage() {}
method ProtoReflect (line 94) | func (x *GetResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 107) | func (*GetResp) Descriptor() ([]byte, []int) {
method GetAuthor (line 111) | func (x *GetResp) GetAuthor() string {
method GetQuote (line 118) | func (x *GetResp) GetQuote() string {
function file_qotd_proto_rawDescGZIP (line 148) | func file_qotd_proto_rawDescGZIP() []byte {
function init (line 170) | func init() { file_qotd_proto_init() }
function file_qotd_proto_init (line 171) | func file_qotd_proto_init() {
FILE: chapter/6/grpc/proto/qotd_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type QOTDClient (line 20) | type QOTDClient interface
type qOTDClient (line 24) | type qOTDClient struct
method GetQOTD (line 32) | func (c *qOTDClient) GetQOTD(ctx context.Context, in *GetReq, opts ......
function NewQOTDClient (line 28) | func NewQOTDClient(cc grpc.ClientConnInterface) QOTDClient {
type QOTDServer (line 44) | type QOTDServer interface
type UnimplementedQOTDServer (line 50) | type UnimplementedQOTDServer struct
method GetQOTD (line 53) | func (UnimplementedQOTDServer) GetQOTD(context.Context, *GetReq) (*Get...
method mustEmbedUnimplementedQOTDServer (line 56) | func (UnimplementedQOTDServer) mustEmbedUnimplementedQOTDServer() {}
type UnsafeQOTDServer (line 61) | type UnsafeQOTDServer interface
function RegisterQOTDServer (line 65) | func RegisterQOTDServer(s grpc.ServiceRegistrar, srv QOTDServer) {
function _QOTD_GetQOTD_Handler (line 69) | func _QOTD_GetQOTD_Handler(srv interface{}, ctx context.Context, dec fun...
FILE: chapter/6/grpc/qotd.go
function main (line 12) | func main() {
FILE: chapter/6/grpc/server/server.go
type API (line 17) | type API struct
method Start (line 53) | func (a *API) Start() error {
method Stop (line 65) | func (a *API) Stop() {
method GetQOTD (line 72) | func (a *API) GetQOTD(ctx context.Context, req *pb.GetReq) (*pb.GetRes...
function New (line 27) | func New(addr string) (*API, error) {
FILE: chapter/7/cobra/app/cmd/get.go
function mustString (line 95) | func mustString(fs *pflag.FlagSet, name string) string {
function mustBool (line 103) | func mustBool(fs *pflag.FlagSet, name string) bool {
function init (line 111) | func init() {
FILE: chapter/7/cobra/app/cmd/root.go
function Execute (line 52) | func Execute(ctx context.Context) {
function init (line 56) | func init() {
function initConfig (line 71) | func initConfig() {
FILE: chapter/7/cobra/app/main.go
function main (line 30) | func main() {
FILE: chapter/7/filter_errors/main.go
function main (line 13) | func main() {
FILE: chapter/7/signals/main.go
function main (line 16) | func main() {
function createFiles (line 55) | func createFiles(ctx context.Context, tmpFiles string) {
type signaling (line 69) | type signaling struct
method register (line 85) | func (s signaling) register(f func(), sigs ...os.Signal) {
method handle (line 95) | func (s signaling) handle() {
function newSignaling (line 76) | func newSignaling() (sig signaling, stop context.CancelFunc) {
function cleanup (line 111) | func cleanup(cancel context.CancelFunc, wg *sync.WaitGroup, tmpFiles str...
FILE: chapter/8/agent/agent.go
function main (line 20) | func main() {
FILE: chapter/8/agent/client/cli/cmd/auth.go
function agentAuth (line 11) | func agentAuth() (ssh.AuthMethod, error) {
function publicKey (line 21) | func publicKey(privateKeyFile string) (ssh.AuthMethod, error) {
function getAuthFromFlags (line 35) | func getAuthFromFlags() (ssh.AuthMethod, error) {
FILE: chapter/8/agent/client/cli/cmd/install.go
function init (line 92) | func init() {
FILE: chapter/8/agent/client/cli/cmd/remove.go
function init (line 71) | func init() {
FILE: chapter/8/agent/client/cli/cmd/root.go
function Execute (line 56) | func Execute() {
function init (line 60) | func init() {
function initConfig (line 77) | func initConfig() {
FILE: chapter/8/agent/client/cli/main.go
function main (line 26) | func main() {
FILE: chapter/8/agent/client/cli/sample/helloweb/helloweb.go
function main (line 12) | func main() {
FILE: chapter/8/agent/client/client.go
type Client (line 24) | type Client struct
method Close (line 71) | func (c *Client) Close() error {
method Install (line 77) | func (c *Client) Install(ctx context.Context, req *pb.InstallReq) (*pb...
method Remove (line 81) | func (c *Client) Remove(ctx context.Context, req *pb.RemoveReq) (*pb.R...
function New (line 36) | func New(endpoint string, auth []ssh.AuthMethod) (*Client, error) {
FILE: chapter/8/agent/internal/service/service.go
constant pkgDir (line 36) | pkgDir = "sa/packages/"
constant serviceExt (line 37) | serviceExt = ".service"
type Agent (line 42) | type Agent struct
method Start (line 74) | func (a *Agent) Start() error {
method Install (line 99) | func (a *Agent) Install(ctx context.Context, req *pb.InstallReq) (*pb....
method Remove (line 122) | func (a *Agent) Remove(ctx context.Context, req *pb.RemoveReq) (*pb.Re...
method lock (line 137) | func (a *Agent) lock(name string) {
method unlock (line 150) | func (a *Agent) unlock(name string, del bool) {
method unpack (line 164) | func (a *Agent) unpack(name string, zipFile []byte) (string, error) {
method writeFile (line 185) | func (a *Agent) writeFile(z *zip.File, dir string) error {
method migrate (line 219) | func (a *Agent) migrate(req *pb.InstallReq, loc string) error {
method startProgram (line 249) | func (a *Agent) startProgram(ctx context.Context, name string) error {
method stopProgram (line 284) | func (a *Agent) stopProgram(ctx context.Context, name string) error {
method collectCPU (line 299) | func (a *Agent) collectCPU(resolution int32) error {
method collectMem (line 324) | func (a *Agent) collectMem(resolution int32) error {
method perfLoop (line 344) | func (a *Agent) perfLoop() error {
function New (line 56) | func New() (*Agent, error) {
FILE: chapter/8/agent/internal/service/unit_file.go
function init (line 21) | func init() {
type unitArgs (line 60) | type unitArgs struct
function writeUnitFile (line 69) | func writeUnitFile(dbusConn *dbus.Conn, user string, req *pb.InstallReq)...
function rmUnitFile (line 98) | func rmUnitFile(dbusConn *dbus.Conn, user string, req *pb.RemoveReq) err...
FILE: chapter/8/agent/proto/agent.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type InstallReq (line 23) | type InstallReq struct
method Reset (line 34) | func (x *InstallReq) Reset() {
method String (line 43) | func (x *InstallReq) String() string {
method ProtoMessage (line 47) | func (*InstallReq) ProtoMessage() {}
method ProtoReflect (line 49) | func (x *InstallReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 62) | func (*InstallReq) Descriptor() ([]byte, []int) {
method GetName (line 66) | func (x *InstallReq) GetName() string {
method GetPackage (line 73) | func (x *InstallReq) GetPackage() []byte {
method GetBinary (line 80) | func (x *InstallReq) GetBinary() string {
method GetArgs (line 87) | func (x *InstallReq) GetArgs() []string {
type InstallResp (line 94) | type InstallResp struct
method Reset (line 100) | func (x *InstallResp) Reset() {
method String (line 109) | func (x *InstallResp) String() string {
method ProtoMessage (line 113) | func (*InstallResp) ProtoMessage() {}
method ProtoReflect (line 115) | func (x *InstallResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 128) | func (*InstallResp) Descriptor() ([]byte, []int) {
type RemoveReq (line 132) | type RemoveReq struct
method Reset (line 140) | func (x *RemoveReq) Reset() {
method String (line 149) | func (x *RemoveReq) String() string {
method ProtoMessage (line 153) | func (*RemoveReq) ProtoMessage() {}
method ProtoReflect (line 155) | func (x *RemoveReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 168) | func (*RemoveReq) Descriptor() ([]byte, []int) {
method GetName (line 172) | func (x *RemoveReq) GetName() string {
type RemoveResp (line 179) | type RemoveResp struct
method Reset (line 185) | func (x *RemoveResp) Reset() {
method String (line 194) | func (x *RemoveResp) String() string {
method ProtoMessage (line 198) | func (*RemoveResp) ProtoMessage() {}
method ProtoReflect (line 200) | func (x *RemoveResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 213) | func (*RemoveResp) Descriptor() ([]byte, []int) {
type CPUPerfs (line 217) | type CPUPerfs struct
method Reset (line 227) | func (x *CPUPerfs) Reset() {
method String (line 236) | func (x *CPUPerfs) String() string {
method ProtoMessage (line 240) | func (*CPUPerfs) ProtoMessage() {}
method ProtoReflect (line 242) | func (x *CPUPerfs) ProtoReflect() protoreflect.Message {
method Descriptor (line 255) | func (*CPUPerfs) Descriptor() ([]byte, []int) {
method GetResolutionSecs (line 259) | func (x *CPUPerfs) GetResolutionSecs() int32 {
method GetUnixTimeNano (line 266) | func (x *CPUPerfs) GetUnixTimeNano() int64 {
method GetCpu (line 273) | func (x *CPUPerfs) GetCpu() []*CPUPerf {
type CPUPerf (line 280) | type CPUPerf struct
method Reset (line 293) | func (x *CPUPerf) Reset() {
method String (line 302) | func (x *CPUPerf) String() string {
method ProtoMessage (line 306) | func (*CPUPerf) ProtoMessage() {}
method ProtoReflect (line 308) | func (x *CPUPerf) ProtoReflect() protoreflect.Message {
method Descriptor (line 321) | func (*CPUPerf) Descriptor() ([]byte, []int) {
method GetId (line 325) | func (x *CPUPerf) GetId() string {
method GetUser (line 332) | func (x *CPUPerf) GetUser() int32 {
method GetSystem (line 339) | func (x *CPUPerf) GetSystem() int32 {
method GetIdle (line 346) | func (x *CPUPerf) GetIdle() int32 {
method GetIoWait (line 353) | func (x *CPUPerf) GetIoWait() int32 {
method GetIrq (line 360) | func (x *CPUPerf) GetIrq() int32 {
type MemPerf (line 367) | type MemPerf struct
method Reset (line 379) | func (x *MemPerf) Reset() {
method String (line 388) | func (x *MemPerf) String() string {
method ProtoMessage (line 392) | func (*MemPerf) ProtoMessage() {}
method ProtoReflect (line 394) | func (x *MemPerf) ProtoReflect() protoreflect.Message {
method Descriptor (line 407) | func (*MemPerf) Descriptor() ([]byte, []int) {
method GetResolutionSecs (line 411) | func (x *MemPerf) GetResolutionSecs() int32 {
method GetUnixTimeNano (line 418) | func (x *MemPerf) GetUnixTimeNano() int64 {
method GetTotal (line 425) | func (x *MemPerf) GetTotal() int32 {
method GetFree (line 432) | func (x *MemPerf) GetFree() int32 {
method GetAvail (line 439) | func (x *MemPerf) GetAvail() int32 {
function file_agent_proto_rawDescGZIP (line 509) | func file_agent_proto_rawDescGZIP() []byte {
function init (line 539) | func init() { file_agent_proto_init() }
function file_agent_proto_init (line 540) | func file_agent_proto_init() {
FILE: chapter/8/agent/proto/agent_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type AgentClient (line 20) | type AgentClient interface
type agentClient (line 25) | type agentClient struct
method Install (line 33) | func (c *agentClient) Install(ctx context.Context, in *InstallReq, opt...
method Remove (line 42) | func (c *agentClient) Remove(ctx context.Context, in *RemoveReq, opts ...
function NewAgentClient (line 29) | func NewAgentClient(cc grpc.ClientConnInterface) AgentClient {
type AgentServer (line 54) | type AgentServer interface
type UnimplementedAgentServer (line 61) | type UnimplementedAgentServer struct
method Install (line 64) | func (UnimplementedAgentServer) Install(context.Context, *InstallReq) ...
method Remove (line 67) | func (UnimplementedAgentServer) Remove(context.Context, *RemoveReq) (*...
method mustEmbedUnimplementedAgentServer (line 70) | func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}
type UnsafeAgentServer (line 75) | type UnsafeAgentServer interface
function RegisterAgentServer (line 79) | func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) {
function _Agent_Install_Handler (line 83) | func _Agent_Install_Handler(srv interface{}, ctx context.Context, dec fu...
function _Agent_Remove_Handler (line 101) | func _Agent_Remove_Handler(srv interface{}, ctx context.Context, dec fun...
FILE: chapter/8/agent/proto/extra.go
method Validate (line 15) | func (i *InstallReq) Validate() error {
function validName (line 36) | func validName(s string) bool {
method MarshalJSON (line 54) | func (x *CPUPerfs) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 60) | func (x *CPUPerfs) UnmarshalJSON(b []byte) error {
method MarshalJSON (line 66) | func (x *MemPerf) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 72) | func (x *MemPerf) UnmarshalJSON(b []byte) error {
FILE: chapter/8/rollout/config.go
type config (line 13) | type config struct
method validate (line 44) | func (s config) validate() error {
function checkIP (line 69) | func checkIP(s string) (net.IP, error) {
function checkIPPort (line 78) | func checkIPPort(b string) (net.IP, int32, error) {
FILE: chapter/8/rollout/endstate_string.go
function _ (line 7) | func _() {
constant _endState_name (line 18) | _endState_name = "esUnknownesSuccessesPreconditionFailureesCanaryFailure...
method String (line 22) | func (i endState) String() string {
FILE: chapter/8/rollout/lb/client/cli/cli.go
function main (line 36) | func main() {
FILE: chapter/8/rollout/lb/client/client.go
type HealthChecks (line 16) | type HealthChecks struct
method toPB (line 23) | func (h HealthChecks) toPB() *pb.HealthChecks {
type HealthCheck (line 36) | type HealthCheck interface
type StatusCheck (line 43) | type StatusCheck struct
method toPB (line 51) | func (s StatusCheck) toPB() *pb.HealthCheck {
method isHealthCheck (line 62) | func (s StatusCheck) isHealthCheck() {}
type Client (line 65) | type Client struct
method AddPool (line 85) | func (c *Client) AddPool(ctx context.Context, pattern string, pt pb.Po...
method RemovePool (line 107) | func (c *Client) RemovePool(ctx context.Context, pattern string) error {
method AddBackend (line 136) | func (c *Client) AddBackend(ctx context.Context, pattern string, b Bac...
method addIPBackend (line 144) | func (c *Client) addIPBackend(ctx context.Context, pattern string, b I...
method RemoveBackend (line 167) | func (c *Client) RemoveBackend(ctx context.Context, pattern string, b ...
method removeIPBackend (line 175) | func (c *Client) removeIPBackend(ctx context.Context, pattern string, ...
method PoolHealth (line 199) | func (c *Client) PoolHealth(ctx context.Context, pattern string, healt...
function New (line 71) | func New(addr string) (*Client, error) {
type Backend (line 122) | type Backend interface
type IPBackend (line 127) | type IPBackend struct
method isBackend (line 133) | func (i IPBackend) isBackend() {}
FILE: chapter/8/rollout/lb/lb.go
function main (line 11) | func main() {
FILE: chapter/8/rollout/lb/proto/lb.pb.go
constant _ (line 18) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 20) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type PoolType (line 25) | type PoolType
method Enum (line 46) | func (x PoolType) Enum() *PoolType {
method String (line 52) | func (x PoolType) String() string {
method Descriptor (line 56) | func (PoolType) Descriptor() protoreflect.EnumDescriptor {
method Type (line 60) | func (PoolType) Type() protoreflect.EnumType {
method Number (line 64) | func (x PoolType) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 69) | func (PoolType) EnumDescriptor() ([]byte, []int) {
constant PoolType_PT_UNKNOWN (line 29) | PoolType_PT_UNKNOWN PoolType = 0
constant PoolType_PT_P2C (line 31) | PoolType_PT_P2C PoolType = 1
type PoolStatus (line 73) | type PoolStatus
method Enum (line 102) | func (x PoolStatus) Enum() *PoolStatus {
method String (line 108) | func (x PoolStatus) String() string {
method Descriptor (line 112) | func (PoolStatus) Descriptor() protoreflect.EnumDescriptor {
method Type (line 116) | func (PoolStatus) Type() protoreflect.EnumType {
method Number (line 120) | func (x PoolStatus) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 125) | func (PoolStatus) EnumDescriptor() ([]byte, []int) {
constant PoolStatus_PS_UNKNOWN (line 77) | PoolStatus_PS_UNKNOWN PoolStatus = 0
constant PoolStatus_PS_FULL (line 79) | PoolStatus_PS_FULL PoolStatus = 1
constant PoolStatus_PS_EMPTY (line 81) | PoolStatus_PS_EMPTY PoolStatus = 2
constant PoolStatus_PS_DEGRADED (line 83) | PoolStatus_PS_DEGRADED PoolStatus = 3
type BackendStatus (line 130) | type BackendStatus
method Enum (line 155) | func (x BackendStatus) Enum() *BackendStatus {
method String (line 161) | func (x BackendStatus) String() string {
method Descriptor (line 165) | func (BackendStatus) Descriptor() protoreflect.EnumDescriptor {
method Type (line 169) | func (BackendStatus) Type() protoreflect.EnumType {
method Number (line 173) | func (x BackendStatus) Number() protoreflect.EnumNumber {
method EnumDescriptor (line 178) | func (BackendStatus) EnumDescriptor() ([]byte, []int) {
constant BackendStatus_BS_UNKNOWN (line 134) | BackendStatus_BS_UNKNOWN BackendStatus = 0
constant BackendStatus_BS_HEALTHY (line 136) | BackendStatus_BS_HEALTHY BackendStatus = 1
constant BackendStatus_BS_SICK (line 138) | BackendStatus_BS_SICK BackendStatus = 2
type HealthChecks (line 182) | type HealthChecks struct
method Reset (line 191) | func (x *HealthChecks) Reset() {
method String (line 200) | func (x *HealthChecks) String() string {
method ProtoMessage (line 204) | func (*HealthChecks) ProtoMessage() {}
method ProtoReflect (line 206) | func (x *HealthChecks) ProtoReflect() protoreflect.Message {
method Descriptor (line 219) | func (*HealthChecks) Descriptor() ([]byte, []int) {
method GetHealthChecks (line 223) | func (x *HealthChecks) GetHealthChecks() []*HealthCheck {
method GetIntervalSecs (line 230) | func (x *HealthChecks) GetIntervalSecs() int32 {
type HealthCheck (line 237) | type HealthCheck struct
method Reset (line 247) | func (x *HealthCheck) Reset() {
method String (line 256) | func (x *HealthCheck) String() string {
method ProtoMessage (line 260) | func (*HealthCheck) ProtoMessage() {}
method ProtoReflect (line 262) | func (x *HealthCheck) ProtoReflect() protoreflect.Message {
method Descriptor (line 275) | func (*HealthCheck) Descriptor() ([]byte, []int) {
method GetHealthCheck (line 279) | func (m *HealthCheck) GetHealthCheck() isHealthCheck_HealthCheck {
method GetStatusCheck (line 286) | func (x *HealthCheck) GetStatusCheck() *StatusCheck {
type isHealthCheck_HealthCheck (line 293) | type isHealthCheck_HealthCheck interface
type HealthCheck_StatusCheck (line 297) | type HealthCheck_StatusCheck struct
method isHealthCheck_HealthCheck (line 301) | func (*HealthCheck_StatusCheck) isHealthCheck_HealthCheck() {}
type StatusCheck (line 305) | type StatusCheck struct
method Reset (line 314) | func (x *StatusCheck) Reset() {
method String (line 323) | func (x *StatusCheck) String() string {
method ProtoMessage (line 327) | func (*StatusCheck) ProtoMessage() {}
method ProtoReflect (line 329) | func (x *StatusCheck) ProtoReflect() protoreflect.Message {
method Descriptor (line 342) | func (*StatusCheck) Descriptor() ([]byte, []int) {
method GetUrlPath (line 346) | func (x *StatusCheck) GetUrlPath() string {
method GetHealthyValues (line 353) | func (x *StatusCheck) GetHealthyValues() []string {
type Backend (line 360) | type Backend struct
method Reset (line 370) | func (x *Backend) Reset() {
method String (line 379) | func (x *Backend) String() string {
method ProtoMessage (line 383) | func (*Backend) ProtoMessage() {}
method ProtoReflect (line 385) | func (x *Backend) ProtoReflect() protoreflect.Message {
method Descriptor (line 398) | func (*Backend) Descriptor() ([]byte, []int) {
method GetBackend (line 402) | func (m *Backend) GetBackend() isBackend_Backend {
method GetIpBackend (line 409) | func (x *Backend) GetIpBackend() *IPBackend {
type isBackend_Backend (line 416) | type isBackend_Backend interface
type Backend_IpBackend (line 420) | type Backend_IpBackend struct
method isBackend_Backend (line 424) | func (*Backend_IpBackend) isBackend_Backend() {}
type IPBackend (line 427) | type IPBackend struct
method Reset (line 440) | func (x *IPBackend) Reset() {
method String (line 449) | func (x *IPBackend) String() string {
method ProtoMessage (line 453) | func (*IPBackend) ProtoMessage() {}
method ProtoReflect (line 455) | func (x *IPBackend) ProtoReflect() protoreflect.Message {
method Descriptor (line 468) | func (*IPBackend) Descriptor() ([]byte, []int) {
method GetIp (line 472) | func (x *IPBackend) GetIp() string {
method GetPort (line 479) | func (x *IPBackend) GetPort() int32 {
method GetUrlPath (line 486) | func (x *IPBackend) GetUrlPath() string {
type PoolHealth (line 494) | type PoolHealth struct
method Reset (line 506) | func (x *PoolHealth) Reset() {
method String (line 515) | func (x *PoolHealth) String() string {
method ProtoMessage (line 519) | func (*PoolHealth) ProtoMessage() {}
method ProtoReflect (line 521) | func (x *PoolHealth) ProtoReflect() protoreflect.Message {
method Descriptor (line 534) | func (*PoolHealth) Descriptor() ([]byte, []int) {
method GetStatus (line 538) | func (x *PoolHealth) GetStatus() PoolStatus {
method GetBackends (line 545) | func (x *PoolHealth) GetBackends() []*BackendHealth {
type BackendHealth (line 553) | type BackendHealth struct
method Reset (line 562) | func (x *BackendHealth) Reset() {
method String (line 571) | func (x *BackendHealth) String() string {
method ProtoMessage (line 575) | func (*BackendHealth) ProtoMessage() {}
method ProtoReflect (line 577) | func (x *BackendHealth) ProtoReflect() protoreflect.Message {
method Descriptor (line 590) | func (*BackendHealth) Descriptor() ([]byte, []int) {
method GetBackend (line 594) | func (x *BackendHealth) GetBackend() *Backend {
method GetStatus (line 601) | func (x *BackendHealth) GetStatus() BackendStatus {
type AddPoolReq (line 609) | type AddPoolReq struct
method Reset (line 622) | func (x *AddPoolReq) Reset() {
method String (line 631) | func (x *AddPoolReq) String() string {
method ProtoMessage (line 635) | func (*AddPoolReq) ProtoMessage() {}
method ProtoReflect (line 637) | func (x *AddPoolReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 650) | func (*AddPoolReq) Descriptor() ([]byte, []int) {
method GetPattern (line 654) | func (x *AddPoolReq) GetPattern() string {
method GetPoolType (line 661) | func (x *AddPoolReq) GetPoolType() PoolType {
method GetHealthChecks (line 668) | func (x *AddPoolReq) GetHealthChecks() *HealthChecks {
type AddPoolResp (line 676) | type AddPoolResp struct
method Reset (line 682) | func (x *AddPoolResp) Reset() {
method String (line 691) | func (x *AddPoolResp) String() string {
method ProtoMessage (line 695) | func (*AddPoolResp) ProtoMessage() {}
method ProtoReflect (line 697) | func (x *AddPoolResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 710) | func (*AddPoolResp) Descriptor() ([]byte, []int) {
type RemovePoolReq (line 715) | type RemovePoolReq struct
method Reset (line 724) | func (x *RemovePoolReq) Reset() {
method String (line 733) | func (x *RemovePoolReq) String() string {
method ProtoMessage (line 737) | func (*RemovePoolReq) ProtoMessage() {}
method ProtoReflect (line 739) | func (x *RemovePoolReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 752) | func (*RemovePoolReq) Descriptor() ([]byte, []int) {
method GetPattern (line 756) | func (x *RemovePoolReq) GetPattern() string {
type RemovePoolResp (line 764) | type RemovePoolResp struct
method Reset (line 770) | func (x *RemovePoolResp) Reset() {
method String (line 779) | func (x *RemovePoolResp) String() string {
method ProtoMessage (line 783) | func (*RemovePoolResp) ProtoMessage() {}
method ProtoReflect (line 785) | func (x *RemovePoolResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 798) | func (*RemovePoolResp) Descriptor() ([]byte, []int) {
type AddBackendReq (line 803) | type AddBackendReq struct
method Reset (line 814) | func (x *AddBackendReq) Reset() {
method String (line 823) | func (x *AddBackendReq) String() string {
method ProtoMessage (line 827) | func (*AddBackendReq) ProtoMessage() {}
method ProtoReflect (line 829) | func (x *AddBackendReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 842) | func (*AddBackendReq) Descriptor() ([]byte, []int) {
method GetPattern (line 846) | func (x *AddBackendReq) GetPattern() string {
method GetBackend (line 853) | func (x *AddBackendReq) GetBackend() *Backend {
type AddBackendResp (line 860) | type AddBackendResp struct
method Reset (line 866) | func (x *AddBackendResp) Reset() {
method String (line 875) | func (x *AddBackendResp) String() string {
method ProtoMessage (line 879) | func (*AddBackendResp) ProtoMessage() {}
method ProtoReflect (line 881) | func (x *AddBackendResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 894) | func (*AddBackendResp) Descriptor() ([]byte, []int) {
type RemoveBackendReq (line 899) | type RemoveBackendReq struct
method Reset (line 910) | func (x *RemoveBackendReq) Reset() {
method String (line 919) | func (x *RemoveBackendReq) String() string {
method ProtoMessage (line 923) | func (*RemoveBackendReq) ProtoMessage() {}
method ProtoReflect (line 925) | func (x *RemoveBackendReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 938) | func (*RemoveBackendReq) Descriptor() ([]byte, []int) {
method GetPattern (line 942) | func (x *RemoveBackendReq) GetPattern() string {
method GetBackend (line 949) | func (x *RemoveBackendReq) GetBackend() *Backend {
type RemoveBackendResp (line 957) | type RemoveBackendResp struct
method Reset (line 963) | func (x *RemoveBackendResp) Reset() {
method String (line 972) | func (x *RemoveBackendResp) String() string {
method ProtoMessage (line 976) | func (*RemoveBackendResp) ProtoMessage() {}
method ProtoReflect (line 978) | func (x *RemoveBackendResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 991) | func (*RemoveBackendResp) Descriptor() ([]byte, []int) {
type PoolHealthReq (line 996) | type PoolHealthReq struct
method Reset (line 1009) | func (x *PoolHealthReq) Reset() {
method String (line 1018) | func (x *PoolHealthReq) String() string {
method ProtoMessage (line 1022) | func (*PoolHealthReq) ProtoMessage() {}
method ProtoReflect (line 1024) | func (x *PoolHealthReq) ProtoReflect() protoreflect.Message {
method Descriptor (line 1037) | func (*PoolHealthReq) Descriptor() ([]byte, []int) {
method GetPattern (line 1041) | func (x *PoolHealthReq) GetPattern() string {
method GetHealthy (line 1048) | func (x *PoolHealthReq) GetHealthy() bool {
method GetSick (line 1055) | func (x *PoolHealthReq) GetSick() bool {
type PoolHealthResp (line 1062) | type PoolHealthResp struct
method Reset (line 1070) | func (x *PoolHealthResp) Reset() {
method String (line 1079) | func (x *PoolHealthResp) String() string {
method ProtoMessage (line 1083) | func (*PoolHealthResp) ProtoMessage() {}
method ProtoReflect (line 1085) | func (x *PoolHealthResp) ProtoReflect() protoreflect.Message {
method Descriptor (line 1098) | func (*PoolHealthResp) Descriptor() ([]byte, []int) {
method GetHealth (line 1102) | func (x *PoolHealthResp) GetHealth() *PoolHealth {
function file_lb_proto_rawDescGZIP (line 1241) | func file_lb_proto_rawDescGZIP() []byte {
function init (line 1302) | func init() { file_lb_proto_init() }
function file_lb_proto_init (line 1303) | func file_lb_proto_init() {
FILE: chapter/8/rollout/lb/proto/lb_grpc.pb.go
constant _ (line 15) | _ = grpc.SupportPackageIsVersion7
type LoadBalancerClient (line 20) | type LoadBalancerClient interface
type loadBalancerClient (line 28) | type loadBalancerClient struct
method AddPool (line 36) | func (c *loadBalancerClient) AddPool(ctx context.Context, in *AddPoolR...
method RemovePool (line 45) | func (c *loadBalancerClient) RemovePool(ctx context.Context, in *Remov...
method AddBackend (line 54) | func (c *loadBalancerClient) AddBackend(ctx context.Context, in *AddBa...
method RemoveBackend (line 63) | func (c *loadBalancerClient) RemoveBackend(ctx context.Context, in *Re...
method PoolHealth (line 72) | func (c *loadBalancerClient) PoolHealth(ctx context.Context, in *PoolH...
function NewLoadBalancerClient (line 32) | func NewLoadBalancerClient(cc grpc.ClientConnInterface) LoadBalancerClie...
type LoadBalancerServer (line 84) | type LoadBalancerServer interface
type UnimplementedLoadBalancerServer (line 94) | type UnimplementedLoadBalancerServer struct
method AddPool (line 97) | func (UnimplementedLoadBalancerServer) AddPool(context.Context, *AddPo...
method RemovePool (line 100) | func (UnimplementedLoadBalancerServer) RemovePool(context.Context, *Re...
method AddBackend (line 103) | func (UnimplementedLoadBalancerServer) AddBackend(context.Context, *Ad...
method RemoveBackend (line 106) | func (UnimplementedLoadBalancerServer) RemoveBackend(context.Context, ...
method PoolHealth (line 109) | func (UnimplementedLoadBalancerServer) PoolHealth(context.Context, *Po...
method mustEmbedUnimplementedLoadBalancerServer (line 112) | func (UnimplementedLoadBalancerServer) mustEmbedUnimplementedLoadBalan...
type UnsafeLoadBalancerServer (line 117) | type UnsafeLoadBalancerServer interface
function RegisterLoadBalancerServer (line 121) | func RegisterLoadBalancerServer(s grpc.ServiceRegistrar, srv LoadBalance...
function _LoadBalancer_AddPool_Handler (line 125) | func _LoadBalancer_AddPool_Handler(srv interface{}, ctx context.Context,...
function _LoadBalancer_RemovePool_Handler (line 143) | func _LoadBalancer_RemovePool_Handler(srv interface{}, ctx context.Conte...
function _LoadBalancer_AddBackend_Handler (line 161) | func _LoadBalancer_AddBackend_Handler(srv interface{}, ctx context.Conte...
function _LoadBalancer_RemoveBackend_Handler (line 179) | func _LoadBalancer_RemoveBackend_Handler(srv interface{}, ctx context.Co...
function _LoadBalancer_PoolHealth_Handler (line 197) | func _LoadBalancer_PoolHealth_Handler(srv interface{}, ctx context.Conte...
FILE: chapter/8/rollout/lb/sample/web/main.go
function main (line 17) | func main() {
FILE: chapter/8/rollout/lb/server/grpc/server.go
type Server (line 21) | type Server struct
method Start (line 46) | func (s *Server) Start() error {
method Stop (line 59) | func (s *Server) Stop() {
method AddPool (line 67) | func (s *Server) AddPool(ctx context.Context, req *pb.AddPoolReq) (*pb...
method RemovePool (line 120) | func (s *Server) RemovePool(ctx context.Context, req *pb.RemovePoolReq...
method AddBackend (line 131) | func (s *Server) AddBackend(ctx context.Context, req *pb.AddBackendReq...
method RemoveBackend (line 168) | func (s *Server) RemoveBackend(ctx context.Context, req *pb.RemoveBack...
method PoolHealth (line 206) | func (s *Server) PoolHealth(ctx context.Context, req *pb.PoolHealthReq...
function New (line 32) | func New(addr string, lb *http.LoadBalancer) (*Server, error) {
FILE: chapter/8/rollout/lb/server/http/p2c.go
type weightedBackend (line 27) | type weightedBackend struct
method get (line 33) | func (w *weightedBackend) get() int32 {
method call (line 37) | func (w *weightedBackend) call() {
method done (line 42) | func (w *weightedBackend) done() {
method handler (line 50) | func (w *weightedBackend) handler() http.Handler {
type P2C (line 61) | type P2C struct
method Close (line 93) | func (s *P2C) Close() error {
method Add (line 99) | func (s *P2C) Add(ctx context.Context, b Backend) error {
method Remove (line 121) | func (s *P2C) Remove(ctx context.Context, b Backend) error {
method Health (line 131) | func (s *P2C) Health(ctx context.Context, req *pb.PoolHealthReq) (*pb....
method addToValue (line 201) | func (s *P2C) addToValue(b *weightedBackend, v *atomic.Value) error {
method removeFromValue (line 219) | func (s *P2C) removeFromValue(b Backend, v *atomic.Value) error {
method ServeHTTP (line 243) | func (s *P2C) ServeHTTP(w http.ResponseWriter, r *http.Request) {
method healthLoop (line 259) | func (s *P2C) healthLoop() {
method healthChecks (line 272) | func (s *P2C) healthChecks(ctx context.Context) {
method healthyToSick (line 300) | func (s *P2C) healthyToSick(b *weightedBackend) {
method sickToHealthy (line 312) | func (s *P2C) sickToHealthy(b *weightedBackend) {
function NewP2C (line 75) | func NewP2C(hc HealthCheck, interval time.Duration) (*P2C, error) {
FILE: chapter/8/rollout/lb/server/http/server.go
type routeHandler (line 19) | type routeHandler struct
method mux (line 32) | func (r *routeHandler) mux() *http.ServeMux {
method replace (line 36) | func (r *routeHandler) replace(mux *http.ServeMux) {
method ServeHTTP (line 43) | func (r *routeHandler) ServeHTTP(w http.ResponseWriter, req *http.Requ...
function newRouteHandler (line 23) | func newRouteHandler(mux *http.ServeMux) *routeHandler {
function newServ (line 47) | func newServ(handler *routeHandler) *http.Server {
type LoadBalancer (line 56) | type LoadBalancer struct
method AddPool (line 75) | func (l *LoadBalancer) AddPool(pattern string, pool Pool) error {
method GetPool (line 89) | func (l *LoadBalancer) GetPool(pattern string) (Pool, error) {
method RemovePool (line 102) | func (l *LoadBalancer) RemovePool(pattern string) error {
method PoolHealth (line 124) | func (l *LoadBalancer) PoolHealth(ctx context.Context, req *pb.PoolHea...
method Serve (line 135) | func (l *LoadBalancer) Serve(lis net.Listener) error {
method ServeTLS (line 140) | func (l *LoadBalancer) ServeTLS(lis net.Listener, certFile, keyFile st...
function New (line 64) | func New() (*LoadBalancer, error) {
type Pool (line 145) | type Pool interface
type HealthCheck (line 162) | type HealthCheck
function HealthMultiplexer (line 165) | func HealthMultiplexer(healthChecks ...HealthCheck) HealthCheck {
function StatusCheck (line 188) | func StatusCheck(urlPath string, healthyValues []string) (HealthCheck, e...
type healthState (line 233) | type healthState
constant unknownHS (line 236) | unknownHS healthState = 0
constant healthy (line 237) | healthy healthState = 1
constant sick (line 238) | sick healthState = 2
type Backend (line 241) | type Backend interface
type IPBackend (line 258) | type IPBackend struct
method validate (line 288) | func (i *IPBackend) validate() error {
method url (line 298) | func (i *IPBackend) url() *url.URL {
method setHealth (line 302) | func (i *IPBackend) setHealth(hs healthState) {
method health (line 306) | func (i *IPBackend) health() healthState {
method call (line 310) | func (i *IPBackend) call() {}
method done (line 311) | func (i *IPBackend) done() {}
method handler (line 313) | func (i *IPBackend) handler() http.Handler {
method resolveURL (line 317) | func (i *IPBackend) resolveURL() error {
function NewIPBackend (line 271) | func NewIPBackend(ip net.IP, port int32, urlPath string) (*IPBackend, er...
FILE: chapter/8/rollout/rollout.go
function main (line 32) | func main() {
function setup (line 133) | func setup() (*config, *workflow, error) {
function getSSHConfig (line 163) | func getSSHConfig(config *config) error {
function getAuthFromFlags (line 180) | func getAuthFromFlags() (ssh.AuthMethod, error) {
function agentAuth (line 187) | func agentAuth() (ssh.AuthMethod, error) {
function publicKey (line 197) | func publicKey(privateKeyFile string) (ssh.AuthMethod, error) {
FILE: chapter/8/rollout/workflow.go
type endState (line 33) | type endState
constant esUnknown (line 37) | esUnknown endState = 0
constant esSuccess (line 40) | esSuccess endState = 1
constant esPreconditionFailure (line 42) | esPreconditionFailure endState = 2
constant esCanaryFailure (line 44) | esCanaryFailure endState = 3
constant esMaxFailures (line 47) | esMaxFailures endState = 4
type workflow (line 51) | type workflow struct
method run (line 76) | func (w *workflow) run(ctx context.Context) error {
method retryFailed (line 135) | func (w *workflow) retryFailed(ctx context.Context) {
method checkLBState (line 162) | func (w *workflow) checkLBState(ctx context.Context) error {
method buildActions (line 195) | func (w *workflow) buildActions() error {
method status (line 214) | func (w *workflow) status() workflowStatus {
function newWorkflow (line 62) | func newWorkflow(config *config, lb *client.Client) (*workflow, error) {
type workflowStatus (line 206) | type workflowStatus struct
type stateFn (line 224) | type stateFn
type actions (line 226) | type actions struct
method run (line 253) | func (a *actions) run(ctx context.Context) (err error) {
method rmBackend (line 291) | func (a *actions) rmBackend(ctx context.Context) (stateFn, error) {
method jobKill (line 300) | func (a *actions) jobKill(ctx context.Context) (stateFn, error) {
method cp (line 326) | func (a *actions) cp(ctx context.Context) (stateFn, error) {
method jobStart (line 333) | func (a *actions) jobStart(ctx context.Context) (stateFn, error) {
method reachable (line 340) | func (a *actions) reachable(ctx context.Context) (stateFn, error) {
method addBackend (line 383) | func (a *actions) addBackend(ctx context.Context) (stateFn, error) {
method findPIDs (line 392) | func (a *actions) findPIDs(ctx context.Context) ([]string, error) {
method killPIDs (line 410) | func (a *actions) killPIDs(ctx context.Context, pids []string, signal ...
method waitForDeath (line 424) | func (a *actions) waitForDeath(ctx context.Context, pids []string, tim...
method runBinary (line 446) | func (a *actions) runBinary(ctx context.Context) error {
method sftp (line 458) | func (a *actions) sftp() error {
method combinedOutput (line 485) | func (*actions) combinedOutput(ctx context.Context, conn *ssh.Client, ...
method startOnly (line 511) | func (*actions) startOnly(ctx context.Context, conn *ssh.Client, cmd s...
method failure (line 521) | func (a *actions) failure() string {
function newServerActions (line 240) | func newServerActions(endpoint string, config *config, lb *client.Client...
FILE: chapter/8/scanner/scanner.go
constant ping (line 19) | ping = "ping"
constant ssh (line 20) | ssh = "ssh"
constant uname (line 22) | uname = "uname"
function main (line 25) | func main() {
type record (line 59) | type record struct
function hosts (line 73) | func hosts(cidr string) (chan net.IP, error) {
function scanPrefixes (line 99) | func scanPrefixes(ipCh chan net.IP) chan record {
function unamePrefixes (line 132) | func unamePrefixes(user string, recs chan record) chan record {
function hostAlive (line 167) | func hostAlive(ctx context.Context, host net.IP) bool {
function runUname (line 178) | func runUname(ctx context.Context, host net.IP, user string) (string, er...
FILE: chapter/8/ssh/client/expect/expect.go
function main (line 25) | func main() {
function passwordFromTerm (line 93) | func passwordFromTerm() (ssh.AuthMethod, error) {
function publicKey (line 106) | func publicKey(privateKeyFile string) (ssh.AuthMethod, error) {
function installExpect (line 120) | func installExpect(conn *ssh.Client) (err error) {
FILE: chapter/8/ssh/client/remotecmd/remotecmd.go
function main (line 21) | func main() {
function passwordFromTerm (line 90) | func passwordFromTerm() (ssh.AuthMethod, error) {
function publicKey (line 103) | func publicKey(privateKeyFile string) (ssh.AuthMethod, error) {
function combinedOutput (
Condensed preview — 358 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,885K chars).
[
{
"path": ".gitignore",
"chars": 11,
"preview": ".idea\nvenv\n"
},
{
"path": "LICENSE",
"chars": 1062,
"preview": "MIT License\n\nCopyright (c) 2021 Packt\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof t"
},
{
"path": "README.md",
"chars": 6659,
"preview": "\n\n\n# Go for DevOps\n\n<a href=\"https://www.packtpub.com/product/go-for-devops/9781801818896?utm_source=github&utm_medium=r"
},
{
"path": "chapter/10/.github/release.yml",
"chars": 323,
"preview": "changelog:\n exclude:\n labels:\n - ignore-for-release\n categories:\n - title: Breaking Changes 🛠\n labels:"
},
{
"path": "chapter/10/.github/workflows/action-version.yaml",
"chars": 658,
"preview": "name: Release new tweeter version\non:\n release:\n types: [released]\n workflow_dispatch:\n inputs:\n TAG_NAME:\n"
},
{
"path": "chapter/10/.github/workflows/first.yaml",
"chars": 152,
"preview": "name: first-workflow\non: workflow_dispatch\njobs:\n echo:\n runs-on: ubuntu-latest\n steps:\n - name: echo step\n "
},
{
"path": "chapter/10/.github/workflows/image-release.yaml",
"chars": 953,
"preview": "name: release image\non:\n push:\n tags:\n - 'image-v*' # push events for tags matching image-v for version (image-"
},
{
"path": "chapter/10/.github/workflows/tweeter-automation.yaml",
"chars": 4307,
"preview": "name: tweeter-automation\non:\n push:\n tags:\n - 'v[0-9]+.[0-9]+.*'\n branches:\n - main\n pull_request:\n "
},
{
"path": "chapter/10/.gitignore",
"chars": 275,
"preview": "# Binaries for programs and plugins\n*.exe\n*.exe~\n*.dll\n*.so\n*.dylib\n\n# Test binary, built with `go test -c`\n*.test\n\n# Ou"
},
{
"path": "chapter/10/Dockerfile",
"chars": 733,
"preview": "FROM golang:1.17 as builder\nWORKDIR /workspace\n\n# Run this with docker build --build_arg $(go env GOPROXY) to override t"
},
{
"path": "chapter/10/README.md",
"chars": 2739,
"preview": "# DevOps for Go Tweeter\nThe tweeter command line tool will send a tweet via Twitter.\n\n## Setup\nYou can use tweeter to se"
},
{
"path": "chapter/10/action.yaml",
"chars": 1014,
"preview": "name: Tweeter Action\nauthor: DevOps for Go\ndescription: Simple action to send a tweet via an GitHub Action.\ninputs:\n me"
},
{
"path": "chapter/10/go.mod",
"chars": 509,
"preview": "module github.com/PacktPublishing/Go-for-DevOps/chapter/10\n\ngo 1.17\n\nrequire (\n\tgithub.com/dghubble/go-twitter v0.0.0-20"
},
{
"path": "chapter/10/go.sum",
"chars": 2251,
"preview": "github.com/cenkalti/backoff v2.1.1+incompatible h1:tKJnvO2kl0zmb/jA5UKAt4VoEVw1qxKWjE/Bpp46npY=\ngithub.com/cenkalti/back"
},
{
"path": "chapter/10/main.go",
"chars": 2646,
"preview": "package main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/hashicorp/go-multierror\"\n\t\"github.com/pkg/errors\"\n\tflag \"github.com/sp"
},
{
"path": "chapter/10/pkg/tweeter/tweeter.go",
"chars": 1774,
"preview": "package tweeter\n\nimport (\n\t\"github.com/dghubble/go-twitter/twitter\"\n\t\"github.com/dghubble/oauth1\"\n\t\"github.com/hashicorp"
},
{
"path": "chapter/10/pkg/tweeter/tweeter_test.go",
"chars": 3575,
"preview": "package tweeter_test\n\nimport (\n\t\"strings\"\n\t\"testing\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/chapter/10/pkg/tweeter\""
},
{
"path": "chapter/11/Dockerfile",
"chars": 357,
"preview": "FROM golang:1.17\nCOPY . /usr/src/server\nWORKDIR /usr/src/server\nRUN go env -w GOPROXY=direct GO111MODULE=on\nRUN go mod i"
},
{
"path": "chapter/11/README.md",
"chars": 1386,
"preview": "# ChatOps Demonstration\n\nThis directory contains:\n\n* A ChatOps service for Slack\n* An traceable and metricized Petstore "
},
{
"path": "chapter/11/chatbot/.gitignore",
"chars": 4,
"preview": ".env"
},
{
"path": "chapter/11/chatbot/bot/bot.go",
"chars": 5688,
"preview": "// Package bot defines a basic slack bot that can listen for app mention events for our bot\n// and send the message to a"
},
{
"path": "chapter/11/chatbot/chatbot.go",
"chars": 1291,
"preview": "package main\n\nimport (\n\t\"flag\"\n\t\"log\"\n\t\"os\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/chapter/11/chatbot/bot\"\n\t\"github"
},
{
"path": "chapter/11/chatbot/internal/handlers/handlers.go",
"chars": 9275,
"preview": "// Package handlers provides an Ops type that has methods that implement bot.HandleFunc for various commands that could "
},
{
"path": "chapter/11/chatbot/internal/handlers/help.go",
"chars": 1510,
"preview": "package handlers\n\nvar help = map[string]string{\n\t\"list traces\": `\nlist traces <opt1=val1 op2=val2>\nEx: list traces opera"
},
{
"path": "chapter/11/chatbot/slack.manifest",
"chars": 788,
"preview": "display_information:\n name: PetStore\nfeatures:\n app_home:\n home_tab_enabled: true\n messages_tab_enabled: false\n "
},
{
"path": "chapter/11/docker-compose.yaml",
"chars": 1503,
"preview": "version: \"2\"\nservices:\n\n # Jaeger\n jaeger-all-in-one:\n image: jaegertracing/all-in-one:latest\n ports:\n - \"1"
},
{
"path": "chapter/11/ops/README.md",
"chars": 1665,
"preview": "# Ops Service\n\nThe Ops service provides API access to various operational information that we want to allow various tool"
},
{
"path": "chapter/11/ops/client/client.go",
"chars": 7389,
"preview": "package client\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"google.golang.org/grpc\"\n\n\tpb \"github.com/PacktPublishin"
},
{
"path": "chapter/11/ops/internal/jaeger/client/client.go",
"chars": 6607,
"preview": "// Package client provides a Jaegar client for grabbing traces from the Jaegar service.\n// It is a wrapper around the un"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/README.md",
"chars": 257,
"preview": "This provides an end to end test using docker to turn up Jaeger and an http server using Jaeger.\n\nWe kick off some trace"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/client/client.go",
"chars": 4315,
"preview": "package client\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"net/http\"\n\t\"strconv\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/google/uuid\"\n\t\"go.opente"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/docker-compose.yaml",
"chars": 868,
"preview": "version: \"2\"\nservices:\n\n # Jaeger\n jaeger-all-in-one:\n image: jaegertracing/all-in-one:latest\n ports:\n - \"1"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/etoe_test.go",
"chars": 2065,
"preview": "package etoe\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"os/exec\"\n\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/chap"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/otel-collector-config.yaml",
"chars": 270,
"preview": "receivers:\n otlp:\n protocols:\n grpc:\n\nexporters:\n jaeger:\n endpoint: jaeger-all-in-one:14250\n tls:\n "
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/Dockerfile",
"chars": 141,
"preview": "FROM golang:1.17\nCOPY . /usr/src/server/\nWORKDIR /usr/src/server/\nRUN go env -w GOPROXY=direct\nRUN go install ./main.go\n"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/docker-compose.yaml",
"chars": 1072,
"preview": "version: \"2\"\nservices:\n\n # Jaeger\n jaeger-all-in-one:\n image: jaegertracing/all-in-one:latest\n ports:\n - \"1"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/go.mod",
"chars": 1330,
"preview": "module github.com/PacktPublishing/Go-for-DevOps/chapter/9/tracing/demo/server\n\ngo 1.17\n\nrequire (\n\tgo.opentelemetry.io/c"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/go.sum",
"chars": 18156,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/main.go",
"chars": 2844,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"net/http\"\n\t\"os\"\n\t\"time\"\n\n\t\"go.opentelemetry.io/contrib/instrumentation/net/ht"
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/otel-collector-config.yaml",
"chars": 270,
"preview": "receivers:\n otlp:\n protocols:\n grpc:\n\nexporters:\n jaeger:\n endpoint: jaeger-all-in-one:14250\n tls:\n "
},
{
"path": "chapter/11/ops/internal/jaeger/client/test/server/readme.md",
"chars": 1726,
"preview": "# Tracing with OpenTelemetry and Jaeger\n\nTODO: fill in the walk through\n\n## Running this example\n- `docker-compose up -d"
},
{
"path": "chapter/11/ops/internal/prom/prom.go",
"chars": 4892,
"preview": "package prom\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"regexp\"\n\t\"runtime\"\n\t\"strings\"\n\t\"sync\"\n\t\"time\"\n\n\t\"github.com/prometheus/client"
},
{
"path": "chapter/11/ops/internal/server/server.go",
"chars": 6407,
"preview": "// Package server contains our gRPC server implementation for the ops server.\npackage server\n\nimport (\n\t\"context\"\n\t\"erro"
},
{
"path": "chapter/11/ops/ops.go",
"chars": 1346,
"preview": "package main\n\nimport (\n\t\"flag\"\n\t\"log\"\n\n\tjaegerClient \"github.com/PacktPublishing/Go-for-DevOps/chapter/11/ops/internal/j"
},
{
"path": "chapter/11/ops/proto/buf.gen.yaml",
"chars": 154,
"preview": "version: v1\nplugins:\n - name: go\n out: ./\n opt:\n - paths=source_relative\n - name: go-grpc\n out: ./\n o"
},
{
"path": "chapter/11/ops/proto/buf.yaml",
"chars": 137,
"preview": "version: v1\ndeps:\n - buf.build/googleapis/googleapis\n - buf.build/gogo/protobuf\nlint:\n use:\n - DEFAULT\nbreaking:\n "
},
{
"path": "chapter/11/ops/proto/jaeger/collector.pb.go",
"chars": 9173,
"preview": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache "
},
{
"path": "chapter/11/ops/proto/jaeger/collector.proto",
"chars": 1618,
"preview": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache "
},
{
"path": "chapter/11/ops/proto/jaeger/collector_grpc.pb.go",
"chars": 3797,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage jaeger\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang."
},
{
"path": "chapter/11/ops/proto/jaeger/model/model.pb.go",
"chars": 39374,
"preview": "// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// y"
},
{
"path": "chapter/11/ops/proto/jaeger/model/model.proto",
"chars": 4691,
"preview": "// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// y"
},
{
"path": "chapter/11/ops/proto/jaeger/query.pb.go",
"chars": 44233,
"preview": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache "
},
{
"path": "chapter/11/ops/proto/jaeger/query.proto",
"chars": 4424,
"preview": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache "
},
{
"path": "chapter/11/ops/proto/jaeger/query_grpc.pb.go",
"chars": 12066,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage jaeger\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang."
},
{
"path": "chapter/11/ops/proto/jaeger/sampling.pb.go",
"chars": 30220,
"preview": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache "
},
{
"path": "chapter/11/ops/proto/jaeger/sampling.proto",
"chars": 5197,
"preview": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2018 Uber Technologies, Inc.\n//\n// Licensed under the Apache "
},
{
"path": "chapter/11/ops/proto/jaeger/sampling_grpc.pb.go",
"chars": 3975,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage jaeger\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang."
},
{
"path": "chapter/11/ops/proto/ops.pb.go",
"chars": 39851,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.25.0-devel\n// \tprotoc v3.18.0\n"
},
{
"path": "chapter/11/ops/proto/ops.proto",
"chars": 4111,
"preview": "syntax = \"proto3\";\n\npackage ops;\n\nimport \"google/protobuf/duration.proto\";\nimport \"jaeger/model/model.proto\";\n\noption go"
},
{
"path": "chapter/11/ops/proto/ops_grpc.pb.go",
"chars": 10588,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage proto\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang.o"
},
{
"path": "chapter/11/otel-collector-config.yaml",
"chars": 456,
"preview": "receivers:\n otlp:\n protocols:\n grpc:\n\nexporters:\n prometheus:\n endpoint: \"0.0.0.0:8889\"\n const_labels:\n "
},
{
"path": "chapter/11/petstore/Dockerfile",
"chars": 144,
"preview": "FROM golang:1.17\nCOPY . /usr/src/server/\nWORKDIR /usr/src/server/\nRUN go install\nCMD [\"/go/bin/petstore\", \"--grpcTraces\""
},
{
"path": "chapter/11/petstore/README.md",
"chars": 4720,
"preview": "# Petstore Application\n\n## Introduction\n\nIn chapter 8, you have seen an example application that did metrics and tracing"
},
{
"path": "chapter/11/petstore/client/cli/petstore/petstore.go",
"chars": 6501,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/ch"
},
{
"path": "chapter/11/petstore/client/client.go",
"chars": 6195,
"preview": "// Client provides an API client to the petstore service.\npackage client\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n\n\t\"gi"
},
{
"path": "chapter/11/petstore/client/demo/Dockerfile",
"chars": 176,
"preview": "FROM golang:1.17\nCOPY . /usr/src/demo/\nWORKDIR /usr/src/demo/\nRUN go env -w GOPROXY=direct GO111MODULE=on\nWORKDIR /usr/s"
},
{
"path": "chapter/11/petstore/client/demo/demo.go",
"chars": 2551,
"preview": "/*\nThe demo will take a list of pet names and insert them into the Petstore every 1/2\na second. At the same time, starti"
},
{
"path": "chapter/11/petstore/client/demo/names.txt",
"chars": 1629,
"preview": "Abigail\nAce\nAdam\nAddie\nAdmiral\nAggie\nAires\nAj\nAjax\nAldo\nAlex\nAlexus\nAlf\nAlfie\nAllie\nAlly\nAmber\nAmie\nAmigo\nAmos\nAmy\nAndy\n"
},
{
"path": "chapter/11/petstore/docker-compose.yaml",
"chars": 1321,
"preview": "version: \"2\"\nservices:\n\n # Jaeger\n jaeger-all-in-one:\n image: jaegertracing/all-in-one:latest\n ports:\n - \"1"
},
{
"path": "chapter/11/petstore/go.mod",
"chars": 1487,
"preview": "module github.com/PacktPublishing/Go-for-DevOps/chapter/11/petstore\n\ngo 1.18\n\nrequire (\n\tgithub.com/biogo/store v0.0.0-2"
},
{
"path": "chapter/11/petstore/go.sum",
"chars": 20474,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
},
{
"path": "chapter/11/petstore/internal/server/errors/errors.go",
"chars": 1350,
"preview": "// Package errors is a replacement for the golang standard library \"errors\". This replacement\n// adds errors to the Open"
},
{
"path": "chapter/11/petstore/internal/server/log/log.go",
"chars": 8688,
"preview": "/*\nPackage log is a replacement for the standard library log package that\nlogs to OTEL spans contained in Context object"
},
{
"path": "chapter/11/petstore/internal/server/server.go",
"chars": 11202,
"preview": "// Package server contains our gRPC server implementation for the pet store.\npackage server\n\nimport (\n\t\"context\"\n\t\"fmt\"\n"
},
{
"path": "chapter/11/petstore/internal/server/storage/mem/mem.go",
"chars": 10117,
"preview": "// Package mem contains an in-memory storage implementation of storage.Data.\n// This is great for unit tests and demos. "
},
{
"path": "chapter/11/petstore/internal/server/storage/mem/mem_test.go",
"chars": 4295,
"preview": "package mem\n\nimport (\n\t\"context\"\n\t\"sort\"\n\t\"strconv\"\n\t\"testing\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/chapter/11/pe"
},
{
"path": "chapter/11/petstore/internal/server/storage/storage.go",
"chars": 2407,
"preview": "package storage\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"time\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/chapter/11/petstore/"
},
{
"path": "chapter/11/petstore/internal/server/telemetry/metrics/metrics.go",
"chars": 7298,
"preview": "/*\nPackage metrics provides setup of metrics that can be used internally to measure various application states.\nAll metr"
},
{
"path": "chapter/11/petstore/internal/server/telemetry/metrics/start.go",
"chars": 2049,
"preview": "package metrics\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"go.opentelemetry.io/otel\"\n\t\"go.opentelemetry.io/otel/exporters/ot"
},
{
"path": "chapter/11/petstore/internal/server/telemetry/tracing/sampler/sampler.go",
"chars": 3101,
"preview": "/*\nPackage sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called \"trace\"\nand i"
},
{
"path": "chapter/11/petstore/internal/server/telemetry/tracing/tracing.go",
"chars": 4684,
"preview": "/*\nPackage tracing provides functions for starting and stopping our Open Telemetry tracing.\nThis package is intended to "
},
{
"path": "chapter/11/petstore/otel-collector-config.yaml",
"chars": 456,
"preview": "receivers:\n otlp:\n protocols:\n grpc:\n\nexporters:\n prometheus:\n endpoint: \"0.0.0.0:8889\"\n const_labels:\n "
},
{
"path": "chapter/11/petstore/petstore.go",
"chars": 4999,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\tstdlog \"log\"\n\t\"os\"\n\t\"strconv\"\n\n\t\"github.com/PacktPublishing/Go-for-DevOps/cha"
},
{
"path": "chapter/11/petstore/prometheus.yaml",
"chars": 174,
"preview": "scrape_configs:\n - job_name: 'otel-collector'\n scrape_interval: 10s\n static_configs:\n - targets: ['otel-coll"
},
{
"path": "chapter/11/petstore/proto/buf.gen.yaml",
"chars": 154,
"preview": "version: v1\nplugins:\n - name: go\n out: ./\n opt:\n - paths=source_relative\n - name: go-grpc\n out: ./\n o"
},
{
"path": "chapter/11/petstore/proto/buf.yaml",
"chars": 109,
"preview": "version: v1\ndeps:\n - buf.build/googleapis/googleapis\nlint:\n use:\n - DEFAULT\nbreaking:\n use:\n - FILE\n"
},
{
"path": "chapter/11/petstore/proto/petstore.pb.go",
"chars": 33907,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.25.0-devel\n// \tprotoc v3.18.0\n"
},
{
"path": "chapter/11/petstore/proto/petstore.proto",
"chars": 3001,
"preview": "syntax = \"proto3\";\n\npackage petstore;\n\noption go_package = \"github.com/PacktPublishing/Go-for-DevOps/proto\";\n\nimport \"go"
},
{
"path": "chapter/11/petstore/proto/petstore_grpc.pb.go",
"chars": 9648,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage proto\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang.o"
},
{
"path": "chapter/11/prometheus.yaml",
"chars": 174,
"preview": "scrape_configs:\n - job_name: 'otel-collector'\n scrape_interval: 10s\n static_configs:\n - targets: ['otel-coll"
},
{
"path": "chapter/12/agent.service",
"chars": 225,
"preview": "[Unit]\nDescription=System agent for running software\nAfter=network.target\n\n[Service]\nType=simple\nUser=agent\nGroup=agent\n"
},
{
"path": "chapter/12/goss/allfiles/allfiles.go",
"chars": 3397,
"preview": "//go:build linux || darwin\n\n/*\n\t^\n\t|\nIf you haven't see the above line, this is called a build constraint. This will\nonl"
},
{
"path": "chapter/12/packer/README",
"chars": 93,
"preview": "These hcl files work, however you will need to put in your own user's access key and secret.\n"
},
{
"path": "chapter/12/packer/amazon.final.pkr.hcl",
"chars": 3643,
"preview": "packer {\n required_plugins {\n amazon = {\n version = \">= 0.0.1\"\n source = \"github.com/hashicorp/amazon\"\n "
},
{
"path": "chapter/12/packer/amazon.goenv.pkr.hcl",
"chars": 3247,
"preview": "packer {\n required_plugins {\n amazon = {\n version = \">= 0.0.1\"\n source = \"github.com/hashicorp/amazon\"\n "
},
{
"path": "chapter/12/packer/plugins/goenv/GNUmakefile",
"chars": 1056,
"preview": "NAME=scaffolding\nBINARY=packer-plugin-${NAME}\n\nCOUNT?=1\nTEST?=$(shell go list ./...)\nHASHICORP_PACKER_PLUGIN_SDK_VERSION"
},
{
"path": "chapter/12/packer/plugins/goenv/LICENSE",
"chars": 1066,
"preview": "MIT License\n\nCopyright (c) 2022 John Doak\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\n"
},
{
"path": "chapter/12/packer/plugins/goenv/goenv.go",
"chars": 4633,
"preview": "package main\n\nimport (\n\t\"bytes\"\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"net/http\"\n\t\"os\"\n\t\"runtime\"\n\t\"strings\"\n\n\t\"github.com/PacktPubli"
},
{
"path": "chapter/12/packer/plugins/goenv/internal/config/config.go",
"chars": 294,
"preview": "package config\n\n//go:generate packer-sdc mapstructure-to-hcl2 -type Provisioner\n\n// Provisioner is our provisioner confi"
},
{
"path": "chapter/12/packer/plugins/goenv/internal/config/config.hcl2spec.go",
"chars": 1104,
"preview": "// Code generated by \"packer-sdc mapstructure-to-hcl2\"; DO NOT EDIT.\n\npackage config\n\nimport (\n\t\"github.com/hashicorp/hc"
},
{
"path": "chapter/13/petstore-provider/.gitignore",
"chars": 27,
"preview": "bin\n.terraform*\n*.tfstate*\n"
},
{
"path": "chapter/13/petstore-provider/Makefile",
"chars": 515,
"preview": "HOSTNAME=example.com\nNAMESPACE=gofordevops\nNAME=petstore\nBINARY=terraform-provider-${NAME}\nVERSION=0.1.0\nGOARCH := $(sh"
},
{
"path": "chapter/13/petstore-provider/docker-compose.yml",
"chars": 173,
"preview": "version: '3.7'\nservices:\n petstore:\n build:\n context: ../../11/petstore/.\n command:\n - /go/bin/petstore"
},
{
"path": "chapter/13/petstore-provider/examples/main.tf",
"chars": 791,
"preview": "terraform {\n required_providers {\n petstore = {\n version = \"0.1.0\"\n source = \"example.com/gofordevops/pet"
},
{
"path": "chapter/13/petstore-provider/go.mod",
"chars": 3284,
"preview": "module github.com/PacktPublishing/Go-for-DevOps/chapter/13/petstore-provider\n\ngo 1.17\n\nrequire (\n\tgithub.com/biogo/store"
},
{
"path": "chapter/13/petstore-provider/go.sum",
"chars": 38187,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
},
{
"path": "chapter/13/petstore-provider/internal/client/client.go",
"chars": 6244,
"preview": "// Client provides an API client to the petstore service.\npackage client\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n\n\t\"go"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/errors/errors.go",
"chars": 1350,
"preview": "// Package errors is a replacement for the golang standard library \"errors\". This replacement\n// adds errors to the Open"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/log/log.go",
"chars": 8606,
"preview": "/*\nPackage log is a replacement for the standard library log package that\nlogs to OTEL spans contained in Context object"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/storage/mem/mem.go",
"chars": 10216,
"preview": "// Package mem contains an in-memory storage implementation of storage.Data.\n// This is great for unit tests and demos. "
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/storage/mem/mem_test.go",
"chars": 4344,
"preview": "package mem\n\nimport (\n\t\"context\"\n\t\"sort\"\n\t\"strconv\"\n\t\"testing\"\n\n\t\"github.com/kylelemons/godebug/pretty\"\n\tdpb \"google.gol"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/storage/storage.go",
"chars": 2456,
"preview": "package storage\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"time\"\n\n\tdpb \"google.golang.org/genproto/googleapis/type/date\"\n\n\t\"githu"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/telemetry/metrics/metrics.go",
"chars": 7323,
"preview": "/*\nPackage metrics provides setup of metrics that can be used internally to measure various application states.\nAll metr"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/telemetry/metrics/start.go",
"chars": 2049,
"preview": "package metrics\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"go.opentelemetry.io/otel\"\n\t\"go.opentelemetry.io/otel/exporters/ot"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/telemetry/tracing/sampler/sampler.go",
"chars": 3101,
"preview": "/*\nPackage sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called \"trace\"\nand i"
},
{
"path": "chapter/13/petstore-provider/internal/client/internal/server/telemetry/tracing/tracing.go",
"chars": 4709,
"preview": "/*\nPackage tracing provides functions for starting and stopping our Open Telemetry tracing.\nThis package is intended to "
},
{
"path": "chapter/13/petstore-provider/internal/client/proto/buf.gen.yaml",
"chars": 154,
"preview": "version: v1\nplugins:\n - name: go\n out: ./\n opt:\n - paths=source_relative\n - name: go-grpc\n out: ./\n o"
},
{
"path": "chapter/13/petstore-provider/internal/client/proto/buf.yaml",
"chars": 109,
"preview": "version: v1\ndeps:\n - buf.build/googleapis/googleapis\nlint:\n use:\n - DEFAULT\nbreaking:\n use:\n - FILE\n"
},
{
"path": "chapter/13/petstore-provider/internal/client/proto/petstore.pb.go",
"chars": 33907,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.25.0-devel\n// \tprotoc v3.18.0\n"
},
{
"path": "chapter/13/petstore-provider/internal/client/proto/petstore.proto",
"chars": 3001,
"preview": "syntax = \"proto3\";\n\npackage petstore;\n\noption go_package = \"github.com/PacktPublishing/Go-for-DevOps/proto\";\n\nimport \"go"
},
{
"path": "chapter/13/petstore-provider/internal/client/proto/petstore_grpc.pb.go",
"chars": 9648,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage proto\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang.o"
},
{
"path": "chapter/13/petstore-provider/internal/data_source_pet.go",
"chars": 4453,
"preview": "package petstore\n\nimport (\n\t\"context\"\n\t\"strconv\"\n\t\"time\"\n\n\t\"github.com/hashicorp/terraform-plugin-sdk/v2/diag\"\n\t\"github."
},
{
"path": "chapter/13/petstore-provider/internal/provider.go",
"chars": 1512,
"preview": "package petstore\n\nimport (\n\t\"context\"\n\n\t\"github.com/hashicorp/terraform-plugin-sdk/v2/diag\"\n\t\"github.com/hashicorp/terra"
},
{
"path": "chapter/13/petstore-provider/internal/resource_pets.go",
"chars": 2831,
"preview": "package petstore\n\nimport (\n\t\"context\"\n\n\t\"github.com/hashicorp/terraform-plugin-sdk/v2/diag\"\n\t\"github.com/hashicorp/terra"
},
{
"path": "chapter/13/petstore-provider/internal/schema.go",
"chars": 3022,
"preview": "package petstore\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/hashicorp/go-cty/cty\"\n\t\"github.com/hashicorp/terraform-plugin-sdk/v2/dia"
},
{
"path": "chapter/13/petstore-provider/main.go",
"chars": 365,
"preview": "package main\n\nimport (\n\t\"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema\"\n\t\"github.com/hashicorp/terraform-pl"
},
{
"path": "chapter/14/petstore-operator/.dockerignore",
"chars": 129,
"preview": "# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file\n# Ignore build and test binaries.\nbin/\n"
},
{
"path": "chapter/14/petstore-operator/.gitignore",
"chars": 367,
"preview": "\n# Binaries for programs and plugins\n*.exe\n*.exe~\n*.dll\n*.so\n*.dylib\nbin\ntestbin/*\n\n# Test binary, build with `go test -"
},
{
"path": "chapter/14/petstore-operator/Dockerfile",
"chars": 797,
"preview": "# Build the manager binary\nFROM golang:1.17 as builder\n\nWORKDIR /workspace\n# Copy the Go Modules manifests\nCOPY go.mod g"
},
{
"path": "chapter/14/petstore-operator/Makefile",
"chars": 9857,
"preview": "# VERSION defines the project version for the bundle.\n# Update this value when you upgrade the version of your project.\n"
},
{
"path": "chapter/14/petstore-operator/PROJECT",
"chars": 476,
"preview": "domain: example.com\nlayout:\n- go.kubebuilder.io/v3\nplugins:\n manifests.sdk.operatorframework.io/v2: {}\n scorecard.sdk."
},
{
"path": "chapter/14/petstore-operator/Tiltfile",
"chars": 451,
"preview": "# build and deploy the petstore service the controller will use to store pets\nk8s_yaml(\"./config/petstore-service/servic"
},
{
"path": "chapter/14/petstore-operator/api/v1alpha1/groupversion_info.go",
"chars": 1235,
"preview": "/*\nCopyright 2022.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in "
},
{
"path": "chapter/14/petstore-operator/api/v1alpha1/pet_types.go",
"chars": 1903,
"preview": "/*\nCopyright 2022.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in "
},
{
"path": "chapter/14/petstore-operator/api/v1alpha1/zz_generated.deepcopy.go",
"chars": 3194,
"preview": "//go:build !ignore_autogenerated\n// +build !ignore_autogenerated\n\n/*\nCopyright 2022.\n\nLicensed under the Apache License,"
},
{
"path": "chapter/14/petstore-operator/client/client.go",
"chars": 6227,
"preview": "// Client provides an API client to the petstore service.\npackage client\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"io\"\n\t\"time\"\n\n\t\"gi"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/errors/errors.go",
"chars": 1350,
"preview": "// Package errors is a replacement for the golang standard library \"errors\". This replacement\n// adds errors to the Open"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/log/log.go",
"chars": 8606,
"preview": "/*\nPackage log is a replacement for the standard library log package that\nlogs to OTEL spans contained in Context object"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/storage/mem/mem.go",
"chars": 10180,
"preview": "// Package mem contains an in-memory storage implementation of storage.Data.\n// This is great for unit tests and demos. "
},
{
"path": "chapter/14/petstore-operator/client/internal/server/storage/mem/mem_test.go",
"chars": 4326,
"preview": "package mem\n\nimport (\n\t\"context\"\n\t\"sort\"\n\t\"strconv\"\n\t\"testing\"\n\n\t\"github.com/kylelemons/godebug/pretty\"\n\tdpb \"google.gol"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/storage/storage.go",
"chars": 2438,
"preview": "package storage\n\nimport (\n\t\"context\"\n\t\"strings\"\n\t\"time\"\n\n\tdpb \"google.golang.org/genproto/googleapis/type/date\"\n\n\t\"githu"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/telemetry/metrics/metrics.go",
"chars": 7314,
"preview": "/*\nPackage metrics provides setup of metrics that can be used internally to measure various application states.\nAll metr"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/telemetry/metrics/start.go",
"chars": 2049,
"preview": "package metrics\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\t\"go.opentelemetry.io/otel\"\n\t\"go.opentelemetry.io/otel/exporters/ot"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/telemetry/tracing/sampler/sampler.go",
"chars": 3101,
"preview": "/*\nPackage sampler offers a Sampler that looks for a TraceID.Valid() == true or a gRPC metadata key called \"trace\"\nand i"
},
{
"path": "chapter/14/petstore-operator/client/internal/server/telemetry/tracing/tracing.go",
"chars": 4700,
"preview": "/*\nPackage tracing provides functions for starting and stopping our Open Telemetry tracing.\nThis package is intended to "
},
{
"path": "chapter/14/petstore-operator/client/proto/buf.gen.yaml",
"chars": 154,
"preview": "version: v1\nplugins:\n - name: go\n out: ./\n opt:\n - paths=source_relative\n - name: go-grpc\n out: ./\n o"
},
{
"path": "chapter/14/petstore-operator/client/proto/buf.yaml",
"chars": 109,
"preview": "version: v1\ndeps:\n - buf.build/googleapis/googleapis\nlint:\n use:\n - DEFAULT\nbreaking:\n use:\n - FILE\n"
},
{
"path": "chapter/14/petstore-operator/client/proto/petstore.pb.go",
"chars": 33907,
"preview": "// Code generated by protoc-gen-go. DO NOT EDIT.\n// versions:\n// \tprotoc-gen-go v1.25.0-devel\n// \tprotoc v3.18.0\n"
},
{
"path": "chapter/14/petstore-operator/client/proto/petstore.proto",
"chars": 3001,
"preview": "syntax = \"proto3\";\n\npackage petstore;\n\noption go_package = \"github.com/PacktPublishing/Go-for-DevOps/proto\";\n\nimport \"go"
},
{
"path": "chapter/14/petstore-operator/client/proto/petstore_grpc.pb.go",
"chars": 9648,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n\npackage proto\n\nimport (\n\tcontext \"context\"\n\tgrpc \"google.golang.o"
},
{
"path": "chapter/14/petstore-operator/config/crd/bases/petstore.example.com_pets.yaml",
"chars": 2474,
"preview": "---\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n annotations:\n controller-gen.kubeb"
},
{
"path": "chapter/14/petstore-operator/config/crd/kustomization.yaml",
"chars": 904,
"preview": "# This kustomization.yaml is not intended to be run by itself,\n# since it depends on service name and namespace that are"
},
{
"path": "chapter/14/petstore-operator/config/crd/kustomizeconfig.yaml",
"chars": 506,
"preview": "# This file is for teaching kustomize how to substitute name and namespace reference in CRD\nnameReference:\n- kind: Servi"
},
{
"path": "chapter/14/petstore-operator/config/crd/patches/cainjection_in_pets.yaml",
"chars": 288,
"preview": "# The following patch adds a directive for certmanager to inject CA into the CRD\napiVersion: apiextensions.k8s.io/v1\nkin"
},
{
"path": "chapter/14/petstore-operator/config/crd/patches/webhook_in_pets.yaml",
"chars": 394,
"preview": "# The following patch enables a conversion webhook for the CRD\napiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceD"
},
{
"path": "chapter/14/petstore-operator/config/default/kustomization.yaml",
"chars": 2556,
"preview": "# Adds namespace to all resources.\nnamespace: petstore-operator-system\n\n# Value of this field is prepended to the\n# name"
},
{
"path": "chapter/14/petstore-operator/config/default/manager_auth_proxy_patch.yaml",
"chars": 963,
"preview": "# This patch inject a sidecar container which is a HTTP proxy for the\n# controller manager, it performs RBAC authorizati"
},
{
"path": "chapter/14/petstore-operator/config/default/manager_config_patch.yaml",
"chars": 478,
"preview": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n name: controller-manager\n namespace: system\nspec:\n template:\n spec"
},
{
"path": "chapter/14/petstore-operator/config/manager/controller_manager_config.yaml",
"chars": 256,
"preview": "apiVersion: controller-runtime.sigs.k8s.io/v1alpha1\nkind: ControllerManagerConfig\nhealth:\n healthProbeBindAddress: :808"
},
{
"path": "chapter/14/petstore-operator/config/manager/kustomization.yaml",
"chars": 163,
"preview": "resources:\n- manager.yaml\n\ngeneratorOptions:\n disableNameSuffixHash: true\n\nconfigMapGenerator:\n- name: manager-config\n "
},
{
"path": "chapter/14/petstore-operator/config/manager/manager.yaml",
"chars": 1508,
"preview": "apiVersion: v1\nkind: Namespace\nmetadata:\n labels:\n control-plane: controller-manager\n name: system\n---\napiVersion: "
},
{
"path": "chapter/14/petstore-operator/config/manifests/kustomization.yaml",
"chars": 1189,
"preview": "# These resources constitute the fully configured set of manifests\n# used to generate the 'manifests/' directory in a bu"
},
{
"path": "chapter/14/petstore-operator/config/petstore-service/service.yaml",
"chars": 831,
"preview": "---\napiVersion: v1\nkind: Namespace\nmetadata:\n name: petstore\n---\napiVersion: v1\nkind: Service\nmetadata:\n name: petstor"
},
{
"path": "chapter/14/petstore-operator/config/prometheus/kustomization.yaml",
"chars": 26,
"preview": "resources:\n- monitor.yaml\n"
},
{
"path": "chapter/14/petstore-operator/config/prometheus/monitor.yaml",
"chars": 491,
"preview": "\n# Prometheus Monitor Service (Metrics)\napiVersion: monitoring.coreos.com/v1\nkind: ServiceMonitor\nmetadata:\n labels:\n "
},
{
"path": "chapter/14/petstore-operator/config/rbac/auth_proxy_client_clusterrole.yaml",
"chars": 150,
"preview": "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: metrics-reader\nrules:\n- nonResourceURLs:\n "
},
{
"path": "chapter/14/petstore-operator/config/rbac/auth_proxy_role.yaml",
"chars": 280,
"preview": "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: proxy-role\nrules:\n- apiGroups:\n - authenti"
},
{
"path": "chapter/14/petstore-operator/config/rbac/auth_proxy_role_binding.yaml",
"chars": 268,
"preview": "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: proxy-rolebinding\nroleRef:\n apiGrou"
},
{
"path": "chapter/14/petstore-operator/config/rbac/auth_proxy_service.yaml",
"chars": 286,
"preview": "apiVersion: v1\nkind: Service\nmetadata:\n labels:\n control-plane: controller-manager\n name: controller-manager-metric"
},
{
"path": "chapter/14/petstore-operator/config/rbac/kustomization.yaml",
"chars": 693,
"preview": "resources:\n# All RBAC will be applied under this service account in\n# the deployment namespace. You may comment out this"
},
{
"path": "chapter/14/petstore-operator/config/rbac/leader_election_role.yaml",
"chars": 476,
"preview": "# permissions to do leader election.\napiVersion: rbac.authorization.k8s.io/v1\nkind: Role\nmetadata:\n name: leader-electi"
},
{
"path": "chapter/14/petstore-operator/config/rbac/leader_election_role_binding.yaml",
"chars": 274,
"preview": "apiVersion: rbac.authorization.k8s.io/v1\nkind: RoleBinding\nmetadata:\n name: leader-election-rolebinding\nroleRef:\n apiG"
},
{
"path": "chapter/14/petstore-operator/config/rbac/pet_editor_role.yaml",
"chars": 365,
"preview": "# permissions for end users to edit pets.\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: p"
},
{
"path": "chapter/14/petstore-operator/config/rbac/pet_viewer_role.yaml",
"chars": 322,
"preview": "# permissions for end users to view pets.\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n name: p"
},
{
"path": "chapter/14/petstore-operator/config/rbac/role.yaml",
"chars": 462,
"preview": "---\napiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRole\nmetadata:\n creationTimestamp: null\n name: manager-role\n"
},
{
"path": "chapter/14/petstore-operator/config/rbac/role_binding.yaml",
"chars": 272,
"preview": "apiVersion: rbac.authorization.k8s.io/v1\nkind: ClusterRoleBinding\nmetadata:\n name: manager-rolebinding\nroleRef:\n apiGr"
},
{
"path": "chapter/14/petstore-operator/config/rbac/service_account.yaml",
"chars": 93,
"preview": "apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: controller-manager\n namespace: system\n"
},
{
"path": "chapter/14/petstore-operator/config/samples/kustomization.yaml",
"chars": 157,
"preview": "## Append samples you want in your CSV to this file as resources ##\nresources:\n- petstore_v1alpha1_pet.yaml\n#+kubebuilde"
},
{
"path": "chapter/14/petstore-operator/config/samples/petstore_v1alpha1_pet.yaml",
"chars": 300,
"preview": "---\napiVersion: petstore.example.com/v1alpha1\nkind: Pet\nmetadata:\n name: pet-sample1\nspec:\n name: Thor\n type: dog\n b"
},
{
"path": "chapter/14/petstore-operator/config/scorecard/bases/config.yaml",
"chars": 134,
"preview": "apiVersion: scorecard.operatorframework.io/v1alpha3\nkind: Configuration\nmetadata:\n name: config\nstages:\n- parallel: tru"
},
{
"path": "chapter/14/petstore-operator/config/scorecard/kustomization.yaml",
"chars": 383,
"preview": "resources:\n- bases/config.yaml\npatchesJson6902:\n- path: patches/basic.config.yaml\n target:\n group: scorecard.operato"
},
{
"path": "chapter/14/petstore-operator/config/scorecard/patches/basic.config.yaml",
"chars": 231,
"preview": "- op: add\n path: /stages/0/tests/-\n value:\n entrypoint:\n - scorecard-test\n - basic-check-spec\n image: quay"
},
{
"path": "chapter/14/petstore-operator/config/scorecard/patches/olm.config.yaml",
"chars": 1205,
"preview": "- op: add\n path: /stages/0/tests/-\n value:\n entrypoint:\n - scorecard-test\n - olm-bundle-validation\n image:"
},
{
"path": "chapter/14/petstore-operator/controllers/pet_controller.go",
"chars": 7021,
"preview": "/*\nCopyright 2022.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in "
},
{
"path": "chapter/14/petstore-operator/controllers/suite_test.go",
"chars": 2270,
"preview": "/*\nCopyright 2022.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in "
},
{
"path": "chapter/14/petstore-operator/go.mod",
"chars": 4615,
"preview": "module github.com/PacktPublishing/Go-for-DevOps/chapter/14/petstore-operator\n\ngo 1.17\n\nrequire (\n\tgithub.com/biogo/store"
},
{
"path": "chapter/14/petstore-operator/go.sum",
"chars": 119862,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
},
{
"path": "chapter/14/petstore-operator/hack/boilerplate.go.txt",
"chars": 546,
"preview": "/*\nCopyright 2022.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in "
},
{
"path": "chapter/14/petstore-operator/main.go",
"chars": 3250,
"preview": "/*\nCopyright 2022.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in "
},
{
"path": "chapter/14/workloads/Readme.md",
"chars": 1246,
"preview": "# Interacting with Kubernetes Workloads\nIn this example, we'll explore how to interact with the Kubernetes API using a G"
},
{
"path": "chapter/14/workloads/go.mod",
"chars": 1791,
"preview": "module github.com/Go-for-DevOps/chapter/14/workloads\n\ngo 1.17\n\nrequire (\n\tgithub.com/Azure/go-autorest/autorest/to v0.4."
},
{
"path": "chapter/14/workloads/go.sum",
"chars": 61886,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
},
{
"path": "chapter/14/workloads/kind-config.yaml",
"chars": 414,
"preview": "kind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n - role: control-plane\n kubeadmConfigPatches:\n - |\n "
},
{
"path": "chapter/14/workloads/main.go",
"chars": 7282,
"preview": "package main\n\nimport (\n\t\"context\"\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"os/signal\"\n\t\"path\"\n\t\"path/filepath\"\n\t\"syscall\"\n\t\"time\"\n\n\t\"githu"
},
{
"path": "chapter/15/.gitignore",
"chars": 14,
"preview": ".env\n.ssh\nbin\n"
},
{
"path": "chapter/15/cloud-init/init.yml",
"chars": 98,
"preview": "#cloud-config\npackage_upgrade: true\npackages:\n - nginx\n - golang\nruncmd:\n - echo \"hello world\"\n"
},
{
"path": "chapter/15/cmd/compute/main.go",
"chars": 1101,
"preview": "package main\n\nimport (\n\t\"bufio\"\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\t\"strings\"\n\n\t\"github.com/joho/godotenv\"\n\n\t\"github.com/PacktPubli"
},
{
"path": "chapter/15/cmd/storage/main.go",
"chars": 2302,
"preview": "package main\n\nimport (\n\t\"bufio\"\n\t\"context\"\n\t\"fmt\"\n\t\"io/ioutil\"\n\t\"os\"\n\t\"path\"\n\t\"time\"\n\n\t\"github.com/Azure/azure-sdk-for-g"
},
{
"path": "chapter/15/go.mod",
"chars": 1344,
"preview": "module github.com/PacktPublishing/Go-for-DevOps/chapter/15\n\ngo 1.18\n\nrequire (\n\tgithub.com/Azure/azure-sdk-for-go/sdk/az"
},
{
"path": "chapter/15/go.sum",
"chars": 7142,
"preview": "github.com/Azure/azure-sdk-for-go/sdk/azcore v0.23.0 h1:D7l5jspkc4kwBYRWoZE4DQnu6LVpLwDsMZjBKS4wZLQ=\ngithub.com/Azure/az"
}
]
// ... and 158 more files (download for full content)
About this extraction
This page contains the full source code of the PacktPublishing/Go-for-DevOps GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 358 files (15.4 MB), approximately 691.0k tokens, and a symbol index with 2477 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.