呲牙咧嘴是什么意思| 肺气肿是什么意思| 为什么会得静脉曲张| 24号来月经什么时候是排卵期| 无可奈何是什么生肖| 精液是什么味道| 结婚六十年是什么婚| 什么时间英语| 基础油是什么油| 3月份是什么季节| 足底筋膜炎挂什么科| 女生喝红牛有什么影响| 70年产权是什么意思| 意面是什么面| 吃多了拉肚子是什么原因| 水痘通过什么途径传染| 嫦娥住的宫殿叫什么| 宋江属什么生肖| 湿气太重了吃什么药| 什么方法可以治打嗝| 地球为什么自转| 一饿就心慌是什么原因引起的| 什么人容易得胆结石| 苦荞是什么植物| 又双叒叕念什么啥意思| 刚怀孕肚子有什么变化| 会阴是什么部位| 3.1号是什么星座| 梦遗是啥意思是什么| 什么是青光眼| 卡介苗是预防什么| 农历九月五行属什么| 什么叫袖珍人| 三途苦是指的什么| 拉肚子吃什么| 吃火龙果对身体有什么好处| 承五行属性是什么| 导盲犬一般是什么品种| 肌肤之钥是什么档次| 换手率是什么意思| 尿酸520属于什么水平| 办低保需要什么条件| 晕车喝什么饮料好| 体内湿气重用什么药| 吝啬什么意思| 龟头炎用什么药膏好| 牙痛什么原因引起的| 一级军士长什么级别| 光动力治疗什么| 皮秒是什么| 粘连是什么意思| 月经不调是什么原因造成的| 癫疯病发作前兆有什么症状| 冷暖自知上一句是什么| jk什么意思| 凌波仙子是什么意思| 6月13号是什么星座| 为什么拉尿会刺痛| 石光荣是什么军衔| 白带增多是什么原因| 表哥的女儿叫什么| 黄皮是什么水果| 百雀羚适合什么年龄段| 血糖的单位是什么| 口水臭是什么原因| 狗为什么喜欢吃骨头| 保家仙是什么| 区级以上医院是什么意思| 什么的东西| 什么好| 急性呼吸道感染是什么引起的| 月子里可以吃什么蔬菜| 脚上长水泡是什么原因引起的| 磁力链接是什么| 美国为什么要打伊朗| 伽马刀是什么意思| 浮白是什么意思| 皮肤过敏有什么好办法| 欧皇什么意思| 多出汗是什么原因| 疮疖是什么意思| 有机奶粉是什么意思| cd是什么牌子| 印度为什么叫阿三| 交界痣是什么| 二甲双胍为什么晚上吃| 梦见自己骑马是什么意思| 纯牛奶可以做什么美食| 九五年属什么生肖| 灵芝和什么煲汤好| 眼球突出是什么原因| 失物招领是什么意思| 2月27是什么星座| 输卵管堵塞吃什么药能打通| 手指缝脱皮是什么原因| 升白细胞的针剂叫什么| iabp医学上是什么意思| 早餐吃什么英语怎么说| 低血糖的人吃什么东西最好| 30岁属什么的生肖| 真菌感染是什么意思| 干部是什么意思| 早期唐筛是检查什么| 澳大利亚人说什么语言| 月经量少吃什么排淤血| 怀孕吃火龙果对胎儿有什么好| 男人吃什么壮阳最快| 母慈子孝下一句是什么| i是什么| icloud是什么| 感染性发热是什么意思| 把尿是什么意思| 口腔溃疡补充什么维生素| 低度鳞状上皮内病变是什么意思| 幽门螺旋杆菌感染有什么症状| 白细胞计数偏低是什么意思| 脑梗的症状是什么| 头寸是什么意思| 情债是什么意思| 命里缺金取什么名字好| 儿童办理身份证需要什么材料| 玫琳凯属于什么档次| 人为什么要呼吸| 早上起来嘴巴苦是什么原因| 反射弧是什么意思| 眼底出血用什么眼药水| 白色糠疹用什么药膏| ppd是什么| hscrp高是什么感染| l代表什么| 骨折用什么药恢复快| 喜筵和喜宴是什么意思| 小孩小腿疼是什么原因引起的| 生育保险有什么用| 1997年属什么| 穿孔是什么意思| 六月八日是什么星座| 不二法门是什么意思| 梦见抽血是什么预兆| 6什么意思| jacquemus是什么牌子| 毛滴虫病是什么病| 湿寒吃什么中成药| 什么书什么画| 中联办是什么级别| 大腿肿胀是什么原因| 党按照什么的原则选拔干部| 肚子突然变大是什么原因| 刺五加配什么药治失眠| 感染梅毒有什么症状| 夕阳无限好只是近黄昏是什么意思| 95年属什么| 凌晨的凌是什么意思| 大虾炒什么菜好吃| 7月20日是什么星座| 宇字属于五行属什么| bu什么颜色| 貌合神离是什么意思| cea是什么意思| 气垫是什么| 中科院是干什么的| 千里马比喻什么人| 猫咪冠状病毒什么症状| 玉势是什么| fnc是什么意思| 大拇指戴戒指是什么意思| 三个龙是什么字| 痢疾是什么原因引起的| audrey是什么意思| 门对门风水有什么说法| 尿液臭味很重什么原因| 血小板减少是什么症状| mom是什么意思| 死于非命是什么意思| 山楂泡水喝有什么功效| 人言可畏是什么意思| 左脸上长痘痘是什么原因| 猪肝有什么功效与作用| 臆想症是什么意思| 汗毛重是什么原因| 阴道炎什么症状| 这个季节有什么水果| 银饰发黑是什么原因| clean什么意思| 小动脉瘤是什么意思| 什么叫脑白质病| 万病之源是什么| 葡萄糖高是什么原因| 60min是什么意思| 上午十点是什么时辰| 结婚8年是什么婚| td代表什么意思| 吃什么可以增加免疫力| 377是什么意思| bur什么意思| ed是什么| 什么原因引起血糖高| nt什么货币| 门当是什么| 葡萄胎是什么| 什么叫压缩性骨折| 蔻驰香水属于什么档次| 狐臭是什么味道| 白细胞高什么原因| 胃溃疡能吃什么| 什么是工作| 古驰属于什么档次| 猫来家门口有什么预兆| 阴虚火旺吃什么中成药好| 拉姆藏语什么意思| 木耳有什么功效与作用| 俄罗斯的货币叫什么| 6月24什么星座| 慢性胃炎吃什么食物好| 抑扬顿挫什么意思| 脚麻看什么科室最好| 月子病是什么症状| 人格魅力什么意思| 肝肾衰竭有什么症状| 窦性心律不齐是什么情况| 梅花三弄的三弄指什么| 血糖高的人吃什么水果| rh是什么单位| 身上长小肉揪是什么原因| 避孕药吃多了有什么副作用| 拔完牙吃什么药| 鼻塞流鼻涕吃什么药| 讹诈是什么意思| 感冒为什么会流眼泪| 羊水少吃什么| 什么叫钙化灶| 嗓子痒痒吃什么药| 红色的补色是什么颜色| 热敷眼睛有什么好处| hpv初期有什么症状女性| 酸奶用什么菌发酵| 乌龟下蛋预示着什么| 三维彩超主要检查什么| 外阴红肿疼痛用什么药| 预防医学是干什么的| 孕妇做春梦是什么意思| 400年前是什么朝代| 来月经腰酸腰痛什么原因造成的| 两岁宝宝不开口说话是什么原因| 牛黄安宫丸什么季节吃| 过期的酸奶有什么用| 道地药材是什么意思| 吃什么药降尿酸快| 红楼梦是一部什么小说| 胎位loa是什么意思| 不明原因腹痛挂什么科| 濡湿是什么意思| 流产后不能吃什么东西| 吃玉米有什么好处| 凌晨两点是什么时辰| 女孩喜欢什么礼物| 遇人不淑是什么意思| 什么书在书店里买不到| 和胃降逆是什么意思| 膀胱壁增厚毛糙是什么意思| fw什么意思| 浮现是什么意思| 百香果有什么作用| 膀胱癌有什么症状| 百度

