Skip to content

Allow extending surfacers as extensions #661

Description

@jumpojoy

Implement surfacer extension interface
At the moment it is possible to extend surfacers via user defined surfacer type. But unfortunately this way is not flexible enough when it is required to pass additional configuration to the surfacer. It would be good to implement surfacer extension similar to probes.

Activity

  1. added
    enhancement
    on Dec 31, 2023
  2. manugarg commented on Jan 7, 2024

    @manugarg
    Contributor

    Hello @jumpojoy,

    We didn't feel the need for surfacer extensions because extensions are truly useful when you want to have multiple types of them in a single process. For example, if you define a redis probe extension, you may run multiple redis probes with slightly different parameters within the same process.

    On the other hand, if you implement a new surfacer type, you can take its configuration at the binary level. For example, if you're adding let's say a Dynatrace surfacer, you can take Dynatrace config at the binary level .. either through environment variables or flags. Extension will be useful if you want to define multiple Dynatrace surfacers, each with slightly different config.

    Does it make sense? If you can explain your use case a bit more we can prioritize it better.

    Thanks,
    Manu

  3. jumpojoy commented on Jan 15, 2024

    @jumpojoy
    ContributorAuthor

    Hello @manugarg !

    Thanks for quick reply.

    I do not think that we need multiple types of same surfacer in one processes, I've missed this is a difference also.

    We are trying to use cloudprober as a monitoring for OpenStack (this is opensource cloud technology). The user workloads there running in fully is isolated private networks, under the hood (depend on the networking driver) the network is an abstraction represents as linux network namespace. So we starting a cloudprober instance for each OpenStack network (linux network namespace). Later we aggregate metrics from all cloudprober instances. Custom surfacer stores metrics in a files in json/yaml format. So we can easely read all files and make combined output.

    We already pass configuration externally to the surfacer this works for sure, but I was thinking that idea of implementing an ability to extend surfacer configuration with protobuf extension makes sense.

    Thanks,
    Vasyl

  4. added theissue type on Aug 12, 2025
  5. removed
    enhancement
    on Aug 12, 2025
  6. Garbett1 commented on Aug 12, 2025

    @Garbett1

    Being able to configure the surfacers via the same prototext interface as the probes and targets would be useful. We can configure them via the binary config with flags/env variables, but it starts making it harder to reuse things like the Helm charts because of plumbing through extra args.

    The prototext interface is quite nice to get the validation that comes with the rest of the config too.

  7. manugarg commented on Aug 12, 2025

    @manugarg
    Contributor

    Okay, I guess it does make sense. I'll look into this.

  8. jumpojoy commented on Aug 12, 2025

    @jumpojoy
    ContributorAuthor
  9. self-assigned this
    on Aug 12, 2025
  10. manugarg commented on Aug 12, 2025

    @manugarg
    Contributor

    Here is the PR implementing it:
    #1126

    This is the new interface:

    //	import (
    //		"github.com/cloudprober/cloudprober"
    //		"github.com/cloudprober/cloudprober/surfacers"
    //	)
    //
    //	s := &FancySurfacer{}
    //      func initFancySurfacer(conf *configpb.SurfacerConf) (*FancySurfacer, error) {
    //         ...
    //      }
    //
    //	surfacers.RegisterSurfacerType(200, func(conf any) (Surfacer, error) {
    //		fancyConf, ok := conf.(*configpb.SurfacerConf)
    //		if !ok {
    //			return nil, fmt.Errorf("got unexpected config type %T", conf)
    //		}
    //		return initFancySurfacer(fancyConf)
    //	})
    //
    //	pr, err := cloudprober.Init()
    //	if err != nil {
    //		log.Exitf("Error initializing cloudprober. Err: %v", err)
    //	}
    
  11. added this to the v0.14.1 milestone on Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions