-
Notifications
You must be signed in to change notification settings - Fork 121
feat: otel telemetry collection and dashboard #6796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
n1ru4l
wants to merge
123
commits into
main
Choose a base branch
from
kamil-otel
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+13,301
−239
Open
Changes from all commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
9dad0e2
wip
kamilkisiela 75d4847
/auth-otel
kamilkisiela 637b99b
perf
kamilkisiela 927cca1
comments
kamilkisiela d41b208
cleanups
kamilkisiela da30838
Add react-scan in local development mode
kamilkisiela 8d0fa79
asdasd
kamilkisiela 33f8675
ye
kamilkisiela a497806
asd
kamilkisiela bdd2695
otel database migrations
n1ru4l 2c11feb
sort columns and indices
n1ru4l e8c82e4
lets include codes
n1ru4l 2b3ce24
prefix spans with `hive`
n1ru4l 55d9011
fix typo
n1ru4l 7cfe165
lol
n1ru4l ef1c4e2
fix typos
n1ru4l 71509fe
wip
n1ru4l 4792863
add example sdl
n1ru4l 563ae7f
wip
n1ru4l 552468f
moar wip
n1ru4l 570b0b0
moar wip
n1ru4l 83a6831
ui consistency
n1ru4l 95831b8
real data
n1ru4l 4b1f8d4
subgraph execute
n1ru4l 7a56062
this seems more smart
n1ru4l 7f55c08
wip
n1ru4l 59f33bf
filter based on duration and period
n1ru4l 50d19ad
implement reset timeline
n1ru4l 1e381f3
avoid `[""]`
n1ru4l 50e2d3d
filter by error code
n1ru4l deac396
all them filters work
n1ru4l f4db72f
reset state
n1ru4l 805974a
time buckets
n1ru4l 8ed273c
add a script for seeding otel data
n1ru4l 985b57d
typo
n1ru4l 57befdf
enable operation name and operation type filter
n1ru4l c99bd8c
how about we show the real operation
n1ru4l df18979
reuse components
n1ru4l a111352
???
n1ru4l f600667
store hash
n1ru4l 6e0e9d3
client and hash
n1ru4l 280dc7a
improve seed
n1ru4l 969b5a7
たいへん
n1ru4l c704f89
error codes
n1ru4l a7608a5
each trace shall be unique
n1ru4l 454517d
fix scroll area unlimited width
n1ru4l ef5b55d
some security
n1ru4l bf56e81
span events
n1ru4l 35bd59e
better like this
n1ru4l 48a89ef
fix status ok/error
n1ru4l 9608e92
fix: show real amount of events
n1ru4l 6df735c
display filtered out requests in diagram
n1ru4l 3cf5107
feat: dedicated permission for reporting otel traces
n1ru4l dca0285
show 100%
n1ru4l 89c1a7d
deployment configuration
n1ru4l 1cdd2b0
fix types
n1ru4l 05244e9
feature flag for otel traces
n1ru4l a3bfdc9
fix types
n1ru4l b2bb421
fix a bunch of linting issues
n1ru4l 82fbe27
fix runtime error
n1ru4l 9458b57
feature flag
n1ru4l 4dc0bb3
implement time bucket selection via diagram
n1ru4l d872ab0
save the day
n1ru4l 46b09f3
order by timestamp or duration asc/desc
n1ru4l 34b2390
lel
n1ru4l 615096a
build it
n1ru4l b19b6f5
rename attributes
n1ru4l fa0dcd1
handle faulty graphql operation traces
n1ru4l c86e430
some margin
n1ru4l 8af7ee9
nicer unknown value formatting
n1ru4l 72a6882
enable otel-collector self-reporting metrics and scraping
dotansimha 6b55f67
added memory limiter
dotansimha 262f583
allow unknown oepration type filtering
n1ru4l 4c3e81f
wip: laod test
n1ru4l 3f3d734
typefix
n1ru4l b019d85
server preset pls
n1ru4l ae283ff
single
n1ru4l e265374
not my type
n1ru4l 860b681
if we use it it must be there :)
n1ru4l 4975ef7
lel
n1ru4l dbdf2c3
jeeee
n1ru4l 78f2750
ooops
n1ru4l 3537366
int
n1ru4l c6b6136
use up 2 date attributes
n1ru4l ea9409b
remove the rouge span
n1ru4l 5ff1650
adjust fixtures
n1ru4l e60dac2
view operation for subgraph call
n1ru4l 1eebff9
tweak some log
n1ru4l 5a6f745
inline auth extension
n1ru4l d893a27
slight config tweaking
n1ru4l ce36534
use unknown everywhere
n1ru4l a7dda05
loading state
n1ru4l 5f7bd92
feat: pagination
n1ru4l bf1271e
lint
n1ru4l 0e19c10
feat: page header for traces
n1ru4l 0f46a3a
i got that sticky icky
n1ru4l 20b9f1d
improve trace detail view header
n1ru4l 497a971
404 component not found
n1ru4l 8b7b080
lint
n1ru4l a7b333e
improve bucket selection script
n1ru4l 5650d06
improve buckets
n1ru4l 796daae
time bucket end
n1ru4l d026bcd
interval
n1ru4l dcd3859
lint
n1ru4l 091d771
fix not found state flashing
n1ru4l 9467d23
fix bucket end
n1ru4l 026e246
use date range filter
n1ru4l 87e2a2a
quick range fix
n1ru4l 675da01
empty state events
n1ru4l a3630de
cleanup and linting
n1ru4l 8d42f29
cleanup
n1ru4l 091a535
show quick filter selections as label
n1ru4l 868dd89
use config
n1ru4l ffb00b1
back off
n1ru4l da23132
no low cardinality
n1ru4l 5b54ed1
stable af
n1ru4l f17697e
DateTime64
n1ru4l e7644bd
typo
n1ru4l 5b6c6eb
we dont need that
n1ru4l f082674
remove docs
n1ru4l e3fe338
dont leak my localhost
n1ru4l 2fb6f23
meh
n1ru4l 88f1b49
Update packages/services/api/src/modules/operations/module.graphql.ts
n1ru4l File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { defineConfig } from '@graphql-hive/gateway'; | ||
import { hiveTracingSetup } from '@graphql-hive/plugin-opentelemetry/setup'; | ||
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks'; // install | ||
|
||
hiveTracingSetup({ | ||
contextManager: new AsyncLocalStorageContextManager(), | ||
target: process.env.HIVE_TRACING_TARGET!, | ||
accessToken: process.env.HIVE_TRACING_ACCESS_TOKEN!, | ||
// optional, for self-hosting | ||
endpoint: process.env.HIVE_TRACING_ENDPOINT!, | ||
}); | ||
|
||
export const gatewayConfig = defineConfig({ | ||
openTelemetry: { | ||
traces: true, | ||
}, | ||
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { serviceLocalEndpoint } from '../utils/local-endpoint'; | ||
import { ServiceDeployment } from '../utils/service-deployment'; | ||
import { Clickhouse } from './clickhouse'; | ||
import { DbMigrations } from './db-migrations'; | ||
import { Docker } from './docker'; | ||
import { Environment } from './environment'; | ||
import { GraphQL } from './graphql'; | ||
|
||
export type OTELCollector = ReturnType<typeof deployOTELCollector>; | ||
|
||
export function deployOTELCollector(args: { | ||
image: string; | ||
environment: Environment; | ||
docker: Docker; | ||
clickhouse: Clickhouse; | ||
dbMigrations: DbMigrations; | ||
graphql: GraphQL; | ||
}) { | ||
return new ServiceDeployment( | ||
'otel-collector', | ||
{ | ||
image: args.image, | ||
imagePullSecret: args.docker.secret, | ||
env: { | ||
...args.environment.envVars, | ||
HIVE_OTEL_AUTH_ENDPOINT: serviceLocalEndpoint(args.graphql.service).apply( | ||
value => value + '/otel-auth', | ||
), | ||
}, | ||
/** | ||
* We are using the healthcheck extension. | ||
* https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/healthcheckextension | ||
*/ | ||
probePort: 13133, | ||
readinessProbe: '/', | ||
livenessProbe: '/', | ||
startupProbe: '/', | ||
exposesMetrics: true, | ||
replicas: args.environment.podsConfig.tracingCollector.maxReplicas, | ||
pdb: true, | ||
availabilityOnEveryNode: true, | ||
port: 4318, | ||
memoryLimit: args.environment.podsConfig.tracingCollector.memoryLimit, | ||
autoScaling: { | ||
maxReplicas: args.environment.podsConfig.tracingCollector.maxReplicas, | ||
cpu: { | ||
limit: args.environment.podsConfig.tracingCollector.cpuLimit, | ||
cpuAverageToScale: 80, | ||
}, | ||
}, | ||
}, | ||
[args.clickhouse.deployment, args.clickhouse.service, args.dbMigrations], | ||
) | ||
.withSecret('CLICKHOUSE_HOST', args.clickhouse.secret, 'host') | ||
.withSecret('CLICKHOUSE_PORT', args.clickhouse.secret, 'port') | ||
.withSecret('CLICKHOUSE_USERNAME', args.clickhouse.secret, 'username') | ||
.withSecret('CLICKHOUSE_PASSWORD', args.clickhouse.secret, 'password') | ||
.withSecret('CLICKHOUSE_PROTOCOL', args.clickhouse.secret, 'protocol') | ||
.deploy(); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
dist: | ||
version: 0.122.0 | ||
name: otelcol-custom | ||
description: Custom OTel Collector distribution | ||
output_path: ./otelcol-custom | ||
|
||
receivers: | ||
- gomod: go.opentelemetry.io/collector/receiver/otlpreceiver v0.122.0 | ||
|
||
processors: | ||
- gomod: go.opentelemetry.io/collector/processor/batchprocessor v0.122.0 | ||
- gomod: go.opentelemetry.io/collector/processor/memorylimiterprocessor v0.122.0 | ||
- gomod: | ||
github.com/open-telemetry/opentelemetry-collector-contrib/processor/attributesprocessor | ||
v0.122.0 | ||
- gomod: | ||
github.com/open-telemetry/opentelemetry-collector-contrib/processor/filterprocessor v0.122.0 | ||
|
||
exporters: | ||
- gomod: go.opentelemetry.io/collector/exporter/debugexporter v0.122.0 | ||
- gomod: | ||
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/clickhouseexporter v0.122.0 | ||
|
||
extensions: | ||
- gomod: | ||
github.com/open-telemetry/opentelemetry-collector-contrib/extension/healthcheckextension | ||
v0.122.0 | ||
- gomod: | ||
github.com/graphql-hive/opentelemetry-collector-contrib/extension/hiveauthextension cd0c57cf22 | ||
|
||
replaces: | ||
- github.com/graphql-hive/opentelemetry-collector-contrib/extension/hiveauthextension => | ||
/build/extension-hiveauth |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
extensions: | ||
hiveauth: | ||
endpoint: ${HIVE_OTEL_AUTH_ENDPOINT} | ||
health_check: | ||
endpoint: '0.0.0.0:13133' | ||
receivers: | ||
otlp: | ||
protocols: | ||
grpc: | ||
include_metadata: true | ||
endpoint: '0.0.0.0:4317' | ||
auth: | ||
authenticator: hiveauth | ||
http: | ||
cors: | ||
allowed_origins: ['*'] | ||
allowed_headers: ['*'] | ||
include_metadata: true | ||
endpoint: '0.0.0.0:4318' | ||
auth: | ||
authenticator: hiveauth | ||
processors: | ||
batch: | ||
timeout: 5s | ||
send_batch_size: 10000 | ||
attributes: | ||
actions: | ||
- key: hive.target_id | ||
from_context: auth.targetId | ||
action: insert | ||
memory_limiter: | ||
check_interval: 1s | ||
limit_percentage: 80 | ||
spike_limit_percentage: 20 | ||
exporters: | ||
debug: | ||
verbosity: detailed | ||
sampling_initial: 5 | ||
sampling_thereafter: 200 | ||
clickhouse: | ||
endpoint: ${CLICKHOUSE_PROTOCOL}://${CLICKHOUSE_HOST}:${CLICKHOUSE_PORT}?dial_timeout=10s&compress=lz4&async_insert=1 | ||
database: default | ||
async_insert: true | ||
username: ${CLICKHOUSE_USERNAME} | ||
password: ${CLICKHOUSE_PASSWORD} | ||
create_schema: false | ||
ttl: 720h | ||
compress: lz4 | ||
logs_table_name: otel_logs | ||
traces_table_name: otel_traces | ||
metrics_table_name: otel_metrics | ||
timeout: 5s | ||
retry_on_failure: | ||
enabled: true | ||
initial_interval: 5s | ||
max_interval: 30s | ||
max_elapsed_time: 300s | ||
service: | ||
extensions: | ||
- hiveauth | ||
- health_check | ||
telemetry: | ||
logs: | ||
level: INFO | ||
encoding: json | ||
output_paths: ['stdout'] | ||
error_output_paths: ['stderr'] | ||
metrics: | ||
address: '0.0.0.0:10254' | ||
pipelines: | ||
traces: | ||
receivers: [otlp] | ||
processors: | ||
- memory_limiter | ||
- attributes | ||
- batch | ||
exporters: | ||
- clickhouse | ||
# - debug |
28 changes: 28 additions & 0 deletions
28
docker/configs/otel-collector/extension-hiveauth/config.go
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package hiveauthextension // import "github.com/graphql-hive/opentelemetry-collector-contrib/extension/hiveauthextension" | ||
|
||
import ( | ||
"errors" | ||
"time" | ||
) | ||
|
||
type Config struct { | ||
// Endpoint is the address of the authentication server | ||
Endpoint string `mapstructure:"endpoint"` | ||
// Timeout is the timeout for the HTTP request to the auth service | ||
Timeout time.Duration `mapstructure:"timeout"` | ||
} | ||
|
||
func (cfg *Config) Validate() error { | ||
if cfg.Endpoint == "" { | ||
return errors.New("missing endpoint") | ||
} | ||
|
||
if cfg.Timeout <= 0 { | ||
return errors.New("timeout must be a positive value") | ||
} | ||
|
||
return nil | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
//go:generate mdatagen metadata.yaml | ||
|
||
// Package hiveauthextension accepts HTTP requests and forwards them to an external authentication service. | ||
package hiveauthextension // import "github.com/graphql-hive/opentelemetry-collector-contrib/extension/hiveauthextension" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@enisdenjo This commit and repo must actually exist, even though we have the
replaces
overwrite down there. Is there a better approach of making this extension/mod a "local" only module?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also use a local import directly:
and remove the dependency+replace.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really understand how that work within the
builder-config.yml
file.