Skip to content

Commit d1d60f7

Browse files
committed
1. 兼容 promql 查询 metric, kol 查询 log, graphql 查询 trace
1 parent d6604ab commit d1d60f7

204 files changed

Lines changed: 11408 additions & 3654 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: fmt test vet run-server contract-lint contract-generate contract-check contract-breaking check-production-artifacts migrate sqlc otelcol-linux-arm64 otelcol-windows-amd64 otelcol-distributions e2e-m2-k8s e2e-m3-k8s e2e-m4-k8s e2e-m5-k8s e2e-m6-k8s e2e-m7-k8s e2e-m8-k8s release-local
1+
.PHONY: fmt test vet run-server contract-lint contract-generate contract-check contract-breaking query-parser-check query-promql-conformance query-kql-check query-skywalking-graphql-check query-tenant-schema-check check-production-artifacts migrate sqlc otelcol-linux-arm64 otelcol-windows-amd64 otelcol-distributions e2e-m2-k8s e2e-m3-k8s e2e-m4-k8s e2e-m5-k8s e2e-m6-k8s e2e-m7-k8s e2e-m8-k8s e2e-m10-query-k8s release-local
22

33
fmt:
44
rg --files cmd internal -g '*.go' | xargs gofmt -w
@@ -7,7 +7,9 @@ test:
77
go test ./...
88

99
vet:
10-
go vet ./...
10+
# Prometheus chunkenc.Iterator intentionally defines Seek(int64) ValueType;
11+
# disable stdmethods' io.Seeker signature heuristic for this interface.
12+
go vet -stdmethods=false ./...
1113

1214
run-server:
1315
go run ./cmd/argus-server
@@ -23,7 +25,7 @@ contract-generate:
2325
mkdir -p api/openapi/generated internal/gen/openapi web/packages/api-client/src/generated
2426
pnpm exec redocly bundle api/openapi/argus.yaml --output api/openapi/generated/argus.bundle.json --ext json
2527
node scripts/minify-json.mjs api/openapi/generated/argus.bundle.json
26-
@set -e; for domain in common identity authorization labels action card agent stream telemetry setup m8api platform enterpriseidentity enterpriseauthz machine audit secretapi hostapi kubernetesapi connectionapi actionapi connectorapi conversationapi modelapi workflowapi automationapi sandboxapi cardapi remoteaccessapi telemetryapi; do \
28+
@set -e; for domain in common identity authorization labels action card agent stream setup m8api platform enterpriseidentity enterpriseauthz machine audit secretapi hostapi kubernetesapi connectionapi actionapi connectorapi conversationapi modelapi workflowapi automationapi sandboxapi cardapi remoteaccessapi telemetryapi; do \
2729
pnpm exec redocly bundle api/openapi/generation/$$domain.yaml --output api/openapi/generated/$$domain.bundle.yaml --ext yaml; \
2830
mkdir -p internal/gen/openapi/$$domain; \
2931
go tool oapi-codegen -generate types,skip-prune -package $$domain -o internal/gen/openapi/$$domain/types.gen.go api/openapi/generated/$$domain.bundle.yaml; \
@@ -35,7 +37,7 @@ contract-generate:
3537
@set -e; for domain in enterpriseauthz secretapi hostapi kubernetesapi connectionapi actionapi connectorapi sandboxapi cardapi remoteaccessapi telemetryapi; do \
3638
node scripts/split-generated-go-server.mjs internal/gen/openapi/$$domain/server.gen.go; \
3739
done
38-
node scripts/generate-contract-index.mjs web/packages/api-client/src/generated/contracts.ts common identity authorization labels action card agent stream telemetry setup m8api platform enterpriseidentity enterpriseauthz machine audit secretapi hostapi kubernetesapi connectionapi actionapi connectorapi conversationapi modelapi workflowapi automationapi sandboxapi cardapi remoteaccessapi telemetryapi
40+
node scripts/generate-contract-index.mjs web/packages/api-client/src/generated/contracts.ts common identity authorization labels action card agent stream setup m8api platform enterpriseidentity enterpriseauthz machine audit secretapi hostapi kubernetesapi connectionapi actionapi connectorapi conversationapi modelapi workflowapi automationapi sandboxapi cardapi remoteaccessapi telemetryapi
3941
go tool buf generate api/proto --template api/proto/buf.gen.yaml
4042