哈萨克女兵选美比赛曝军装照:吸引更多男性入伍

百度 ”杭州市红十字会医院结核外科主任徐旭东说。

Require client details and operation names to help monitor schema usage


Metrics about GraphQL schema usage are more insightful when information about clients using the schema is available. Understanding client usage can help you reshape your schema to serve clients more efficiently. As part of GraphOS Studio metrics reporting, servers can tag reported operations with the requesting client's name and version. This client awareness helps graph maintainers understand which clients are using which fields in the schema.

Apollo's GraphOS Router and Apollo Server can enable client awareness by requiring metadata about requesting clients. The router supports client awareness by default. If the client sets its name and version with the headers apollographql-client-name and apollographql-client-version in its HTTP requests, GraphOS Studio can separate the metrics and operations per client.

note
The client name is also used by the persisted queries feature.

Clients should name their GraphQL operations to provide more context around how and where data is being used.

Why enforce client reporting?

Client metadata enables better insights into schema usage, such as:

  • Identifying which clients use which fields: This facilitates usage monitoring and safe deprecation of fields.

  • Understanding traffic patterns: This helps optimize schema design based on real-world client behavior.

  • Improving operation-level observability: This provides details for debugging and performance improvements.

Apollo strongly recommends requiring client name, client version, and operation names in all incoming GraphQL requests.

