Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
9dad0e2
wip
kamilkisiela Feb 27, 2025
75d4847
/auth-otel
kamilkisiela Mar 20, 2025
637b99b
perf
kamilkisiela Mar 21, 2025
927cca1
comments
kamilkisiela Mar 21, 2025
d41b208
cleanups
kamilkisiela Mar 21, 2025
da30838
Add react-scan in local development mode
kamilkisiela Mar 21, 2025
8d0fa79
asdasd
kamilkisiela Mar 21, 2025
33f8675
ye
kamilkisiela Mar 22, 2025
a497806
asd
kamilkisiela Mar 22, 2025
bdd2695
otel database migrations
n1ru4l May 28, 2025
2c11feb
sort columns and indices
n1ru4l May 28, 2025
e8c82e4
lets include codes
n1ru4l May 28, 2025
2b3ce24
prefix spans with `hive`
n1ru4l May 30, 2025
55d9011
fix typo
n1ru4l May 30, 2025
7cfe165
lol
n1ru4l May 30, 2025
ef1c4e2
fix typos
n1ru4l May 30, 2025
71509fe
wip
n1ru4l Jun 2, 2025
4792863
add example sdl
n1ru4l Jun 2, 2025
563ae7f
wip
n1ru4l Jun 4, 2025
552468f
moar wip
n1ru4l Jun 6, 2025
570b0b0
moar wip
n1ru4l Jun 6, 2025
83a6831
ui consistency
n1ru4l Jun 10, 2025
95831b8
real data
n1ru4l Jun 10, 2025
4b1f8d4
subgraph execute
n1ru4l Jun 26, 2025
7a56062
this seems more smart
n1ru4l Jun 26, 2025
7f55c08
wip
n1ru4l Jun 27, 2025
59f33bf
filter based on duration and period
n1ru4l Jun 30, 2025
50d19ad
implement reset timeline
n1ru4l Jun 30, 2025
1e381f3
avoid `[""]`
n1ru4l Jun 30, 2025
50e2d3d
filter by error code
n1ru4l Jun 30, 2025
deac396
all them filters work
n1ru4l Jun 30, 2025
f4db72f
reset state
n1ru4l Jun 30, 2025
805974a
time buckets
n1ru4l Jul 3, 2025
8ed273c
add a script for seeding otel data
n1ru4l Jul 3, 2025
985b57d
typo
n1ru4l Jul 3, 2025
57befdf
enable operation name and operation type filter
n1ru4l Jul 4, 2025
c99bd8c
how about we show the real operation
n1ru4l Jul 4, 2025
df18979
reuse components
n1ru4l Jul 4, 2025
a111352
???
n1ru4l Jul 4, 2025
f600667
store hash
n1ru4l Jul 7, 2025
6e0e9d3
client and hash
n1ru4l Jul 7, 2025
280dc7a
improve seed
n1ru4l Jul 7, 2025
969b5a7
たいへん
n1ru4l Jul 7, 2025
c704f89
error codes
n1ru4l Jul 7, 2025
a7608a5
each trace shall be unique
n1ru4l Jul 7, 2025
454517d
fix scroll area unlimited width
n1ru4l Jul 7, 2025
ef5b55d
some security
n1ru4l Jul 7, 2025
bf56e81
span events
n1ru4l Jul 8, 2025
35bd59e
better like this
n1ru4l Jul 8, 2025
48a89ef
fix status ok/error
n1ru4l Jul 14, 2025
9608e92
fix: show real amount of events
n1ru4l Jul 14, 2025
6df735c
display filtered out requests in diagram
n1ru4l Jul 14, 2025
3cf5107
feat: dedicated permission for reporting otel traces
n1ru4l Jul 14, 2025
dca0285
show 100%
n1ru4l Jul 14, 2025
89c1a7d
deployment configuration
n1ru4l Jul 14, 2025
1cdd2b0
fix types
n1ru4l Jul 14, 2025
05244e9
feature flag for otel traces
n1ru4l Jul 14, 2025
a3bfdc9
fix types
n1ru4l Jul 14, 2025
b2bb421
fix a bunch of linting issues
n1ru4l Jul 14, 2025
82fbe27
fix runtime error
n1ru4l Jul 14, 2025
9458b57
feature flag
n1ru4l Jul 15, 2025
4dc0bb3
implement time bucket selection via diagram
n1ru4l Jul 15, 2025
d872ab0
save the day
n1ru4l Jul 15, 2025
46b09f3
order by timestamp or duration asc/desc
n1ru4l Jul 15, 2025
34b2390
lel
n1ru4l Jul 15, 2025
615096a
build it
n1ru4l Jul 15, 2025
b19b6f5
rename attributes
n1ru4l Jul 17, 2025
fa0dcd1
handle faulty graphql operation traces
n1ru4l Sep 19, 2025
c86e430
some margin
n1ru4l Sep 19, 2025
8af7ee9
nicer unknown value formatting
n1ru4l Sep 19, 2025
72a6882
enable otel-collector self-reporting metrics and scraping
dotansimha Sep 21, 2025
6b55f67
added memory limiter
dotansimha Sep 21, 2025
262f583
allow unknown oepration type filtering
n1ru4l Sep 22, 2025
4c3e81f
wip: laod test
n1ru4l Sep 22, 2025
3f3d734
typefix
n1ru4l Sep 22, 2025
b019d85
server preset pls
n1ru4l Sep 22, 2025
ae283ff
single
n1ru4l Sep 22, 2025
e265374
not my type
n1ru4l Sep 22, 2025
860b681
if we use it it must be there :)
n1ru4l Sep 22, 2025
4975ef7
lel
n1ru4l Sep 23, 2025
dbdf2c3
jeeee
n1ru4l Sep 23, 2025
78f2750
ooops
n1ru4l Sep 23, 2025
3537366
int
n1ru4l Sep 23, 2025
c6b6136
use up 2 date attributes
n1ru4l Sep 23, 2025
ea9409b
remove the rouge span
n1ru4l Sep 24, 2025
5ff1650
adjust fixtures
n1ru4l Sep 24, 2025
e60dac2
view operation for subgraph call
n1ru4l Sep 24, 2025
1eebff9
tweak some log
n1ru4l Sep 24, 2025
5a6f745
inline auth extension
n1ru4l Sep 24, 2025
d893a27
slight config tweaking
n1ru4l Sep 25, 2025
ce36534
use unknown everywhere
n1ru4l Sep 25, 2025
a7dda05
loading state
n1ru4l Sep 25, 2025
5f7bd92
feat: pagination
n1ru4l Sep 25, 2025
bf1271e
lint
n1ru4l Sep 26, 2025
0e19c10
feat: page header for traces
n1ru4l Sep 26, 2025
0f46a3a
i got that sticky icky
n1ru4l Sep 26, 2025
20b9f1d
improve trace detail view header
n1ru4l Sep 26, 2025
497a971
404 component not found
n1ru4l Sep 26, 2025
8b7b080
lint
n1ru4l Sep 26, 2025
a7b333e
improve bucket selection script
n1ru4l Sep 26, 2025
5650d06
improve buckets
n1ru4l Sep 30, 2025
796daae
time bucket end
n1ru4l Oct 1, 2025
d026bcd
interval
n1ru4l Oct 1, 2025
dcd3859
lint
n1ru4l Oct 1, 2025
091d771
fix not found state flashing
n1ru4l Oct 1, 2025
9467d23
fix bucket end
n1ru4l Oct 1, 2025
026e246
use date range filter
n1ru4l Oct 1, 2025
87e2a2a
quick range fix
n1ru4l Oct 2, 2025
675da01
empty state events
n1ru4l Oct 2, 2025
a3630de
cleanup and linting
n1ru4l Oct 2, 2025
8d42f29
cleanup
n1ru4l Oct 2, 2025
091a535
show quick filter selections as label
n1ru4l Oct 7, 2025
868dd89
use config
n1ru4l Oct 8, 2025
ffb00b1
back off
n1ru4l Oct 8, 2025
da23132
no low cardinality
n1ru4l Oct 8, 2025
5b54ed1
stable af
n1ru4l Oct 8, 2025
f17697e
DateTime64
n1ru4l Oct 8, 2025
e7644bd
typo
n1ru4l Oct 8, 2025
5b6c6eb
we dont need that
n1ru4l Oct 8, 2025
f082674
remove docs
n1ru4l Oct 8, 2025
e3fe338
dont leak my localhost
n1ru4l Oct 8, 2025
2fb6f23
meh
n1ru4l Oct 8, 2025
88f1b49
Update packages/services/api/src/modules/operations/module.graphql.ts
n1ru4l Oct 8, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions configs/gateway.config.ts
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,
},
});
12 changes: 12 additions & 0 deletions deployment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { configureGithubApp } from './services/github';
import { deployGraphQL } from './services/graphql';
import { deployKafka } from './services/kafka';
import { deployObservability } from './services/observability';
import { deployOTELCollector } from './services/otel-collector';
import { deploySchemaPolicy } from './services/policy';
import { deployPostgres } from './services/postgres';
import { deployProxy } from './services/proxy';
Expand Down Expand Up @@ -278,6 +279,15 @@ if (hiveAppPersistedDocumentsAbsolutePath && RUN_PUBLISH_COMMANDS) {
});
}