4143
sqlc:
@@ -81,6 +83,9 @@ e2e-m7-k8s:
8183
e2e-m8-k8s:
8284
./scripts/e2e-m8-k8s.sh
8385

86+
e2e-m10-query-k8s:
87+
./scripts/e2e-m10-query-k8s.sh
88+
8489
release-local:
8590
./scripts/release-local.sh
8691

@@ -95,5 +100,21 @@ contract-breaking:
95100
echo 'origin/main has no protobuf baseline; this merge establishes it'; \
96101
fi
97102

103+
query-parser-check:
104+
./scripts/check-query-parser-lock.sh
105+
106+
query-promql-conformance:
107+
go test ./internal/telemetry/queryengine/promql -count=1
108+
go test ./internal/telemetry -run 'TestPromQLClickHouse' -count=1
109+
110+
query-kql-check:
111+
go test ./internal/telemetry/queryengine/kql -count=1
112+
113+
query-skywalking-graphql-check:
114+
go test ./internal/telemetry/queryengine/skywalking -count=1
115+
116+
query-tenant-schema-check:
117+
go test ./internal/telemetry -run 'TestTenant|TestTelemetrySchemaV3' -count=1
118+
98119
check-production-artifacts:
99120
./scripts/check-production-artifacts.sh

‎THIRD_PARTY_NOTICES.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Third-Party Notices
2+
3+
## Prometheus PromQL Parser
4+
5+
Argus uses the PromQL parser and AST packages from Prometheus:
6+
7+
- Project: Prometheus
8+
- Module: `github.com/prometheus/prometheus`
9+
- Version: `v0.314.0`
10+
- Commit: `d7598b7141418fa35be2b5ec5d0fefb634199610`
11+
- License: Apache License 2.0
12+
13+
Copyright 2012-2015 The Prometheus Authors.
14+
15+
The complete upstream license and NOTICE files are included in the locked Go
16+
module and are collected by the release SBOM process. The authoritative parser
17+
lock for this repository is `deploy/query-parsers.lock.json`.
18+
19+
## graph-gophers/graphql-go
20+
21+
Argus uses `github.com/graph-gophers/graphql-go` version `v1.10.2` as the
22+
schema-first runtime for the read-only SkyWalking-compatible trace query
23+
surface. The module is distributed under the MIT License; its complete license
24+
text is retained in the locked Go module and collected by the release SBOM
25+
process.
26+
27+
Argus also uses the executable-document AST parser from
28+
`github.com/graphql-go/graphql` version `v0.8.1` to apply request-specific
29+
field-count, fragment-cycle, read-only and introspection checks before the
30+
fixed SDL runtime executes a query. That module is also distributed under the
31+
MIT License.

‎api/contracts/error-codes.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ codes:
146146
TELEMETRY_INGEST_LIMIT_EXCEEDED: {http_status: 429, message_key: errors.telemetry.ingest_limit_exceeded, retryable: true}
147147
TELEMETRY_SCHEMA_UNSUPPORTED: {http_status: 422, message_key: errors.telemetry.schema_unsupported, retryable: false}
148148
TELEMETRY_BACKPRESSURE: {http_status: 503, message_key: errors.telemetry.backpressure, retryable: true}
149-
TELEMETRY_QUERY_BUDGET_EXCEEDED: {http_status: 422, message_key: errors.telemetry.query_budget_exceeded, retryable: false}
149+
QUERY_BUDGET_EXCEEDED: {http_status: 413, message_key: errors.telemetry.query_budget_exceeded, retryable: false}
150150
TELEMETRY_SIGNAL_FORBIDDEN: {http_status: 403, message_key: errors.telemetry.signal_forbidden, retryable: false}
151151
TELEMETRY_FIELD_FORBIDDEN: {http_status: 403, message_key: errors.telemetry.field_forbidden, retryable: false}
152152
TELEMETRY_DEPENDENCY_UNAVAILABLE: {http_status: 503, message_key: errors.telemetry.dependency_unavailable, retryable: true}