Customizing client awareness information

The GraphOS Router supports client awareness by default if the client sets the apollographql-client-name and apollographql-client-id in their requests. These values can be overridden using the router configuration file directly. You can use a Rhai script to enforce that clients include metadata.

Via router configuration

If headers with customized names need to be sent by a browser, they must be allowed in the CORS (Cross Origin Resource Sharing) configuration, as follows:

YAML
router.yaml
1telemetry:
2  apollo:
3    # defaults to apollographql-client-name
4    client_name_header: MyClientHeaderName
5    # defaults to apollographql-client-version
6    client_version_header: MyClientHeaderVersion
7cors:
8  # The headers to allow.
9  # (Defaults to [ Content-Type ], which is required for GraphOS Studio)
10  allow_headers: [ Content-Type, MyClientHeaderName, MyClientHeaderVersion]

Via router customization

The client awareness headers are parsed out of the HTTP request immediately in the router request lifecycle. If you need to dynamically set the values, you should instead mutate the values in the GraphQL context after they have been parsed, but before they are sent. You can do so by using Rhai scripts or coprocessors and hooking into the RouterRequest lifecycle stage.

Rhai
client-name-version.rhai
1fn router_service(service) {
2    const request_callback = Fn("process_request");
3    service.map_request(request_callback);
4}
5
6fn process_request(request) {
7    // ... logic to parse request and calculate name/version
8    request.context["apollo::telemetry::client_name"] = "custom name";
9    request.context["apollo::telemetry::client_version"] = "custom version";
10}
11
12### Enforcing via Rhai script
13
14Client headers can be enforced using a [Rhai script](/graphos/routing/customization/rhai) on every incoming request.
15
16```rhai title="client-id.rhai"
17fn supergraph_service(service) {
18    const request_callback = Fn("process_request");
19    service.map_request(request_callback);
20  }
21
22fn process_request(request) {
23  log_info("processing request");
24  let valid_clients = ["1", "2"];
25  let valid_client_names = ["apollo-client"];
26
27  if ("apollographql-client-version" in request.headers && "apollographql-client-name" in request.headers) {
28    let client_header = request.headers["apollographql-client-version"];
29    let name_header = request.headers["apollographql-client-name"];
30
31    if !valid_clients.contains(client_header) {
32      log_error("Invalid client ID provided");
33      throw #{
34        status: 401,
35        message: "Invalid client ID provided"
36      };
37    }
38    if !valid_client_names.contains(name_header) {
39      log_error("Invalid client name provided");
40      throw #{
41        status: 401,
42        message: "Invalid client name provided"
43      };
44    }
45  }
46  else {
47    log_error("No client headers set");
48    throw #{
49      status: 401,
50      message: "No client headers set"
51    };
52  }
53}

See a runnable example Rhai script in the Apollo Solutions repository.

note
The code in this repository is experimental and has been provided for reference purposes only.
tip
If you're an enterprise customer looking for more material on this topic, try the Enterprise best practices: Router extensibility course on Odyssey.Not an enterprise customer? Learn about GraphOS for Enterprise.

Enforcing headers in Apollo Server

If you're using Apollo Server for your gateway, you can require client metadata in every incoming request with a custom plugin:

tip
The header names used below are the default headers sent by Apollo Client, but you can change them to whatever names your client uses. Additionally, these changes must be reflected in the usage reporting plugin to report client headers to GraphOS. For an example, see using custom client id headers.
TypeScript
index.ts
1function clientEnforcementPlugin(): ApolloServerPlugin<BaseContext> {
2  return {
3    async requestDidStart() {
4      return {
5        async didResolveOperation(requestContext) {
6          const clientName = requestContext.request.http.headers.get("apollographql-client-name");
7          const clientVersion = requestContext.request.http.headers.get("apollographql-client-version");
8
9          if (!clientName) {
10            const logString = `Execution Denied: Operation has no identified client`;
11            requestContext.logger.debug(logString);
12            throw new GraphQLError(logString);
13          }
14
15          if (!clientVersion) {
16            const logString = `Execution Denied: Client ${clientName} has no identified version`;
17            requestContext.logger.debug(logString);
18            throw new GraphQLError(logString);
19          }
20
21          if (!requestContext.operationName) {
22            const logString = `Unnamed Operation: ${requestContext.queryHash}. All operations must be named`;
23            requestContext.logger.debug(logString);
24
25            throw new GraphQLError(logString);
26          }
27        },
28      };
29    },
30  };
31}
32const server = new ApolloServer({
33  typeDefs,
34  resolvers,
35  plugins: [clientEnforcementPlugin()],
36});

Adding enforcement for existing clients

If clients are already consuming your graph and are not providing client metadata, adding universal enforcement will break those clients. To resolve this you should take the following steps:

Use other headers

If you have other existing headers in your HTTP requests that can be parsed to extract some client info, you can extract the info from there.

GraphOS Router

Client awareness headers should be overridden using the router configuration file to use the appropriate header names.

Apollo Server

If you do change the identifying headers, also update the Usage Reporting Plugin to use the new headers so that the proper client info is also sent to Studio.

Ask clients to update their requests

The long-term fix will require that clients start sending the required headers needed to extract client info. While clients are working on updating their requests you can add the plugin code to your gateway, but instead of throwing an error you can log a warning so that the gateway team can track when all requests have been updated.

柿子不能和什么食物一起吃 什么养胃 耳后淋巴结肿大挂什么科 撇嘴表情什么意思 梦见自己假牙掉了是什么意思
魔芋是什么 阴虚阳亢是什么意思 咳嗽不停是什么原因 island什么意思 就这样吧是什么意思
给男人补身体煲什么汤 什么魂什么魄 血液净化是什么意思 左侧头疼是什么原因 中医七情指的是什么
女的肾虚是什么原因引起的 剖腹产可以吃什么 天上人间是什么意思 什么动物没有眼睛 什么样的白带是怀孕了
唯女子与小人难养也什么意思hcv9jop5ns7r.cn 卵圆孔未闭挂什么科jinxinzhichuang.com 瓦是什么的单位hcv8jop0ns5r.cn 内射什么感觉hcv8jop0ns1r.cn 胆毒是什么原因引起的hcv9jop4ns3r.cn
scc是什么检查项目hcv8jop4ns3r.cn 晕血是什么症状hcv7jop7ns3r.cn 封神榜讲的是什么故事hcv7jop5ns0r.cn 兰花叶子发黄是什么原因hcv8jop5ns0r.cn 全身发冷是什么原因hcv8jop0ns1r.cn
缺钾吃什么食物hcv9jop3ns2r.cn 小狗得细小是什么症状hcv9jop3ns7r.cn 补气血吃什么最好hcv8jop7ns2r.cn 环球中心有什么好玩的hcv7jop6ns6r.cn 蛤蚧是什么hcv7jop6ns1r.cn
心火大吃什么能清火hcv8jop2ns3r.cn 天鹅吃什么hcv7jop9ns9r.cn 21岁属什么hcv8jop4ns1r.cn 生猴子是什么意思hcv8jop7ns2r.cn 耳返是什么hcv9jop7ns0r.cn
百度