const otelCollector = deployOTELCollector({
environment,
graphql,
dbMigrations,
clickhouse,
image: docker.factory.getImageId('otel-collector', imagesTag),
docker,
});

const app = deployApp({
environment,
graphql,
Expand Down Expand Up @@ -306,6 +316,7 @@ const proxy = deployProxy({
usage,
environment,
publicGraphQLAPIGateway,
otelCollector,
});

deployCloudFlareSecurityTransform({
Expand All @@ -332,4 +343,5 @@ export const schemaApiServiceId = schema.service.id;
export const webhooksApiServiceId = webhooks.service.id;

export const appId = app.deployment.id;
export const otelCollectorId = otelCollector.deployment.id;
export const publicIp = proxy.get()!.status.loadBalancer.ingress[0].ip;
5 changes: 5 additions & 0 deletions deployment/services/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ export function prepareEnvironment(input: {
cpuLimit: isProduction ? '512m' : '150m',
memoryLimit: isProduction ? '1000Mi' : '300Mi',
},
tracingCollector: {
cpuLimit: isProduction ? '1000m' : '100m',
memoryLimit: isProduction ? '2000Mi' : '200Mi',
maxReplicas: isProduction || isStaging ? 3 : 1,
},
},
};
}
Expand Down
60 changes: 60 additions & 0 deletions deployment/services/otel-collector.ts
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();
}
11 changes: 11 additions & 0 deletions deployment/services/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { App } from './app';
import { Environment } from './environment';
import { GraphQL } from './graphql';
import { Observability } from './observability';
import { OTELCollector } from './otel-collector';
import { type PublicGraphQLAPIGateway } from './public-graphql-api-gateway';
import { Usage } from './usage';

Expand All @@ -15,13 +16,15 @@ export function deployProxy({
environment,
observability,
publicGraphQLAPIGateway,
otelCollector,
}: {
observability: Observability;
environment: Environment;
graphql: GraphQL;
app: App;
usage: Usage;
publicGraphQLAPIGateway: PublicGraphQLAPIGateway;
otelCollector: OTELCollector;
}) {
const { tlsIssueName } = new CertManager().deployCertManagerAndIssuer();
const commonConfig = new pulumi.Config('common');
Expand Down Expand Up @@ -113,5 +116,13 @@ export function deployProxy({
requestTimeout: '60s',
retriable: true,
},
{
name: 'otel-traces',
path: '/otel/v1/traces',
customRewrite: '/v1/traces',
service: otelCollector.service,
requestTimeout: '60s',
retriable: true,
},
]);
}
15 changes: 9 additions & 6 deletions deployment/utils/service-deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ export class ServiceDeployment {
args?: kx.types.Container['args'];
image: string;
port?: number;
/** Port to use for liveness, startup and readiness probes. */
probePort?: number;
serviceAccountName?: pulumi.Output<string>;
livenessProbe?: string | ProbeConfig;
readinessProbe?: string | ProbeConfig;
Expand Down Expand Up @@ -107,6 +109,7 @@ export class ServiceDeployment {

createPod(asJob: boolean) {
const port = this.options.port || 3000;
const probePort = this.options.probePort ?? port;
const additionalEnv: any[] = normalizeEnv(this.options.env);
const secretsEnv: any[] = normalizeEnvSecrets(this.envSecrets);

Expand All @@ -125,14 +128,14 @@ export class ServiceDeployment {
timeoutSeconds: 5,
httpGet: {
path: this.options.livenessProbe,
port,
port: probePort,
},
}
: {
...this.options.livenessProbe,
httpGet: {
path: this.options.livenessProbe.endpoint,
port,
port: probePort,
},
};
}
Expand All @@ -147,14 +150,14 @@ export class ServiceDeployment {
timeoutSeconds: 5,
httpGet: {
path: this.options.readinessProbe,
port,
port: probePort,
},
}
: {
...this.options.readinessProbe,
httpGet: {
path: this.options.readinessProbe.endpoint,
port,
port: probePort,
},
};
}
Expand All @@ -169,14 +172,14 @@ export class ServiceDeployment {
timeoutSeconds: 10,
httpGet: {
path: this.options.startupProbe,
port,
port: probePort,
},
}
: {
...this.options.startupProbe,
httpGet: {
path: this.options.startupProbe.endpoint,
port,
port: probePort,
},
};
}
Expand Down
33 changes: 33 additions & 0 deletions docker/configs/otel-collector/builder-config.yaml
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
Comment on lines +28 to +29
Copy link
Contributor Author

@n1ru4l n1ru4l Oct 2, 2025

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?

Copy link
Member

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:

import "github.com/graphql-hive/console/go/open-telemetry-collector-extension-hiveauth/internal/metadata"

and remove the dependency+replace.

Copy link
Contributor Author

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.


replaces:
- github.com/graphql-hive/opentelemetry-collector-contrib/extension/hiveauthextension =>
/build/extension-hiveauth
79 changes: 79 additions & 0 deletions docker/configs/otel-collector/config.yaml
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 docker/configs/otel-collector/extension-hiveauth/config.go
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
}
7 changes: 7 additions & 0 deletions docker/configs/otel-collector/extension-hiveauth/doc.go
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"
Loading
Loading