Skip to content

Commit

Permalink
Bug 1655477 Support X-Source-Tags header (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
jklukas authored Aug 3, 2020
1 parent 9272289 commit 0893023
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions docs/architecture/decoder_service_specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ required group attributes {
optional string dnt // header from client
optional string x_pingsender_version // header from client
optional string x_debug_id // header from client
optional string x_source_tags // header from client
optional string user_agent_browser // from user_agent
optional string user_agent_browser_version // from user_agent
optional string user_agent_os // from user_agent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ public class AddMetadata {

private static final String HEADER = "header";
private static final List<String> HEADER_ATTRIBUTES = ImmutableList //
.of(Attribute.DATE, Attribute.DNT, Attribute.X_PINGSENDER_VERSION, Attribute.X_DEBUG_ID);
.of(Attribute.DATE, Attribute.DNT, Attribute.X_PINGSENDER_VERSION, Attribute.X_DEBUG_ID,
Attribute.X_SOURCE_TAGS);

private static final List<String> URI_ATTRIBUTES = ImmutableList //
.of(Attribute.URI, Attribute.APP_NAME, Attribute.APP_VERSION, Attribute.APP_UPDATE_CHANNEL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,20 @@ public void testPutUserAgentAttributes() throws Exception {
public void testHeadersFromAttributes() throws Exception {
Map<String, String> attributes = ImmutableMap.of("dnt", "1", //
"sample_id", "18", //
"x_source_tags", "automation, perf", //
"x_debug_id", "mysession");
ObjectNode headers = AddMetadata.headersFromAttributes(attributes);
ObjectNode expected = mapToObjectNode(ImmutableMap.of("dnt", "1", "x_debug_id", "mysession"));
ObjectNode expected = mapToObjectNode(ImmutableMap.of("dnt", "1", "x_debug_id", "mysession",
"x_source_tags", "automation, perf"));
assertEquals(expected, headers);
}

@Test
public void testPutHeaderAttributes() throws Exception {
ObjectNode metadata = mapToObjectNode(
ImmutableMap.of("header", ImmutableMap.of("dnt", "1", "x_debug_id", "mysession")));
ObjectNode metadata = mapToObjectNode(ImmutableMap.of("header", ImmutableMap.of("dnt", "1",
"x_debug_id", "mysession", "x_source_tags", "automation, perf")));
Map<String, String> expected = ImmutableMap.of("dnt", "1", //
"x_debug_id", "mysession");
"x_debug_id", "mysession", "x_source_tags", "automation, perf");
Map<String, String> attributes = new HashMap<>();
AddMetadata.putHeaderAttributes(attributes, (metadata));
assertEquals(expected, attributes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ private Attribute() {
public static final String X_FORWARDED_FOR = "x_forwarded_for";
public static final String X_PINGSENDER_VERSION = "x_pingsender_version";
public static final String X_PIPELINE_PROXY = "x_pipeline_proxy";
public static final String X_SOURCE_TAGS = "x_source_tags";
}

public static class FieldName {
Expand Down
1 change: 1 addition & 0 deletions ingestion-edge/ingestion_edge/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class Route:
"X-Pingsender-Version",
"X-Pipeline-Proxy",
"X-Debug-ID",
"X-Source-Tags",
]

METADATA_HEADERS = {
Expand Down

0 comments on commit 0893023

Please sign in to comment.