Skip to content

Commit fcd4b6e

Browse files
committed
Fixes
1 parent 7abbab6 commit fcd4b6e

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

bin/router/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ pub async fn configure_app_from_config(
110110
Some(jwt_config) => Some(JwtAuthRuntime::init(bg_tasks_manager, jwt_config).await?),
111111
None => None,
112112
};
113-
let usage_agent = pipeline::usage::from_config(&router_config).map(Arc::new);
113+
let usage_agent = pipeline::usage_reporting::from_config(&router_config).map(Arc::new);
114114

115-
if let Some(usage_agent) = usage_agent.clone() {
116-
bg_tasks_manager.register_task(usage_agent);
115+
if let Some(usage_agent) = &usage_agent {
116+
bg_tasks_manager.register_task(usage_agent.clone());
117117
}
118118

119119
let router_config_arc = Arc::new(router_config);

bin/router/src/pipeline/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub mod normalize;
4040
pub mod parser;
4141
pub mod progressive_override;
4242
pub mod query_plan;
43-
pub mod usage;
43+
pub mod usage_reporting;
4444
pub mod validation;
4545

4646
static GRAPHIQL_HTML: &str = include_str!("../../static/graphiql.html");
@@ -151,7 +151,7 @@ pub async fn execute_pipeline(
151151

152152
shared_state.usage_agent.as_ref().and_then(|usage_agent| {
153153
shared_state.router_config.usage_reporting.as_ref().map(|usage_config| {
154-
usage::send_usage_report(
154+
usage_reporting::send_usage_report(
155155
supergraph.schema.clone(),
156156
start,
157157
req,

bin/router/src/pipeline/usage.rs renamed to bin/router/src/pipeline/usage_reporting.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub fn from_config(
1919
hive_console_sdk::agent::UsageAgent::new(
2020
usage_config.token.clone(),
2121
usage_config.endpoint.clone(),
22+
usage_config.target_id.clone(),
2223
usage_config.buffer_size,
2324
usage_config.connect_timeout,
2425
usage_config.request_timeout,

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1762,7 +1762,7 @@ Configuration for usage reporting to GraphQL Hive.
17621762
|**flush\_interval**|`integer`|Frequency of flushing the buffer to the server<br/>Default: 5 seconds<br/>Default: `5`<br/>Format: `"uint64"`<br/>Minimum: `0`<br/>|no|
17631763
|**request\_timeout**|`integer`|A timeout for the entire request to Hive Console<br/>Unit: seconds<br/>Default: 15 (s)<br/>Default: `15`<br/>Format: `"uint64"`<br/>Minimum: `0`<br/>|no|
17641764
|**sample\_rate**|`number`|Sample rate to determine sampling.<br/>0.0 = 0% chance of being sent<br/>1.0 = 100% chance of being sent<br/>Default: 1.0<br/>Default: `1`<br/>Format: `"double"`<br/>|no|
1765-
|**target\_id**|`string`|A target ID, this can either be a slug following the format “$organizationSlug/$projectSlug/$targetSlug” (e.g “the-guild/graphql-hive/staging”) or an UUID (e.g. “a0f4c605-6541-4350-8cfe-b31f21a4bf80”). To be used when the token is configured with an organization access token.<br/>|yes|
1765+
|**target\_id**|`string`, `null`|A target ID, this can either be a slug following the format “$organizationSlug/$projectSlug/$targetSlug” (e.g “the-guild/graphql-hive/staging”) or an UUID (e.g. “a0f4c605-6541-4350-8cfe-b31f21a4bf80”). To be used when the token is configured with an organization access token.<br/>|no|
17661766
|**token**|`string`|Your [Registry Access Token](https://the-guild.dev/graphql/hive/docs/management/targets#registry-access-tokens) with write permission.<br/>|yes|
17671767

17681768
**Additional Properties:** not allowed

lib/router-config/src/usage_reporting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub struct UsageReportingConfig {
77
/// Your [Registry Access Token](https://the-guild.dev/graphql/hive/docs/management/targets#registry-access-tokens) with write permission.
88
pub token: String,
99
/// A target ID, this can either be a slug following the format “$organizationSlug/$projectSlug/$targetSlug” (e.g “the-guild/graphql-hive/staging”) or an UUID (e.g. “a0f4c605-6541-4350-8cfe-b31f21a4bf80”). To be used when the token is configured with an organization access token.
10-
pub target_id: String,
10+
pub target_id: Option<String>,
1111
/// For self-hosting, you can override `/usage` endpoint (defaults to `https://app.graphql-hive.com/usage`).
1212
#[serde(default = "default_endpoint")]
1313
pub endpoint: String,

0 commit comments

Comments
 (0)