Skip to content

Commit

Permalink
Update to latest client identification headers (#1411)
Browse files Browse the repository at this point in the history
The header names `apollo-client-name` and `apollo-client-version` are
deprecrated in favor of `apollographql-client-name` and
`apollographql-client-version`.


[Docs](https://www.apollographql.com/docs/graphos/metrics/client-awareness/#setup)

Co-authored-by: Avery Harnish <[email protected]>
  • Loading branch information
jsegaran and EverlastingBugstopper authored Nov 14, 2022
1 parent 0585044 commit b807c61
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/rover-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ fn query(fetch_document: bool) -> Result<(String, Option<String>)> {
let response = client
.post(graphql_endpoint)
.json(&schema_query)
.header("apollo-client-name", "rover-client")
.header("apollographql-client-name", "rover-client")
.header(
"apollo-client-version",
"apollographql-client-version",
format!("{} (dev)", env!("CARGO_PKG_VERSION")),
)
.send()?
Expand Down
6 changes: 3 additions & 3 deletions crates/rover-client/src/blocking/studio_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl StudioClient {
pub fn build_studio_headers(&self) -> Result<HeaderMap, RoverClientError> {
let mut headers = HeaderMap::new();

// The headers "apollo-client-name" and "apollo-client-version"
// The headers "apollographql-client-name" and "apollographql-client-version"
// are used for client identification in Apollo Studio.

// This provides metrics in Studio that help keep track of what parts of the schema
Expand All @@ -94,10 +94,10 @@ impl StudioClient {
// https://www.apollographql.com/docs/studio/client-awareness/#using-apollo-server-and-apollo-client

let client_name = HeaderValue::from_str(CLIENT_NAME)?;
headers.insert("apollo-client-name", client_name);
headers.insert("apollographql-client-name", client_name);
tracing::debug!(?self.version);
let client_version = HeaderValue::from_str(&self.version)?;
headers.insert("apollo-client-version", client_version);
headers.insert("apollographql-client-version", client_version);

let mut api_key = HeaderValue::from_str(&self.credential.api_key)?;
api_key.set_sensitive(true);
Expand Down

0 comments on commit b807c61

Please sign in to comment.