‎api/openapi/argus.yaml‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -307,14 +307,16 @@ paths:
307307
$ref: ./paths/m7.yaml#/binding_preview
308308
/enterprise/telemetry/usage:
309309
$ref: ./paths/m7.yaml#/usage_item
310-
/enterprise/telemetry/query/metrics:
311-
$ref: ./paths/m7.yaml#/metrics_query
312-
/enterprise/telemetry/query/logs:
313-
$ref: ./paths/m7.yaml#/logs_query
314-
/enterprise/telemetry/query/traces:
315-
$ref: ./paths/m7.yaml#/traces_query
316310
/enterprise/telemetry/query/overview:
317311
$ref: ./paths/m7.yaml#/overview_query
312+
/enterprise/metrics/query:
313+
$ref: ./paths/m7.yaml#/metrics_query
314+
/enterprise/metrics/query_range:
315+
$ref: ./paths/m7.yaml#/metrics_query_range
316+
/enterprise/logs/query:
317+
$ref: ./paths/m7.yaml#/logs_query
318+
/enterprise/traces/graphql:
319+
$ref: ./paths/m7.yaml#/traces_graphql
318320
/enterprise/hosts/{id}/collector:
319321
$ref: ./paths/m7.yaml#/host_collector_item
320322
/enterprise/hosts/{id}/collector/actions/preview-{action}:
@@ -471,12 +473,6 @@ components:
471473
$ref: ./components/m7.yaml#/components/schemas/CollectionClaim
472474
KubernetesNodeHostBinding:
473475
$ref: ./components/m7.yaml#/components/schemas/KubernetesNodeHostBinding
474-
MetricsResult:
475-
$ref: ./components/m7.yaml#/components/schemas/MetricsResult
476-
LogsResult:
477-
$ref: ./components/m7.yaml#/components/schemas/LogsResult
478-
TracesResult:
479-
$ref: ./components/m7.yaml#/components/schemas/TracesResult
480476
TelemetryOverview:
481477
$ref: ./components/m7.yaml#/components/schemas/TelemetryOverview
482478
ConversationEvent:
@@ -505,10 +501,6 @@ components:
505501
$ref: ../schemas/agent/agent.schema.json#/$defs/ModelCall
506502
StreamEventEnvelope:
507503
$ref: ../schemas/stream/stream.schema.json
508-
TelemetryQuery:
509-
$ref: ../schemas/telemetry/query.schema.json
510-
TrustedTelemetryIdentity:
511-
$ref: ../schemas/telemetry/query.schema.json#/$defs/TrustedTelemetryIdentity
512504
PlatformState:
513505
$ref: ./components/m2.yaml#/components/schemas/PlatformState
514506
SetupStatus:

‎api/openapi/components/identity.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ components:
77
properties:
88
id: {type: string, minLength: 1}
99
name: {type: string, minLength: 1, maxLength: 128}
10-
code: {type: string, pattern: "^[a-z][a-z0-9-]{1,62}$"}
10+
code: {type: string, minLength: 1, maxLength: 63, pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"}
1111
status: {type: string, enum: [active, suspended, disabled]}
1212
timezone: {type: string, minLength: 1, maxLength: 128}
1313
default_locale: {type: string, enum: [zh-CN, en-US]}

‎api/openapi/components/m2.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ components:
115115
required: [name, code, timezone]
116116
properties:
117117
name: {type: string, minLength: 1, maxLength: 128}
118-
code: {type: string, pattern: "^[a-z][a-z0-9-]{1,62}$"}
118+
code: {type: string, minLength: 1, maxLength: 63, pattern: "^[a-z0-9]+(?:-[a-z0-9]+)*$"}
119119
timezone: {type: string, minLength: 1, maxLength: 128}
120120
default_locale: {$ref: "./common.yaml#/components/schemas/Locale"}
121121
remark: {type: string, maxLength: 2048}

0 commit comments

Comments
 (0)