Skip to content
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

Remove deprecated metrics #6361

Merged
merged 8 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
11 changes: 0 additions & 11 deletions apollo-router/src/axum_factory/axum_http_server_factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,9 +315,7 @@ impl HttpServerFactory for AxumHttpServerFactory {

let (main_server, main_shutdown_sender) = serve_router_on_listen_addr(
main_listener,
actual_main_listen_address.clone(),
all_routers.main.1,
true,
http_config.clone(),
all_connections_stopped_sender.clone(),
);
Expand Down Expand Up @@ -355,9 +353,7 @@ impl HttpServerFactory for AxumHttpServerFactory {
.map(|((listen_addr, listener), router)| {
let (server, shutdown_sender) = serve_router_on_listen_addr(
listener,
listen_addr.clone(),
router,
false,
http_config.clone(),
all_connections_stopped_sender.clone(),
);
Expand Down Expand Up @@ -525,13 +521,6 @@ async fn license_handler<B>(
license,
LicenseState::LicensedHalt | LicenseState::LicensedWarn
) {
u64_counter!(
"apollo_router_http_requests_total",
"Total number of HTTP requests made.",
1,
status = StatusCode::INTERNAL_SERVER_ERROR.as_u16() as i64,
error = LICENSE_EXPIRED_SHORT_MESSAGE
);
// This will rate limit logs about license to 1 a second.
// The way it works is storing the delta in seconds from a starting instant.
// If the delta is over one second from the last time we logged then try and do a compare_exchange and if successfull log.
Expand Down
24 changes: 0 additions & 24 deletions apollo-router/src/axum_factory/listeners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use std::collections::HashMap;
use std::collections::HashSet;
use std::sync::atomic::AtomicBool;
use std::sync::atomic::AtomicU64;
use std::sync::atomic::Ordering;
use std::sync::Arc;
use std::time::Duration;
Expand All @@ -30,7 +29,6 @@ use crate::router::ApolloRouterError;
use crate::router_factory::Endpoint;
use crate::ListenAddr;

static SESSION_COUNT: AtomicU64 = AtomicU64::new(0);
static MAX_FILE_HANDLES_WARN: AtomicBool = AtomicBool::new(false);

#[derive(Clone, Debug)]
Expand Down Expand Up @@ -199,9 +197,7 @@ pub(super) async fn get_extra_listeners(

pub(super) fn serve_router_on_listen_addr(
mut listener: Listener,
address: ListenAddr,
router: axum::Router,
main_graphql_port: bool,
http_config: Http,
all_connections_stopped_sender: mpsc::Sender<()>,
) -> (impl Future<Output = Listener>, oneshot::Sender<()>) {
Expand All @@ -216,8 +212,6 @@ pub(super) fn serve_router_on_listen_addr(

let connection_shutdown = Arc::new(Notify::new());

let address = address.to_string();

loop {
tokio::select! {
_ = &mut shutdown_receiver => {
Expand All @@ -234,16 +228,7 @@ pub(super) fn serve_router_on_listen_addr(
tracing::info!("can accept connections again");
MAX_FILE_HANDLES_WARN.store(false, Ordering::SeqCst);
}
// We only want to recognise sessions if we are the main graphql port.
if main_graphql_port {
let session_count = SESSION_COUNT.fetch_add(1, Ordering::Acquire)+1;
tracing::info!(
value.apollo_router_session_count_total = session_count,
listener = &address
);
}

let address = address.clone();
let mut http_config = http_config.clone();
tokio::task::spawn(async move {
// this sender must be moved into the session to track that it is still running
Expand Down Expand Up @@ -352,15 +337,6 @@ pub(super) fn serve_router_on_listen_addr(
}
}
}

// We only want to recognise sessions if we are the main graphql port.
if main_graphql_port {
let session_count = SESSION_COUNT.fetch_sub(1, Ordering::Acquire)-1;
tracing::info!(
value.apollo_router_session_count_total = session_count,
listener = &address
);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,41 +256,6 @@ snapshot_kind: text
}
]
},
"AttributesForwardConf": {
"additionalProperties": false,
"description": "Configuration to add custom attributes/labels on metrics to subgraphs",
"properties": {
"context": {
"description": "Configuration to forward values from the context to custom attributes/labels in metrics",
"items": {
"$ref": "#/definitions/ContextForward",
"description": "#/definitions/ContextForward"
},
"type": "array"
},
"errors": {
"$ref": "#/definitions/ErrorsForward",
"description": "#/definitions/ErrorsForward"
},
"request": {
"$ref": "#/definitions/Forward",
"description": "#/definitions/Forward"
},
"response": {
"$ref": "#/definitions/Forward",
"description": "#/definitions/Forward"
},
"static": {
"description": "Configuration to insert custom attributes/labels in metrics",
"items": {
"$ref": "#/definitions/Insert2",
"description": "#/definitions/Insert2"
},
"type": "array"
}
},
"type": "object"
},
"AuthConfig": {
"oneOf": [
{
Expand Down Expand Up @@ -405,30 +370,6 @@ snapshot_kind: text
}
]
},
"BodyForward": {
"additionalProperties": false,
"description": "Configuration to forward body values in metric attributes/labels",
"properties": {
"default": {
"$ref": "#/definitions/AttributeValue",
"description": "#/definitions/AttributeValue",
"nullable": true
},
"name": {
"description": "The name of the attribute",
"type": "string"
},
"path": {
"description": "The path in the body",
"type": "string"
}
},
"required": [
"name",
"path"
],
"type": "object"
},
"CSRFConfig": {
"additionalProperties": false,
"description": "CSRF Configuration.",
Expand Down Expand Up @@ -2220,30 +2161,6 @@ snapshot_kind: text
},
"type": "object"
},
"ContextForward": {
"additionalProperties": false,
"description": "Configuration to forward context values in metric attributes/labels",
"properties": {
"default": {
"$ref": "#/definitions/AttributeValue",
"description": "#/definitions/AttributeValue",
"nullable": true
},
"named": {
"description": "The name of the value in the context",
"type": "string"
},
"rename": {
"description": "The optional output name",
"nullable": true,
"type": "string"
}
},
"required": [
"named"
],
"type": "object"
},
"Cors": {
"additionalProperties": false,
"description": "Cross origin request configuration.",
Expand Down Expand Up @@ -2758,26 +2675,6 @@ snapshot_kind: text
},
"type": "object"
},
"ErrorsForward": {
"additionalProperties": false,
"properties": {
"extensions": {
"description": "Forward extensions values as custom attributes/labels in metrics",
"items": {
"$ref": "#/definitions/BodyForward",
"description": "#/definitions/BodyForward"
},
"type": "array"
},
"include_messages": {
"default": null,
"description": "Will include the error message in a \"message\" attribute",
"nullable": true,
"type": "boolean"
}
},
"type": "object"
},
"EventLevel": {
"enum": [
"info",
Expand Down Expand Up @@ -3190,29 +3087,6 @@ snapshot_kind: text
"description": "Forbid mutations configuration",
"type": "boolean"
},
"Forward": {
"additionalProperties": false,
"description": "Configuration to forward from headers/body",
"properties": {
"body": {
"description": "Forward body values as custom attributes/labels in metrics",
"items": {
"$ref": "#/definitions/BodyForward",
"description": "#/definitions/BodyForward"
},
"type": "array"
},
"header": {
"description": "Forward header values as custom attributes/labels in metrics",
"items": {
"$ref": "#/definitions/HeaderForward",
"description": "#/definitions/HeaderForward"
},
"type": "array"
}
},
"type": "object"
},
"ForwardHeaders": {
"description": "Forward headers",
"oneOf": [
Expand Down Expand Up @@ -3522,49 +3396,6 @@ snapshot_kind: text
],
"type": "object"
},
"HeaderForward": {
"anyOf": [
{
"additionalProperties": false,
"description": "Match via header name",
"properties": {
"default": {
"$ref": "#/definitions/AttributeValue",
"description": "#/definitions/AttributeValue",
"nullable": true
},
"named": {
"description": "The name of the header",
"type": "string"
},
"rename": {
"description": "The optional output name",
"nullable": true,
"type": "string"
}
},
"required": [
"named"
],
"type": "object"
},
{
"additionalProperties": false,
"description": "Match via rgex",
"properties": {
"matching": {
"description": "Using a regex on the header name",
"type": "string"
}
},
"required": [
"matching"
],
"type": "object"
}
],
"description": "Configuration to forward header values in metric labels"
},
"HeadersLocation": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -3709,25 +3540,6 @@ snapshot_kind: text
],
"description": "Insert header"
},
"Insert2": {
"additionalProperties": false,
"description": "Configuration to insert custom attributes/labels in metrics",
"properties": {
"name": {
"description": "The name of the attribute to insert",
"type": "string"
},
"value": {
"$ref": "#/definitions/AttributeValue",
"description": "#/definitions/AttributeValue"
}
},
"required": [
"name",
"value"
],
"type": "object"
},
"InsertFromBody": {
"additionalProperties": false,
"description": "Insert header with a value coming from body",
Expand Down Expand Up @@ -4373,28 +4185,9 @@ snapshot_kind: text
},
"type": "object"
},
"MetricsAttributesConf": {
"additionalProperties": false,
"description": "Configuration to add custom attributes/labels on metrics",
"properties": {
"subgraph": {
"$ref": "#/definitions/SubgraphAttributesConf",
"description": "#/definitions/SubgraphAttributesConf"
},
"supergraph": {
"$ref": "#/definitions/AttributesForwardConf",
"description": "#/definitions/AttributesForwardConf"
}
},
"type": "object"
},
"MetricsCommon": {
"additionalProperties": false,
"properties": {
"attributes": {
"$ref": "#/definitions/MetricsAttributesConf",
"description": "#/definitions/MetricsAttributesConf"
},
"buckets": {
"default": [
0.001,
Expand Down Expand Up @@ -6270,25 +6063,6 @@ snapshot_kind: text
},
"type": "object"
},
"SubgraphAttributesConf": {
"additionalProperties": false,
"description": "Configuration to add custom attributes/labels on metrics to subgraphs",
"properties": {
"all": {
"$ref": "#/definitions/AttributesForwardConf",
"description": "#/definitions/AttributesForwardConf"
},
"subgraphs": {
"additionalProperties": {
"$ref": "#/definitions/AttributesForwardConf",
"description": "#/definitions/AttributesForwardConf"
},
"description": "Attributes per subgraph",
"type": "object"
}
},
"type": "object"
},
"SubgraphConfiguration_for_CommonBatchingConfig": {
"description": "Configuration options pertaining to the subgraph server component.",
"properties": {
Expand Down
Loading