Skip to content

Read nf.container from NETFLIX_CONTAINER_NAME - #99

Merged
brharrington merged 1 commit into
mainfrom
nf-container-attribution
Oct 15, 2026
Merged

brharrington merged 1 commit into
mainfrom
nf-container-attribution

Conversation

@ecbadeaux

@ecbadeaux ecbadeaux commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Title: Read nf.container from NETFLIX_CONTAINER_NAME, falling back to TITUS_CONTAINER_NAME

Summary

nf.container is now read from NETFLIX_CONTAINER_NAME first, falling back to TITUS_CONTAINER_NAME. nf.process is unchanged and still comes from NETFLIX_PROCESS_NAME.

Why

TITUS_CONTAINER_NAME exists only on Titus, so containers on other platforms get no nf.container tag today. NETFLIX_CONTAINER_NAME is a platform-neutral variable that holds the container's name (the Kubernetes container name). Reading it first, with the Titus variable as the fallback, adds coverage for other platforms and leaves Titus unchanged.

Behavior

NETFLIX_CONTAINER_NAME TITUS_CONTAINER_NAME nf.container
app main app
unset, empty or blank main main
app unset app
unset unset not added
  • Same helper as before. It uses the existing _add_non_empty helper, which already accepts several variables. Values are stripped and blank values are skipped, as before.
  • No change on Titus. While NETFLIX_CONTAINER_NAME is unset, the tags are exactly what they are today.
  • Precedence is unchanged. These environment tags still take precedence over the same keys in extra_common_tags.

Docs

  • tags_from_env_vars docstring: lists the variables and the fallback, and says that blank values are ignored.
  • Config docstring:
    • Says the two tags are read when a Config is created, and that they take precedence over extra_common_tags.
    • Says the Configs behind Registry() and GlobalRegistry are created when spectator is imported, so the variables must be set before that import. Changing os.environ after the import has no effect on them.

@brharrington brharrington changed the title Update tag attribution Read nf.container from NETFLIX_CONTAINER_NAME Oct 15, 2026
@brharrington
brharrington merged commit bafd355 into main Oct 15, 2026
4 checks passed
@brharrington
brharrington deleted the nf-container-attribution branch October 15, 2026 15:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants