Srikanth Chekuri 210c5fd7f2
feat: opamp server application (#1787)
* feat: opamp server application

* chore: opamp

* chore: refactor server implementation

* chore: add Stop

* chore: merged opamp updates

* chore: removed all errorf

* chore: added a comment about zero version

* feat: added user context for created by

* chore: changed debugf to debug

* chore: removed lb from opamp + added config parser

* fix: added userid to ConfigNewVersion()

* chore: removed user id from contxt and added config parser

* fix: removed lock inside re-deploy

* chore: added config db fix

* fix: merged app/server.go from develop

* fix: restored extract jwt

* Update pkg/query-service/app/server.go

Co-authored-by: Nityananda Gohain <nityanandagohain@gmail.com>

* fix: dependency version fix and import added

---------

Co-authored-by: Pranay Prateek <pranay@signoz.io>
Co-authored-by: Palash Gupta <palashgdev@gmail.com>
Co-authored-by: mindhash <mindhash@mindhashs-MacBook-Pro.local>
Co-authored-by: Nityananda Gohain <nityanandagohain@gmail.com>
2023-03-15 15:09:15 +05:30

70 lines
1.8 KiB
Go

package agentConf
import (
"time"
"github.com/google/uuid"
)
type ElementTypeDef string
const (
ElementTypeSamplingRules ElementTypeDef = "sampling_rules"
ElementTypeDropRules ElementTypeDef = "drop_rules"
ElementTypeLogPipelines ElementTypeDef = "log_pipelines"
ElementTypeLbExporter ElementTypeDef = "lb_exporter"
)
type DeployStatus string
const (
PendingDeploy DeployStatus = "DIRTY"
Deploying DeployStatus = "DEPLOYING"
Deployed DeployStatus = "DEPLOYED"
DeployInitiated DeployStatus = "IN_PROGRESS"
DeployFailed DeployStatus = "FAILED"
)
type ConfigVersion struct {
ID string `json:"id" db:"id"`
Version int `json:"version" db:"version"`
ElementType ElementTypeDef `json:"elementType" db:"element_type"`
Active bool `json:"active" db:"active"`
IsValid bool `json:"is_valid" db:"is_valid"`
Disabled bool `json:"disabled" db:"disabled"`
DeployStatus DeployStatus `json:"deployStatus" db:"deploy_status"`
DeployResult string `json:"deployResult" db:"deploy_result"`
LastHash string `json:"lastHash" db:"last_hash"`
LastConf string `json:"lastConf" db:"last_config"`
CreatedBy string `json:"createdBy" db:"created_by"`
CreatedByName string `json:"createdByName" db:"created_by_name"`
CreatedAt time.Time `json:"createdAt" db:"created_at"`
}
func NewConfigversion(typeDef ElementTypeDef) *ConfigVersion {
return &ConfigVersion{
ID: uuid.NewString(),
ElementType: typeDef,
Active: false,
IsValid: false,
Disabled: false,
DeployStatus: PendingDeploy,
// todo: get user id from context?
// CreatedBy
}
}
func updateVersion(v int) int {
return v + 1
}
type ConfigElements struct {
VersionID string
Version int
ElementType ElementTypeDef
ElementId string
}