Skip to content

Commit 608bd08

Browse files
committed
WIP: feat(monitoring): support Dynatrace OpenTelemetry configuration
- add Generic and Dynatrace integration type switching - configure Dynatrace OAuth2 credentials and TLS options - validate masked secrets and conflicting Authorization headers - preserve type-specific settings and hide unsupported metrics
1 parent 9f8b234 commit 608bd08

5 files changed

Lines changed: 269 additions & 20 deletions

File tree

src/i18n/MonitoringIntegration.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,46 @@ For example, <code> {'{'} Authorization = "some-authz-tokens"{'}'}</code>`,
143143
zh: '服务地址',
144144
en: 'Endpoint',
145145
},
146+
openTelemetryType: {
147+
zh: 'OpenTelemetry 类型',
148+
en: 'OpenTelemetry Type',
149+
},
150+
generic: {
151+
zh: '通用',
152+
en: 'Generic',
153+
},
154+
oauth2Authentication: {
155+
zh: 'OAuth2 认证',
156+
en: 'OAuth2 Authentication',
157+
},
158+
tokenEndpoint: {
159+
zh: '令牌端点',
160+
en: 'Token Endpoint',
161+
},
162+
clientID: {
163+
zh: '客户端 ID',
164+
en: 'Client ID',
165+
},
166+
clientSecret: {
167+
zh: '客户端密钥',
168+
en: 'Client Secret',
169+
},
170+
authorizationHeaderConflict: {
171+
zh: 'OAuth2 会自动设置 Authorization 请求头,请删除手动配置的 Authorization 请求头',
172+
en: 'OAuth2 sets the Authorization header automatically. Remove the manually configured Authorization header.',
173+
},
174+
resource: {
175+
zh: '资源',
176+
en: 'Resource',
177+
},
178+
scope: {
179+
zh: '作用域',
180+
en: 'Scope',
181+
},
182+
timeout: {
183+
zh: '超时时间',
184+
en: 'Timeout',
185+
},
146186
exportInterval: {
147187
zh: '导出间隔',
148188
// Must have a space at the beginning

src/types/dashboard.d.ts

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { NodeStatus } from './enum'
2-
import { OpentelemetryOpentelemetry } from './schemas/monitor.schemas'
2+
import type { OpenTelemetryLogs, OpenTelemetryMetrics, OpenTelemetryTraces } from './typeAlias'
33
import { SSL } from './common'
44

55
export interface CounterItem {
@@ -78,14 +78,47 @@ export interface StatsD {
7878
server: string
7979
}
8080

81-
export type OpenTelemetry = Omit<OpentelemetryOpentelemetry, 'exporter'> & {
81+
export type OpenTelemetryType = 'generic' | 'dynatrace'
82+
83+
export interface OpenTelemetryExporter {
84+
endpoint?: string
85+
ssl_options?: SSL
86+
headers?: Record<string, string>
87+
}
88+
89+
export interface DynatraceOAuth2 {
90+
kind: 'dynatrace_oauth2'
91+
enable: true
92+
grant_type: 'client_credentials'
93+
token_endpoint: string
94+
client_id: string
95+
client_secret: string
96+
resource: string
97+
scope?: string
98+
timeout?: string
99+
ssl?: SSL
100+
}
101+
102+
export interface GenericOpenTelemetry {
103+
type: 'generic'
104+
exporter?: OpenTelemetryExporter
105+
logs?: OpenTelemetryLogs
106+
metrics?: OpenTelemetryMetrics
107+
traces?: OpenTelemetryTraces
108+
}
109+
110+
export interface DynatraceOpenTelemetry {
111+
type: 'dynatrace'
82112
exporter?: {
83-
endpoint?: string
84-
ssl_options?: SSL
85-
headers?: Record<string, string>
86-
}
113+
auth: DynatraceOAuth2
114+
} & OpenTelemetryExporter
115+
logs?: OpenTelemetryLogs
116+
metrics?: never
117+
traces?: OpenTelemetryTraces
87118
}
88119

120+
export type OpenTelemetry = GenericOpenTelemetry | DynatraceOpenTelemetry
121+
89122
export interface Alarm {
90123
node: string
91124
name: string

src/types/typeAlias.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ import type {
8383
SchemaRegistryGetProtobuf,
8484
SchemaRegistryPostExternalHttp,
8585
} from './schemas/schemaRegistry.schemas'
86-
import type { OpentelemetryE2eTracingOptions } from './schemas/monitor.schemas'
86+
import type {
87+
OpentelemetryE2eTracingOptions,
88+
OpentelemetryOtelLogs,
89+
OpentelemetryOtelMetrics,
90+
OpentelemetryOtelTraces,
91+
} from './schemas/monitor.schemas'
8792
import { type DashboardUser, DashboardUserMfa } from './schemas/dashboard.schemas'
8893
import {
8994
GetMtManagedNsListParams,
@@ -245,6 +250,9 @@ export type SchemaRegistryProtobufDetail = SchemaRegistryGetProtobuf
245250

246251
/* MONITOR */
247252
export type OpenTelemetryE2EConfigs = OpentelemetryE2eTracingOptions
253+
export type OpenTelemetryLogs = OpentelemetryOtelLogs
254+
export type OpenTelemetryMetrics = OpentelemetryOtelMetrics
255+
export type OpenTelemetryTraces = OpentelemetryOtelTraces
248256

249257
/* DASHBOARD */
250258
export type User = DashboardUser

0 commit comments

Comments
 (0)