From fab2899a2bad0cb0ac0eb9ac590bc7a6fb446a0c Mon Sep 17 00:00:00 2001 From: kit101 Date: Mon, 27 Dec 2021 08:44:19 +0800 Subject: [PATCH] Datadog add the tag of 'remote:gitee' --- cmd/drone-server/config/config.go | 6 ++++++ cmd/drone-server/inject_service.go | 1 + metric/sink/config.go | 1 + metric/sink/tags.go | 2 ++ 4 files changed, 10 insertions(+) diff --git a/cmd/drone-server/config/config.go b/cmd/drone-server/config/config.go index 5a6562f1..bec51172 100644 --- a/cmd/drone-server/config/config.go +++ b/cmd/drone-server/config/config.go @@ -489,6 +489,12 @@ func (c *Config) IsGitea() bool { return c.Gitea.Server != "" } +// IsGitee returns true if the Gitee integration +// is activated. +func (c *Config) IsGitee() bool { + return c.Gitee.ClientID != "" +} + // IsBitbucket returns true if the Bitbucket Cloud // integration is activated. func (c *Config) IsBitbucket() bool { diff --git a/cmd/drone-server/inject_service.go b/cmd/drone-server/inject_service.go index f844c892..6a330223 100644 --- a/cmd/drone-server/inject_service.go +++ b/cmd/drone-server/inject_service.go @@ -212,6 +212,7 @@ func provideDatadog( EnableStash: config.IsStash(), EnableGogs: config.IsGogs(), EnableGitea: config.IsGitea(), + EnableGitee: config.IsGitee(), EnableAgents: !config.Agent.Disabled, }, ) diff --git a/metric/sink/config.go b/metric/sink/config.go index 9dcac6ca..49b4dea5 100644 --- a/metric/sink/config.go +++ b/metric/sink/config.go @@ -29,5 +29,6 @@ type Config struct { EnableStash bool EnableGogs bool EnableGitea bool + EnableGitee bool EnableAgents bool } diff --git a/metric/sink/tags.go b/metric/sink/tags.go index a3666d9c..06d89c70 100644 --- a/metric/sink/tags.go +++ b/metric/sink/tags.go @@ -42,6 +42,8 @@ func createTags(config Config) []string { tags = append(tags, "remote:gogs") case config.EnableGitea: tags = append(tags, "remote:gitea") + case config.EnableGitee: + tags = append(tags, "remote:gitee") default: tags = append(tags, "remote:undefined") }