Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/devopscorner/golang-bedrock
AWS Summit 2024 Jakarta --- ObservabilityAI: Memanfaatkan Amazon Bedrock Untuk Memantau Kinerja RESTful API Golang
https://github.com/devopscorner/golang-bedrock
amazon-bedrock amazon-bedrock-agents anthropic anthropic-claude aws devops devopscorner eks generative-ai golang kubernetes observability opentelemetry opentelemetry-collector restful restful-api
Last synced: 10 days ago
JSON representation
AWS Summit 2024 Jakarta --- ObservabilityAI: Memanfaatkan Amazon Bedrock Untuk Memantau Kinerja RESTful API Golang
- Host: GitHub
- URL: https://github.com/devopscorner/golang-bedrock
- Owner: devopscorner
- License: apache-2.0
- Created: 2024-08-26T09:13:21.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2024-12-11T17:15:48.000Z (2 months ago)
- Last Synced: 2025-01-30T18:48:11.631Z (19 days ago)
- Topics: amazon-bedrock, amazon-bedrock-agents, anthropic, anthropic-claude, aws, devops, devopscorner, eks, generative-ai, golang, kubernetes, observability, opentelemetry, opentelemetry-collector, restful, restful-api
- Language: Python
- Homepage: https://devopscorner.id
- Size: 7.25 MB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Golang RESTful API with Amazon Bedrock
ObservabilityAI: Memanfaatkan Amazon Bedrock Untuk Memantau Kinerja RESTful API Golang
[](https://goreportcard.com/badge/github.com/devopscorner/golang-bedrock/src)
[](https://github.com/devopscorner/golang-bedrock/graphs/contributors)
[](https://github.com/devopscorner/golang-bedrock/releases)
[](https://hub.docker.com/r/devopscorner/golang-bedrock/)




[](https://github.com/devopscorner/golang-bedrock/issues)
[](https://github.com/devopscorner/golang-bedrock/pulls)
[](https://github.com/devopscorner/golang-bedrock/fork)
[](https://github.com/devopscorner/golang-bedrock/stargazers)
[](https://img.shields.io/github/license/devopscorner/golang-bedrock)---
## Available Tags
### Alpine GOLANG
| Image name | Size |
|------------|------|
| `devopscorner/golang-bedrock:latest` | [](https://hub.docker.com/repository/docker/devopscorner/golang-bedrock/tags?page=1&ordering=last_updated&name=latest)   |
| `devopscorner/golang-bedrock:alpine` | [](https://hub.docker.com/repository/docker/devopscorner/golang-bedrock/tags?page=1&ordering=last_updated&name=alpine)  |
| `devopscorner/golang-bedrock:alpine-latest` | [](https://hub.docker.com/repository/docker/devopscorner/golang-bedrock/tags?page=1&ordering=last_updated&name=alpine-latest) |
| `devopscorner/golang-bedrock:alpine-3.18` | [](https://hub.docker.com/repository/docker/devopscorner/golang-bedrock/tags?page=1&ordering=last_updated&name=alpine-3.18) |---
## GO Repository Pattern
- Folder Structure
```
.
├── cmd
│ └── migrate_file_upload.go
├── config
│ ├── config.go
│ ├── const.go
│ ├── logger.go
│ └── value.go
├── controller
│ ├── file_controller.go
│ └── login_controller.go
├── driver
│ ├── db.go
│ ├── mysql.go
│ ├── psql.go
│ └── sqlite.go
├── go.mod
├── go.sum
├── golang-bedrock.db
├── .env.example
├── main.go
├── middleware
│ └── auth_middleware.go
├── model
│ └── file.go
├── repository
│ └── file_repository.go
├── routes
│ ├── file_routes.go
│ └── main_routes.go
├── utility
│ ├── bedrock.go
│ ├── genid.go
│ ├── loki.go
│ ├── otel.go
│ ├── prometheus.go
│ └── s3.go
└── view
├── error_view.go
├── file_view.go
└── login_view.go11 directories, 30 files
```## Coverages:
### AWS Services
- Amazon Elastic Container Registry (ECR)
- Amazon EKS### Others:
- Docker
- Docker-Compose
- Prometheus
- Loki
- Fluentbit
- OpenTelemetry
- Golang
- HelmChart
- Postman
- Terraform## Environment Variables
- Default Value
```
GIN_MODE=release
APP_URL=http://0.0.0.0
APP_PORT=8080AWS_REGION=us-west-2
AWS_ACCESS_KEY=YOUR_AWS_KEY
AWS_SECRET_KEY_ID=YOUR_SECRET_KEY
AWS_BUCKET_NAME=devopscorner-bedrockJWT_AUTH_USERNAME=devopscorner
JWT_AUTH_PASSWORD=DevOpsCorner2024
JWT_SECRET=s3cr3tLOG_LEVEL=INFO
```- Multi Driver Connection
```
# default
DB_CONNECTION=sqlite
---
Available for:
- sqlite
- mysql
- postgres
```- AWS X-Ray (AWS Distribution Tracing System)
- `XRAY_VERSION`: Daemon Version X-Ray
- `latest`: Use the latest version of the AWS X-Ray daemon available.
- `3.x`: Use version 3.x of the AWS X-Ray daemon.
- `2.x`: Use version 2.x of the AWS X-Ray daemon.
- `1.x`: Use version 1.x of the AWS X-Ray daemon.- `XRAY_DAEMON_ENDPOINT: Daemon Endpoint of X-Ray
```
XRAY_DAEMON_ENDPOINT=http://localhost:2000
```
- `XRAY_DAEMON_PORT: Daemon Endpoint Port of X-Ray
```
XRAY_DAEMON_PORT=2000
```- Prometheus
```
PROMETHEUS_ENDPOINT=http://localhost:9090
PROMETHEUS_PORT=9090
```- Loki
```
LOKI_ENDPOINT=http://0.0.0.0:3100
LOKI_PORT=3100
```- Grafana
```
GRAFANA_ENDPOINT=http://localhost:3000
GRAFANA_PORT=3000
GRAFANA_API_KEY=YOUR_GRAFANA_API_KEY
```- OpenTelemetry
```
OTEL_INSTRUMENTATION_METRIC_ENABLED=true
OTEL_INSTRUMENTATION_TRACE_ENABLED=true
OTEL_INSTRUMENTATION_LOG_ENABLED=true# Trace Type: xray / jaeger
OTEL_INSTRUMENTATION_TRACE_NAME=jaegerOTEL_ENVIRONMENT=nonprod
OTEL_SERVICE_NAME=golang-bedrock
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317
OTEL_EXPORTER_OTLP_PORT=4317
OTEL_EXPORTER_OTLP_INSECURE=true
OTEL_EXPORTER_OTLP_HEADERS=
OTEL_RESOURCE_ATTRIBUTES=
```- Jaeger Environment
- `JAEGER_SERVICE_NAME`: The name of the service being instrumented (`JAEGER_SERVICE_NAME` = `OTEL_SERVICE_NAME`).
- `JAEGER_AGENT_HOST`: The host name or IP address of the Jaeger agent to use for sending trace data.
- `JAEGER_AGENT_PORT`: The port number of the Jaeger agent to use for sending trace data.
- `JAEGER_SAMPLER_TYPE`: The type of sampling to use for tracing (e.g. const, probabilistic, rateLimiting, remote).
- `JAEGER_SAMPLER_PARAM`: The parameter value to use for the selected sampler type.
- `JAEGER_SAMPLER_MANAGER_HOST_PORT`: The host name and port of the remote sampling manager to use (if using remote sampling).
- `JAEGER_REPORTER_LOG_SPANS`: Whether to log spans instead of sending them to a Jaeger agent (e.g. true or false).
- `JAEGER_REPORTER_MAX_QUEUE_SIZE`: The maximum number of spans that can be queued before they are sent to a Jaeger agent.
- `JAEGER_REPORTER_FLUSH_INTERVAL`: The interval at which to flush the span queue and send spans to a Jaeger agent (e.g. 1 * time.Second).
- `JAEGER_REPORTER_LOCAL_AGENT_HOST_PORT`: The host and port of the local Jaeger agent, if using UDP instead of HTTP.
- `JAEGER_REPORTER_COLLECTOR_ENDPOINT`: The endpoint URL of the Jaeger collector (e.g. `http://localhost:14268/api/traces`).
- `JAEGER_REPORTER_COLLECTOR_USER`: The username for authenticating with the Jaeger collector, if required.
- `JAEGER_REPORTER_COLLECTOR_PASSWORD`: The password for authenticating with the Jaeger collector, if required.
- `JAEGER_TAGS`: Additional tags to attach to the trace (e.g. key1=value1,key2=value2).## Tested Environment
### Versioning
- Docker version
```
docker versionClient:
Version: 27.1.1-rd
API version: 1.46
Go version: go1.21.12
Git commit: cdc3063
Built: Wed Jul 24 17:06:24 2024
OS/Arch: darwin/arm64
Context: default
```- Docker-Compose version
```
docker-compose -v
---
Docker Compose version v2.29.1
```- AWS Cli
```
aws --version
---
aws-cli/2.9.16 Python/3.9.11 Darwin/23.6.0 exe/x86_64 prompt/off
```- Terraform Cli
```
terraform version
---
Terraform v1.8.4
on darwin_arm64
- provider registry.terraform.io/hashicorp/aws v3.74.3
- provider registry.terraform.io/hashicorp/local v2.1.0
- provider registry.terraform.io/hashicorp/null v3.1.0
- provider registry.terraform.io/hashicorp/random v3.1.0
- provider registry.terraform.io/hashicorp/time v0.7.2
```- OpenTofu Cli
```
tofu --version ─╯
---
OpenTofu v1.7.3
on darwin_arm64
```- Terraform / OpenTofu / Terragrunt Environment Cli
```
tenv --version ─╯
---
tenv version 3.1.0
```- Golang Version Manager (GVM)
```
gvm version
---
Go Version Manager v1.0.22 installed at /Users/devopscorner/.gvm
```- Golang Version
```
go version
---
go version go1.21.4 darwin/arm64
```## Security Check
Make sure that you didn't push sensitive information in this repository
- [ ] AWS Credentials (AWS_ACCESS_KEY, AWS_SECRET_KEY)
- [ ] AWS Account ID
- [ ] AWS Resources ARN
- [ ] Username & Password
- [ ] Private (id_rsa) & Public Key (id_rsa.pub)
- [ ] DNS Zone ID
- [ ] APP & API Key## Copyright
- Author: **Dwi Fahni Denni (@zeroc0d3)**
- Vendor: **DevOps Corner Indonesia (devopscorner.id)**
- License: **Apache v2**